Klaus on Tilde Town

Restoring the Mediatek WiFi drivers in Alpine Linux 3.19.1

A type of Mediatek USB wifi adapter

Not sure if anyone has a setup similar to mine, but after the update to kernel 6.6.18-0 in Alpine Linux, my Mediatek wifi dongle stopped working. The network interface simply wasn't there. Querying dmesg for logs revealed the following useful snippet:

...
[   10.928930] usb 1-3: reset high-speed USB device number 2 using ehci-pci
[   11.081925] mt7601u 1-3:1.0: ASIC revision: 76010001 MAC revision: 76010500
[   11.106669] mt7601u 1-3:1.0: Direct firmware load for mt7601u.bin failed with error -2
[   11.107341] mt7601u: probe of 1-3:1.0 failed with error -2
[   11.107399] usbcore: registered new interface driver mt7601u
...

This was interesting because, until now, this dongle was supported out of the box by the kernel driver mt7601u. I reconnected the dongle, but the interface would not come up and the same error messages would appear again in dmesg. I thought for a while and checked under the /lib/firmware/ directory.

Bam: no such firmware file in there. I think it got removed during the update?

From this point, the solution was simple: checking the Alpine Linux packages page, I found it under a separate package linux-firmware-mediatek. Thus, after issuing the following commands:

# apk add linux-firmware-mediatek
# modprobe -r mt7601u
# modprobe mt7601u

The wlan0 interface appeared again! Mission complete.

I'm left wondering, though, why did it get removed after so long? The only answer I can think of is to save space. Since Alpine is optimized to run in containers and embedded environments, any "useless" weight must be shed, even documentation. Chances are that this driver isn't particularly popular since it's for cheap USB devices that are not even that current (support only until 802.11n standard), so probably it was given the boot from the mainline kernel.

Thankfully, though, the driver still exists as a separate package, so people like me can still get support. Hooray for old computers still being able to rock, thanks to lightweight Linux distributions!

(I'll probably be looking into other stuff that's present as linux-firmware-* packages, though)