How to install driver for Wi-Fi Mediatek MT7921 and Mediatek MT7961 in Linux

This post will show you how to fix the problem with Mediatek MT7921 and Mediatek MT7961 Wi-Fi adapters not working, which you can find in the latest laptop models, such as ASUS ROG G15 and Asus TUF Gaming A15 FX506L-HN004.

We need the mt76 driver, which provides the following chipsets (source):

  • MT7610U 802.11a/b/g/n/ac 1T1R 2.4/5GHz USB Chip
  • MT7612/MT7662 802.11a/b/g/n/ac 2T2R 2.4/5GHz PCIe/USB Chip
  • MT7630E 802.11a/b/g/n 1T1R 2.4/5GHz PCIe Chip
  • MT7610E 802.11a/b/g/n/ac 1T1R 2.4/5GHz PCIe Chip
  • MT7603E 802.11b/g/n 2T2R 2.4GHz PCIe chip and MT7628 802.11b/g/n 2T2R 2.4GHz SoC Device (4.7+)
  • MT7615 802.11a/b/g/n/ac 4T4R 2.4/5GHz PCIe Chip (5.2+)
  • MT7622 802.11b/g/n 4T4R 2.4GHz SoC Device (5.7+)
  • MT7663 802.11a/b/g/n/ac 2T2R 2.4/5GHz PCIe/USB/SDIO Chip (5.8+)
  • MT7915 802.11a/b/g/n/ac/ax 4T4R 2.4/5GHz PCIe Chip (5.9+)
  • MT7921 802.11a/b/g/n/ac/ax 2T2R 2.4/5GHz PCIe Chip (5.12+)

MT7961 is not included in this list, but the kernel module for MT7921 is responsible for its operation.

You can see the numbers in brackets – they indicate the version of the kernel from which the driver is supported. Yes, the good news is that the driver is supported by the Linux kernel out of the box, so, in theory, the user doesn't need to take any action – the Wi-Fi adapter should “just work”.

But the problem is that the Linux kernel from version 5.12 is relatively fresh and not as widespread in Linux distributions. For example, a preliminary version of the 5.15 kernel is already available at the time of writing, and the 5.14 kernel is already used in Arch Linux. But Ubuntu 21.04 uses the 5.11 kernel, so Linux Mint has an even older kernel.

There are 2 ways out of this situation:

  1. Wait until your distribution receives the latest kernel version (it may never happen, since only new versions of distributions will receive a new kernel)
  2. Install the latest kernel version yourself (there are some risks for the system)

So, you need to install kernel 5.12 or later – how to do this depends on your particular distribution. This tutorial will show you how to install the latest kernel in:

  • Ubuntu and distributions that are based on Ubuntu
  • Linux Mint
  • Debian (stable and testing)
  • Kali Linux

I have kernel 5.12 or later, but Mediatek MT7921 (Mediatek MT7961) not working or working with problems

If you already have a fresh kernel 5.12 or newer installed, but Wi-Fi adapters or Bluetooth are working with problems, then this section is for you.

The Mediatek MT7921 and Mediatek MT7961 chipsets require firmware, which, although available in the standard distribution repositories, is usually not installed by default.

On Debian, Ubuntu, Linux Mint, Kali Linux and their derivatives, run the following command:

sudo apt install firmware-misc-nonfree

On Arch Linux, Manjaro, BlackArch and their derivatives, run the command:

sudo pacman -S linux-firmware

Kernel update warning

All subsequent sections show you how to update your kernel to the latest version. It should be remembered that due to the incompatibility of the kernel with programs (first of all, with proprietary drivers), you may encounter problems, including a black screen during boot.

In most cases, the problems encountered can be resolved without reinstalling the distribution. Start by going to the advanced options in the boot menu and boot with the previous version of the kernel. After completing the boot, remove the problematic kernel.

Proprietary graphics card drivers can cause problems, as older versions may not be compatible with the latest kernels without a patch. If you have proprietary video drivers installed, then seriously consider before following the instructions below. Also get ready, look for instructions on how to solve the problem when loading the distribution into a black screen.

Owners of old distributions should be especially careful – it is strongly recommended to update the kernel only on the latest OS versions.

This instruction has been tested on distributions:

  • Ubuntu 21.04
  • Linux Mint 20.2
  • Kali Linux 2021.3

Ubuntu and Linux Mint installed kernel 5.14, and Kali Linux installed kernel 5.13. All distributions booted and worked fine.

Another very likely problem that you may encounter if you install the latest kernel is the problem with unresolved dependencies and, as a result, the inability to use the apt package manager to update and install programs. If you are faced with a situation where, after successfully installing a new kernel, you cannot update packages using apt, then try installing the previous versions of the kernel that suit you, and uninstall the versions that cause dependency problems. Remember that it is impossible to remove the kernel you booted with – boot your computer with any other version of the kernel before uninstalling.

Wi-Fi Mediatek MT7921 and Mediatek MT7961 not working in Ubuntu and Linux Mint (SOLVED)

Related: How to Install the Latest Linux Kernels on Ubuntu and Linux Mint

For Ubuntu, there is a repository of compiled kernels of all versions, including the most recent, so installation is not particularly difficult - you do not need to compile the Linux kernel. Moreover, there are tools, including those with a graphical interface, to install any kernels.

Since Linux Mint is based on Ubuntu, this guide is fully applicable to Linux Mint distributions, except for LMDE. For LMDE (Linux Mint Debian Edition) see the following section on Debian and derivatives, respectively.

If you prefer a graphical interface then use Mainline:

sudo apt-add-repository -y ppa:cappelikan/ppa
sudo apt update
sudo apt install mainline
mainline-gtk

In this tutorial, I will show you how to install the latest kernel on Ubuntu 21.04 using the ubuntu-mainline-kernel.sh command line utility.

Checking the current kernel version:

uname -r
5.11.0-36-generic

The kernel is version 5.11, and we need at least 5.12.

Download and install the ubuntu-mainline-kernel.sh script:

wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
sudo install ubuntu-mainline-kernel.sh /usr/local/bin/

We check which version of the kernel is the latest:

ubuntu-mainline-kernel.sh -c

To display a list of available kernels versions for installation, run the command:

sudo ubuntu-mainline-kernel.sh -r

For example, we want to install the kernel version v5.12.11, then the command is as follows (you do not need to specify the “v” prefix):

sudo ubuntu-mainline-kernel.sh -i 5.12.11

Attention: tests have shown that to solve the problem with the Mediatek MT7921 (Mediatek MT7961) drivers, it is recommended to install the kernel version 5.12.11, since the 5.14 kernel, although it installs normally, subsequently brings problems with unresolved dependencies when using the apt package manager.

If you want to install the latest version at the moment, then run the following command:

sudo ubuntu-mainline-kernel.sh -i

You will be asked if you want to continue, type “y”:

Latest version is: v5.14.6, continue? (y/N)

The program has exited – a restart is required for the changes to take effect.

Check the kernel version again:

By default, your system will boot with the latest kernel, if you want to change this, then go to advanced boot options

and select the version you want from the installed kernels.

Don't forget to install the firmware files:

sudo apt install firmware-misc-nonfree

The same instruction was tested on Linux Mint 20.2.

As you can see, the kernel has been updated successfully and Linux Mint is running.

Wi-Fi Mediatek MT7921 and Mediatek MT7961 not working in Debian, Kali Linux (SOLVED)

Related: How to Install the Latest Linux Kernels on Debian and Debian Based Distributions

This section should be suitable for all variations and derivatives of Debian, for example:

  • Debian stable
  • Debian testing
  • Kali Linux
  • MX Linux
  • other

Let's check the current kernel version:

uname -a

In order not to compile the kernel from scratch, we will use the kernels of the XanMod Kernel project.

To install the latest kernel version, just run the following commands:

echo 'deb http://deb.xanmod.org releases main' | sudo tee /etc/apt/sources.list.d/xanmod-kernel.list
wget -qO - https://dl.xanmod.org/gpg.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/xanmod-kernel.gpg add -
sudo apt update && sudo apt install linux-xanmod

Wait for the update to complete and reboot.

Let's check the kernel version again:

uname -a

Output example:

inux HackWare-Kali 5.13.19-xanmod1 #0~git20210919.7960459 SMP PREEMPT Sun Sep 19 13:46:36 UTC 2021 x86_64 GNU/Linux

If for some reason the GRUB menu has not been updated, then run the command:

sudo update-grub

Don't forget to install the firmware files:

sudo apt install firmware-misc-nonfree

By the way, you can choose the XanMod kernel version.

How to recover Linux after installing the kernel

If your computer boots with a black screen, freezes, or something doesn't work after updating the kernel, reboot and select Advanced options for your distribution from the GRUB menu:

Then select the previous kernel version and press Enter:

Regardless of the reason, you need to boot with the previous version of the kernel if you want to remove the latest kernel. This is because you cannot remove the kernel that is currently in use.

If you do not see the GRUB2 menu, press and hold the Shift key or press the Esc key repeatedly (this may vary depending on BIOS or UEFI boot and the version of Ubuntu/Linux Mint you are using) while booting GRUB. The Grub menu should appear allowing you to select a previous kernel version.

After booting the previous kernel, you can remove the faulty kernel. ubuntu-mainline-kernel.sh allows you to remove kernels installed from the Ubuntu kernel PPA.

With ubuntu-mainline-kernel.sh you can remove the kernel version by running:

sudo ubuntu-mainline-kernel.sh -u VERSION

Where VERSION is the kernel version, for example 5.14. You can also use this utility with -u without specifying a version, in which case the tool will list up to 10 kernel versions and ask you which one you want to remove. It's worth noting that ubuntu-mainline-kernel.sh will not show official Ubuntu kernels in this list.

To remove the XanMod kernel in Debian and derivatives run the commands:

sudo apt remove linux-xanmod
sudo apt remove `sudo apt show linux-xanmod | grep Depends | sed 's/,//' | awk '{print $2,$3}'`

If this was not done automatically, then update your GRUB settings:

sudo update-grub

Recommended for you:

6 Comments to How to install driver for Wi-Fi Mediatek MT7921 and Mediatek MT7961 in Linux

  1. Rene says:

    Hi,

    Thanks for the expalnation and clear commands.
    I use Kali with the newest kernel 5.10 and an Acer Niro 5 Ryzen with Mediatek MT7921.

    I did run the next command:
    echo 'deb http://deb.xanmod.org releases main' | sudo tee /etc/apt/sources.list.d/xanmod-kernel.list
    wget -qO - https://dl.xanmod.org/gpg.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/xanmod-kernel.gpg add -
    sudo apt update && sudo apt install linux-xanmod

    After reboot I receive the next error; "(FAILED) Failed to start Entropy Da♦based on the HAVEGE algorithm". I'm unable to finish the boot session, so I can not login.

    Is there a solution for this problem?

    Like to here over it.

    Thanks,
    Rene

    • Alex says:

      Hello! I tested this service on my Kali Linux and it turned out that it doesn't work either, although as you can see in the screenshot, the system booted fine.

      I think that the reason why you cannot boot into the system is the proprietary drivers for the video card, namely, their incompatibility with the latest version of the kernel – I mentioned this in the article.

      If you do not want to experiment, but just want to return everything as it was, then roll back to the previous version of the kernel, as shown at the end of this article.

      The linux-xanmod package contains kernel version 5.13.*, You can try kernel version 5.12.*, For this:

      1. Boot with the previous version of the kernel

      2. Remove the linux-xanmod package:

      sudo apt remove linux-xanmod
      sudo apt remove `sudo apt show linux-xanmod | grep Depends | sed 's/,//' | awk '{print $2,$3}'`

      3. Install the linux-image-5.12.19-xanmod1 package:

      sudo apt install linux-image-5.12.19-xanmod1 linux-headers-5.12.19-xanmod1

      4. Reboot

      If this does not work, but you need a Wi-Fi driver, then I believe that you can boot with new kernels if you remove the proprietary video driver (but you must install an open source video driver like xserver-xorg-video-nouveau for NVIDIA).

  2. Rene says:

    Hi Alex,

    Thank you so much for the directions, it was very hopeful.
    Unfortunately it didn't help. After uninstalling the kernel and rebooting, I installed the new version 5.12.19 as described. However, after the installation, I couldn't boot the system, it even stuck in safe mode.
    I think that I will have to remove this kernel again.
    You are right, that there is a problem with my video card(s). I have the RTX3080 and one baked into the AMD CPU. I had already installed the drivers xserver-xorg-video-nouveau for NVIDIA, but there seems to be a problem with it. The dual screen function does not work.

    Thanks for the explanation
    Rene

  3. Rene says:

    Hi Alex,

    Thank you so much for the directions, it was very hopeful.
    Unfortunately it didn't help. After removing the kernel and rebooting, I installed the new version 5.12.19 as described. However, after installation, I couldn't boot the system, it even hung in safe mode.
    I think I have to remove this kernel again.
    You are right that there is a problem with my video card(s). I have the RTX3080 and one baked into the AMD CPU. I had already installed the xserver-xorg-video-nouveau drivers for NVIDIA, but there is still a problem with it. Before installation my second screen was not detected and after installation my internal screen is no longer detected. Also the dual screen function does not work.

    Thanks for the explanation
    Rene

  4. riemannesco says:

    Do you know if these cards could work on OpenBSD?

     

Leave a Reply

Your email address will not be published.