How to Connect MT7601U Wi-Fi from the Linux Console (Debian)

Category: Linux How-To
Posted: 26.10.2019
Author: Antonio

Connecting to Wi-Fi in a modern Linux distribution with a desktop is usually easy: as long as the hardware is supported, it’s just a few clicks.

Connecting to Wi-Fi from the Linux console is a bit harder, but entirely doable.

Debian wallpaper

Here is how I got internet over Wi-Fi with a TP-Link USB Wi-Fi dongle based on the MT7601U chip on Debian. I originally did it on Debian 9; below is the up-to-date version for Debian 12/13.

1. Identify the chip

lsusb
dmesg | grep -i -e wlan -e mt7601

In my case:

[    2.367184] mt7601u 4-1.4:1.0 wlx30b5c212d769: renamed from wlan0

If nothing shows up, page through dmesg | more and look for your Wi-Fi adapter. The MT7601U usually appears in lsusb as 148f:7601.

2. Install the firmware

The mt7601u driver is already in the kernel, but the firmware (mt7601u.bin) is in the non-free part of the repository. Add it to /etc/apt/sources.list:

# Debian 12 (bookworm); for Debian 13 replace bookworm with trixie
deb http://deb.debian.org/debian bookworm main non-free-firmware

In Debian 9–11 the component was simply called non-free.

Update and install what’s needed:

apt update
apt install firmware-misc-nonfree wpasupplicant iw

Reload the driver (or just replug the dongle):

modprobe -r mt7601u; modprobe mt7601u

3. Find the interface and scan

ip link

A Wi-Fi interface should appear. It used to be called wlan0; on modern systems the name is built from the MAC address — mine is wlx30b5c212d769. Use your own name from here on.

Scan for networks:

ip link set wlx30b5c212d769 up
iw dev wlx30b5c212d769 scan | grep SSID

If you see your network, good. If not, something’s wrong — time to dig in.

4. Connect

Create a config file with your network name and password:

wpa_passphrase MySuperWiFi mybestpassword > /etc/wpa_supplicant/wpa_supplicant.conf

Connect and get an IP address via DHCP:

wpa_supplicant -B -i wlx30b5c212d769 -c /etc/wpa_supplicant/wpa_supplicant.conf
dhclient wlx30b5c212d769

Wi-Fi should now be connected. Check with ip addr and ping 1.1.1.1.

5. Connect automatically at boot

Back then I wrote an init.d script, but the proper way is /etc/network/interfaces:

allow-hotplug wlx30b5c212d769
iface wlx30b5c212d769 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

If NetworkManager is installed, it’s even simpler — one command:

nmcli dev wifi connect MySuperWiFi password mybestpassword

While setting this up I ran into lots of different problems and “solutions”, most of which didn’t help, so I had to piece the information together bit by bit. I hope this note helps you too!

Share with friends or on social media (thanks!)
Related posts:

Написать

Копирование информации с сайта возможно только с указанием прямой ссылки - https://nemcd.com