Score:1

Wifi Driver with Dual Boot MediaTek

tr flag

So I have a Zephyrus G15 with Dual Boot with Ubuntu 21.10 and Windows 10.

When I first boot up Ubuntu the drivers worked fine off the bat for my Wi-fi MEDIATEK Corp card. But windows could not connect proprely to my router. So I uninstalled and resintalled the window's drivers for my wifi card. It worked, but now when i got back to Ubuntu I can't connect to the wifi not even the ethernet.

sudo lshw -c network:

       description: Ethernet controller
       product: Realtek Semiconductor Co., Ltd.
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:03:00.0
       version: 05
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list
       configuration: latency=0
       resources: ioport:d000(size=256) memory:fc800000-fc80ffff memory:fc810000-fc813fff
  *-network UNCLAIMED
       description: Network controller
       product: MEDIATEK Corp.
       vendor: MEDIATEK Corp.
       physical id: 0
       bus info: pci@0000:04:00.0
       version: 00
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm cap_list
       configuration: latency=0
       resources: iomemory:fc0-fbf iomemory:fc0-fbf iomemory:fc0-fbf memory:fc20300000-fc203fffff memory:fc20400000-fc20403fff memory:fc20404000-fc20404fff

lspci

03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. Device 8162 (rev 05)
04:00.0 Network controller: MEDIATEK Corp. Device 7961

lspci -nnk | grep 0280 -A3

04:00.0 Network controller [0280]: MEDIATEK Corp. Device [14c3:7961]
    Subsystem: AzureWave Device [1a3b:4680]
    Kernel modules: mt7921e
05:00.0 Non-Volatile memory controller [0108]: SK hynix Device [1c5c:174a]

uname -r

5.13.0-19-generic

more info

https://paste.ubuntu.com/p/9Sz5G6xm33/

Is it possible that my Windows installation could have affected my Ubuntu? I booted Ubuntu from a flash drive and the drivers worked fine. I even tried updating the kernels to no avail.

what does it mean when it says: network UNCLAIMED

Thank you

Someone avatar
my flag
Please [edit] your question to include the output of `lspci -nnk | grep 0280 -A3` followed by `uname -r`
Telegonicaxx avatar
tr flag
done I add the output
Someone avatar
my flag
Can you [edit] to include the output of `sudo dmesg | grep mt792`?
Telegonicaxx avatar
tr flag
Oh woah, that smart, didn't think about looking in log for the card name. But the output yield nothing.
Telegonicaxx avatar
tr flag
But i tried to do ```sudo dmesg | grep -i mediatek```, which yielded: [ 2.002089] usb 1-4: Manufacturer: MediaTek Inc.
Someone avatar
my flag
That will fail. Mediatek is name of a company not your wireless card :)
Telegonicaxx avatar
tr flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/133248/discussion-between-telegonicaxx-and-someone).
Score:2
tr flag

future person with the same problem.

I found out what the problem was. My WIFI card is MediaTek Wi-Fi 6 MT7921, which is currently supported by the linux kernel 5.16, is poorly supported by the 5.13 kernel, which is the one that shipped with my Ubuntu 21.10. It actually works on the first boot very poorly, and for the next boot it will not work at all.

Thus the solution is to upgrade to the new kernel with the commands:

# download the kernel files, headers, modules...etc
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-headers-5.16.0-051600_5.16.0-051600.202201092355_all.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-headers-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-image-unsigned-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb
wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.16/amd64/linux-modules-5.16.0-051600-generic_5.16.0-051600.202201092355_amd64.deb

now install the kernel in you system:

sudo dpkg -i *.deb

fix broken dependencies:

sudo apt install -f

You can reboot now, and it might work if you are not using safe boot.

However if you are, then you need to disable it or sign the kernel yourself. I followed this guide. But the basic step of sign the kernel are:

make a file called mokconfig.cnf with the text:

# This definition stops the following lines failing if HOME isn't
# defined.
HOME                    = .
RANDFILE                = $ENV::HOME/.rnd 
[ req ]
distinguished_name      = req_distinguished_name
x509_extensions         = v3
string_mask             = utf8only
prompt                  = no

[ req_distinguished_name ]
countryName             = <YOURcountrycode>
stateOrProvinceName     = <YOURstate>
localityName            = <YOURcity>
0.organizationName      = <YOURorganization>
commonName              = Secure Boot Signing Key
emailAddress            = <YOURemail>

[ v3 ]
subjectKeyIdentifier    = hash
authorityKeyIdentifier  = keyid:always,issuer
basicConstraints        = critical,CA:FALSE
extendedKeyUsage        = codeSigning,1.3.6.1.4.1.311.10.3.6
nsComment               = "OpenSSL Generated Certificate"

file <> parts with your information. Make sure to only use two character for the Country, state and city, ex: US CA LA

Create the public and private key for signing the kernel:

openssl req -config ./mokconfig.cnf \
        -new -x509 -newkey rsa:2048 \
        -nodes -days 36500 -outform DER \
        -keyout "MOK.priv" \
        -out "MOK.der"

Convert the key also to PEM format (mokutil needs DER, sbsign needs PEM):

openssl x509 -in MOK.der -inform DER -outform PEM -out MOK.pem

Enroll the key to your shim installation:

sudo mokutil --import MOK.der

Restart your system. You will encounter a blue screen of a tool called MOKManager. Select "Enroll MOK" and then "View key". Make sure it is your key you created in step 2. Afterwards continue the process and you must enter the password which you provided in step 4. Continue with booting your system.

Verify your key is enrolled via:

sudo mokutil --list-enrolled

Sign your installed kernel (it should be at /boot/vmlinuz-[KERNEL-VERSION]:

sudo sbsign --key MOK.priv --cert MOK.pem /boot/vmlinuz-[KERNEL-VERSION]-surface-linux-surface --output /boot/vmlinuz-[KERNEL-VERSION]-surface-linux-surface.signed
sudo cp /boot/initrd.img-[KERNEL-VERSION]-surface-linux-surface{,.signed}
sudo update-grub

now you can reboot =)

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.