stevepedwards.com/DebianAdmin linux mint IT admin tips info

Pi USB Mediatek WiFi dongle drivers and (failed) Pi install

This is just to check the dongle actually works by using it in Mint, which the git stuff works for, but not Raspbian, all because of the Chinese shit drivers from the MediaTEK site, needed for many rip off Ebay/Amazon "Pi compatible" wifi suppliers, don't install as is:

http://www.mediatek.com/en/downloads1/downloads/mt7601u-usb/

It's also an example of a wifi driver install, check and setup.

It won't work (it does not "make" by default for Mint/Raspbian)

$ make

make -C tools

make[1]: Entering directory '/home/stevee/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/tools'

gcc -g bin2h.c -o bin2h

make[1]: Leaving directory '/home/stevee/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/tools'

/home/stevee/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/tools/bin2h

cp -f os/linux/Makefile.6 /home/stevee/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/Makefile

make -C /lib/modules/3.18.11-v7+/build SUBDIRS=/home/stevee/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux modules

make[1]: *** /lib/modules/3.18.11-v7+/build: No such file or directory. Stop.

Makefile:394: recipe for target 'LINUX' failed

make: *** [LINUX] Error 2

and is "bad" code according to:

http://github.com/porjo/mt7601

For the Raspbian install, BEWARE the steps (no kernel --depth level switch, as in the original link he took it from, so you get the whole 2GB system!) in :

http://groenholdt.net/Computers/RaspberryPi/MediaTek-MT7601-USB-WIFI-on-the-Raspberry-Pi/MediaTek-MT7601-USB-WIFI-on-the-Raspberry-Pi.html

So, unless you want to download 2GB of kernel code to your Pi, just to install a driver - that failed anyway due to missing directory steps in the HowTo - rather than buy a new USB wifi dongle that is Pi compatible for £3 odd...or just upgrade to V4.2 per below?

rpi-update

Maybe RTL based ones that seem to be the alternative? (haven't got one myself).

The steps below from the GIT site do work for Mint, just to show the process really. To check your dongle just works, follow below for Mint, or you can plug it in Windows, if like me you thought you were getting a Pi dongle, and got a Win driver disk instead...anyway...

God, I lose patience with humanity sometimes...

Unofficial mt7601u driver

For kernels 3.19 and later a new mac80211 driver was written from scratch by the community. It was done because there is very little chance that this vendor driver will ever become part of official Linux kernel. If you have Linux kernel version between 3.19 and 4.2 you can download the new driver from

http://github.com/kuba-moo/mt7601u

If you have Linux 4.2 or later the new driver is already part of the kernel (it's called mt7601u). Note that from Linux 4.2 on you will have to blacklist the mt7601u driver to continue using code from this repository.

http://github.com/kuba-moo/mt7601u

This is a Linux driver for MediaTek MT7601U USB dongle. It was written from scratch based on the vendor GPL-driver. Unlike the vendor driver this driver uses modern Linux WiFi infrastructure and should work flawlessly with NetworkManager, wicd, wpa_supplicant and such. This driver was merged into mainline and is part of official Linux kernel since version v4.2. If you are using Linux 4.2 or later there is no need to install this driver.

So, off we go! What version IS the Mint 17.2 kernel after reading that 4.2 stuff above? A V3 variant.

DellMint stevee # uname -a

Linux DellMint 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Then, what exactly is GIT?

man git

NAME

git - the stupid content tracker

You can research that yourself...

git clone https://github.com/porjo/mt7601.git

The program 'git' is currently not installed. You can install it by typing:

apt-get install git

git clone https://github.com/porjo/mt7601.git

Cloning into 'mt7601'...

remote: Counting objects: 446, done.

remote: Total 446 (delta 0), reused 0 (delta 0), pack-reused 446

Receiving objects: 100% (446/446), 1.58 MiB | 1.06 MiB/s, done.

Resolving deltas: 100% (173/173), done.

Checking connectivity... done.

cd mt7601/src

MintRecPC src # ls

ate include Makefile os README_STA_usb sta

chips iwpriv_usage.txt mcu phy RT2870STACard.dat sta_ate_iwpriv_usage.txt

common mac mgmt rate_ctrl RT2870STA.dat tools

make

cp -f /home/stevee/Downloads/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/mt7601/src/os/linux/mt7601Usta.ko /tftpboot 2>/dev/null || :

mkdir -p /etc/Wireless/RT2870STA/

cp RT2870STA.dat /etc/Wireless/RT2870STA/

insmod os/linux/mt7601Usta.ko

If the module has loaded OK, you should see mt7601Usta listed in the output of lsmod and a new network interface ra0 should be present in the output of ip link.

lsmod | grep mt7601

mt7601Usta 610900 1

ifconfig

ra0 Link encap:Ethernet HWaddr 00:36:76:54:0b:01

inet6 addr: fe80::236:76ff:fe54:b01/64 Scope:Link

UP BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:4244 errors:0 dropped:0 overruns:0 frame:0

TX packets:84 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:1166203 (1.1 MB) TX bytes:8736 (8.7 KB)

man ip

NAME

ip - show / manipulate routing, devices, policy routing and tunnels

ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000

link/ether 18:a9:05:55:2c:e0 brd ff:ff:ff:ff:ff:ff

3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default

link/ether 52:9b:53:92:d9:eb brd ff:ff:ff:ff:ff:ff

4: ra0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state DORMANT mode DORMANT group default qlen 1000

link/ether 00:36:76:54:0b:01 brd ff:ff:ff:ff:ff:ff

If all goes well (no errors after make), you can permanently install the driver with

make install

make -C /home/stevee/Downloads/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/mt7601/src/os/linux -f Makefile.6 install

mkdir: cannot create directory '/etc/Wireless': File exists

make[1]: Entering directory `/home/stevee/Downloads/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/mt7601/src/os/linux'

rm -rf /etc/Wireless/RT2870STA

mkdir /etc/Wireless/RT2870STA

cp /home/stevee/Downloads/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/mt7601/src/RT2870STA.dat /etc/Wireless/RT2870STA/.

install -d /lib/modules/3.16.0-38-generic/kernel/drivers/net/wireless/

install -m 644 -c mt7601Usta.ko /lib/modules/3.16.0-38-generic/kernel/drivers/net/wireless/

/sbin/depmod -a 3.16.0-38-generic

make[1]: Leaving directory `/home/stevee/Downloads/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/mt7601/src/os/linux

MintRecPC src # iwconfig

eth0 no wireless extensions.

virbr0 no wireless extensions.

ra0 Ralink STA ESSID:"11n-AP" Nickname:"MT7601STA"

Mode:Auto Frequency=2.412 GHz Access Point: Not-Associated

Bit Rate:1 Mb/s

RTS thr:off Fragment thr:off

Encryption key:off

Link Quality=10/100 Signal level:0 dBm Noise level:0 dBm

Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0

Tx excessive retries:0 Invalid misc:0 Missed beacon:0

lo no wireless extensions.

iwlist ra0 sc

ra0 Scan completed :

Cell 01 - Address: 00:1D:AA:B9:72:70

Protocol:11b/g/n BW40

ESSID:"Switch Community Wifi"

Mode:Managed

Frequency:2.412 GHz (Channel 1)

Quality=68/100 Signal level=-63 dBm Noise level=-92 dBm

Encryption key:on

Bit Rates:300 Mb/s

IE: WPA Version 1

Group Cipher : TKIP

Pairwise Ciphers (2) : TKIP CCMP

Authentication Suites (1) : PSK

IE: IEEE 802.11i/WPA2 Version 1

Group Cipher : TKIP

Pairwise Ciphers (2) : TKIP CCMP

Authentication Suites (1) : PSK

IE: Unknown: DD310050F204104A000110104400010110470010BC329E001DD811B28601001DAAB97270103C0001011049000600372A000120

Cell 02 - Address: 02:1D:AA:B9:72:70

Protocol:11b/g/n BW40

ESSID:"Market Wifi"

Mode:Managed

Frequency:2.412 GHz (Channel 1)

Quality=73/100 Signal level=-61 dBm Noise level=-92 dBm

Encryption key:on

Bit Rates:300 Mb/s

IE: IEEE 802.11i/WPA2 Version 1

Group Cipher : CCMP

Pairwise Ciphers (1) : CCMP

Authentication Suites (1) : PSK

Cell 03 - Address: 5C:F8:A1:8B:DD:B7

Protocol:11b/g/n BW20

ESSID:"AndroidAP"

Mode:Managed

Frequency:2.437 GHz (Channel 6)

Quality=94/100 Signal level=-53 dBm Noise level=-92 dBm

Encryption key:on

Bit Rates:72 Mb/s

IE: IEEE 802.11i/WPA2 Version 1

Group Cipher : CCMP

Pairwise Ciphers (1) : CCMP

Authentication Suites (1) : PSK

Cell 04 - Address: 64:70:02:CE:BB:C4

Protocol:11b/g/n BW20

ESSID:"NETGEAR93"

Mode:Managed

Frequency:2.462 GHz (Channel 11)

Quality=13/100 Signal level=-85 dBm Noise level=-92 dBm

Encryption key:on

Bit Rates:130 Mb/s

IE: WPA Version 1

Group Cipher : TKIP

Pairwise Ciphers (2) : CCMP TKIP

Authentication Suites (1) : PSK

IE: IEEE 802.11i/WPA2 Version 1

Group Cipher : TKIP

Pairwise Ciphers (2) : CCMP TKIP

Authentication Suites (1) : PSK

Use the GUI Net Mgr to connect if you like:


 


Maybe the old -fashioned way still works these days from the Old Pages? Substitute wlan0 for ra0.

wpa_passphrase essid-name wpa-password > /etc/wpa_supplicant/wpa_supplicant.conf

(creates a basic wpa conf file), then run:

wpa_supplicant -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

Successfully initialized wpa_supplicant

ra0: Reject scan trigger since one is already pending
ra0: Failed to initiate AP scan...

(where -D is the standard linux wireless extensions driver, wext; -i is the name of wifi card (wlan0, ath0 etc.); and -c is the conf file.)

NOTE: a 10 digit hex password is a 40 bit secure psk; a 26 digit hex password eg "abcdef1234abcdef1234abcdef" is a 120 bit secure psk, and what can be input depends on the security capabilities of the ADSL wifi router/modem

Check yourself - run:

wpa_passphrase linksys abcdef1234

007aca04beffb195c12dee8a15682053f77f1342713af0d0e87db8141f4cbe86

If after you install all this and after a reboot you have no wired network connection, with a "not compatible with your system" type msg when you look at the wifi shortcut, then just delete the ra0 lines in the /etc/network/interfaces file, and restart the network services:

service networking restart

ifconfig

eth0 Link encap:Ethernet HWaddr 18:a9:05:55:2c:e0
inet addr:192.168.1.14 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::1aa9:5ff:fe55:2ce0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:37 errors:0 dropped:0 overruns:0 frame:0
TX packets:75 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3542 (3.5 KB) TX bytes:12680 (12.6 KB)
Interrupt:19

Getting a cmd line connection - open a 2nd term than the wpa_supplicant -D you used:

stevee@DellMint ~ $ iwlist
Usage: iwlist [interface] scanning [essid NNN] [last]
[interface] frequency
[interface] channel
[interface] bitrate
[interface] rate
[interface] encryption
[interface] keys
[interface] power
[interface] txpower
[interface] retry
[interface] ap
[interface] accesspoints
[interface] peers
[interface] event
[interface] auth
[interface] wpakeys
[interface] genie
[interface] modulation
stevee@DellMint ~ $ iwlist ra0 accesspoint
ra0 Peers/Access-Points in range:
B1:97:00:88:FF:FF : Quality=100/100 Signal level=-29 dBm Noise level=-92 dBm
B1:97:00:88:FF:FF : Quality=100/100 Signal level=-33 dBm Noise level=-92 dBm
A0:0F:07:A9:A0:0F : Quality=7/100 Signal level=-87 dBm Noise level=-96 dBm
00:00:00:00:00:00 : Quality=7/100 Signal level=-87 dBm Noise level=-96 dBm

man iwconfig

NAME
iwconfig - configure a wireless network interface

SYNOPSIS
iwconfig [interface]
iwconfig interface [essid X] [nwid N] [mode M] [freq F]
[channel C][sens S ][ap A ][nick NN ]
[rate R] [rts RT] [frag FT] [txpower T]
[enc E] [key K] [power P] [retry R]
[modu M] [commit]
iwconfig --help
iwconfig --version

DESCRIPTION
Iwconfig is similar to ifconfig(8), but is dedicated to the wireless
interfaces. It is used to set the parameters of the network interface
which are specific to the wireless operation (for example : the freâ
quency). Iwconfig may also be used to display those parameters, and
the wireless statistics (extracted from /proc/net/wireless).

The format of the files is different in Mint than old Debian.

You don’t need to use wpa_password to get a hash first anymore, just type your key in:

vi /etc/network/interfaces

auto ra0

iface ra0 inet dhcp

        wpa-ssid DrayTek

        wpa-psk password

DellMint stevee # ifup ra0

wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/ra0/00:36:76:54:0b:01
Sending on LPF/ra0/00:36:76:54:0b:01
Sending on Socket/fallback
DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 3 (xid=0x9b29e228)
DHCPDISCOVER on ra0 to 255.255.255.255 port 67 interval 3 (xid=0x9b29e228)

Hmm, can't connect. Yeah, well...I got fed up trying this manually - just use the NetMgr in Mint!!

Ah, that was OFF anyway, so probably over rides /etc/networks/interfaces..?

For a Pi, check the version for 4.2 with uname -a, or upgrade your system, then you won't need all the above.

rpi-update

Comments are closed.

Post Navigation