Header RSS Feed
 
If you only want to see the articles of a certain category, please click on the desired category below:
ALL Android Backup BSD Database Hacks Hardware Internet Linux Mail MySQL Monitoring Network Personal PHP Proxy Shell Solaris Unix Virtualization VMware Windows Wyse

Getting the EDIMAX EW-7811UN to work with Linux Mint 18.1
Monday - Feb 11th 2019 - by - (0 comments)

At work we have an "emergency" machine available. Goal of this machine is to have a dedicated Internet link via another ISP. This also helps us to simulate and compare accessing web-applications from internal networks vs. external networks. 

The machine itself runs with Linux Mint 18.1. While I never experienced any major issues with my Linux Mint installation (17.3) on my notebook (Dell Latitude E7440) so far, this machine has random issues with wireless connectivity. A simple ping to 8.8.8.8 revealed extreme changes of RTA. Sometimes the response time was 20ms, sometimes jumped up to 5000ms. Sometimes the WLAN connectivity was lost completely. 

"That's it, I've had it" I thought and ordered a new USB wireless adapter to replace the current wireless adapter from Ralink (Product: 802.11 n WLAN, idVendor=148f, idProduct=5370). Because I didn't really have the time to fiddle around with broken wlreless nic drivers, I ordered a Edimax EW-7811UN. Because it advertises to work with Mac, Windows and Linux and it is "ideal for Rasberry Pi" (which uses Debian in the background).

 Edimax EW 7811

To my understanding this should work out of the box. *buzzer* EEERRRR *buzzer* Mistake!

Once I connected the new EW-7811Un adapter to our emergency machine, it got discovered just fine in dmesg and was able to select a wireless lan from the wireless connections. But as soon as I clicked on my target WLAN, the machine froze. Ugh. Reset the machine.
Tried it again and Linux Mint froze again when I tried to connect. Reset again. Third time's the lucky charm. But again, freeze immediately when I clicked on the WLAN connect. Dang it! I will have to spend more time on that after all.

Before going into the solution, let's take a look at the current OS versions of this machine:

$ cat /etc/*release*
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18.1
DISTRIB_CODENAME=serena
DISTRIB_DESCRIPTION="Linux Mint 18.1 Serena"
NAME="Linux Mint"
VERSION="18.1 (Serena)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 18.1"
VERSION_ID="18.1"
HOME_URL="http://www.linuxmint.com/"
SUPPORT_URL="http://forums.linuxmint.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/linuxmint/"
VERSION_CODENAME=serena
UBUNTU_CODENAME=xenial

$ uname -a
Linux emergency 4.8.17-040817-generic #201701090438 SMP Mon Jan 9 09:40:28 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

When I plugged the Edimax Wi-Fi Nano USB adapter, this was logged just before the freeze:

Feb 11 09:52:11 emergency kernel: [348572.061670] usb 1-4: new high-speed USB device number 5 using xhci_hcd
Feb 11 09:52:11 emergency kernel: [348572.203106] usb 1-4: New USB device found, idVendor=7392, idProduct=7811
Feb 11 09:52:11 emergency kernel: [348572.203111] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 11 09:52:11 emergency kernel: [348572.203114] usb 1-4: Product: 802.11n WLAN Adapter
Feb 11 09:52:11 emergency kernel: [348572.203116] usb 1-4: Manufacturer: Realtek
Feb 11 09:52:11 emergency kernel: [348572.203119] usb 1-4: SerialNumber: 00e04c000001
Feb 11 09:52:12 emergency kernel: [348573.311847] rtl8192cu: Chip version 0x10
Feb 11 09:52:12 emergency kernel: [348573.344421] rtl8192cu: Board Type 0
Feb 11 09:52:12 emergency kernel: [348573.344494] rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1
Feb 11 09:52:12 emergency kernel: [348573.344537] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
Feb 11 09:52:12 emergency kernel: [348573.347070] ieee80211 phy1: Selected rate control algorithm 'rtl_rc'
Feb 11 09:52:12 emergency kernel: [348573.348931] usbcore: registered new interface driver rtl8192cu
Feb 11 09:52:12 emergency NetworkManager[800]:   [1549875132.6946] (wlan0): using nl80211 for WiFi device control
Feb 11 09:52:12 emergency NetworkManager[800]:   [1549875132.6948] device (wlan0): driver supports Access Point (AP) mode
Feb 11 09:52:12 emergency NetworkManager[800]:   [1549875132.6968] manager: (wlan0): new 802.11 WiFi device (/org/freedesktop/NetworkManager/Devices/3)
Feb 11 09:52:12 emergency kernel: [348573.400854] usbcore: registered new interface driver rtl8xxxu
Feb 11 09:52:12 emergency NetworkManager[800]:   [1549875132.7526] rfkill2: found WiFi radio killswitch (at /sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/ieee80211/phy1/rfkill2) (driver rtl8192cu)
Feb 11 09:52:12 emergency kernel: [348573.406344] rtl8192cu 1-4:1.0 wlx74da38f4dfe0: renamed from wlan0
Feb 11 09:52:12 emergency NetworkManager[800]:   [1549875132.7715] device (wlan0): interface index 4 renamed iface from 'wlan0' to 'wlx74da38f4dfe0'
Feb 11 09:52:12 emergency NetworkManager[800]:   [1549875132.7781] devices added (path: /sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/net/wlx74da38f4dfe0, iface: wlx74da38f4dfe0)
Feb 11 09:52:12 emergency NetworkManager[800]:   [1549875132.7781] device added (path: /sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/net/wlx74da38f4dfe0, iface: wlx74da38f4dfe0): no ifupdown configuration found.
Feb 11 09:52:12 emergency NetworkManager[800]:   [1549875132.7790] device (wlx74da38f4dfe0): state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
Feb 11 09:52:12 emergency kernel: [348573.433745] IPv6: ADDRCONF(NETDEV_UP): wlx74da38f4dfe0: link is not ready
Feb 11 09:52:12 emergency kernel: [348573.435559] rtl8192cu: MAC auto ON okay!
Feb 11 09:52:12 emergency kernel: [348573.448007] rtl8192cu: Tx queue select: 0x05
Feb 11 09:52:13 emergency NetworkManager[800]:   [1549875133.1725] (wlx74da38f4dfe0): using nl80211 for WiFi device control
Feb 11 09:52:13 emergency kernel: [348573.826813] IPv6: ADDRCONF(NETDEV_UP): wlx74da38f4dfe0: link is not ready
Feb 11 09:52:13 emergency NetworkManager[800]:   [1549875133.2179] device (wlx74da38f4dfe0): supplicant interface state: starting -> ready
Feb 11 09:52:13 emergency NetworkManager[800]:   [1549875133.2180] device (wlx74da38f4dfe0): state change: unavailable -> disconnected (reason 'supplicant-available') [20 30 42]
Feb 11 09:52:13 emergency kernel: [348573.872647] IPv6: ADDRCONF(NETDEV_UP): wlx74da38f4dfe0: link is not ready
Feb 11 09:52:14 emergency NetworkManager[800]:   [1549875134.1708] device (wlx74da38f4dfe0): supplicant interface state: ready -> inactive

Something important to read out from here: The Edimax EW-7811UN uses a Realteak chip, which uses the rtl8192cu driver. This driver seems to be defective, according to several posts:

  • https://adamscheller.com/systems-administration/rtl8192cu-fix-wifi/
  • https://forums.linuxmint.com/viewtopic.php?t=94495&f=53
  • https://edimax.freshdesk.com/support/solutions/articles/14000035492-how-to-resolve-ew-7811un-built-in-driver-issues-in-linux-kernel-v3-10-or-higher
  • http://www.cianmcgovern.com/getting-the-edimax-ew-7811un-working-on-linux/#comment-764845109
  • https://askubuntu.com/questions/509498/is-there-a-standard-wifi-driver-for-the-edimax-ew-7811un

Fortunately, a driver fix can be installed as a dynamic module for the Linux Kernel (dkm; dynamic Kernel module). The following steps explain how you do it.

Note: As of Kernel 4.4 and later, the Realteak chipset is _supposed_ to be handled by a newer driver called rtl8xxxu (see https://wireless.wiki.kernel.org/en/users/Drivers/rtl819x). But obviously this was not the case here with Kernel 4.8.

Install necessary build tools and the Kernel headers:

$ sudo apt-get install --reinstall linux-headers-$(uname -r) linux-headers-generic build-essential dkms git

Clone the following repository from Github to get the source code of the Kernel module:

$ git clone https://github.com/pvaret/rtl8192cu-fixes.git

Run dkms to add the module to the build tree:

 $ sudo dkms add ./rtl8192cu-fixes

Install the new module (this will take some time):

$ sudo dkms install 8192cu/1.11

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=4.8.17-040817-generic -C /lib/modules/4.8.17-040817-generic/build M=/var/lib/dkms/8192cu/1.11/build...........
cleaning build area....

DKMS: build completed.

8192cu.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.8.17-040817-generic/kernel/drivers/net/wireless//

depmod.....

Backing up initrd.img-4.8.17-040817-generic to /boot/initrd.img-4.8.17-040817-generic.old-dkms
Making new initrd.img-4.8.17-040817-generic
(If next boot fails, revert to initrd.img-4.8.17-040817-generic.old-dkms image)
update-initramfs..........

DKMS: install completed.

Note: As of this writing, the module's version is 1.11. This might of course change.

Copy the module blacklist config, to disable the Kernel's "internal" driver of rtl8192cu:

$ sudo cp ./rtl8192cu-fixes/blacklist-native-rtl8192.conf /etc/modprobe.d/

Probe/Load all modules:

$ sudo depmod -a

I now rebooted the machine to make sure this works properly after booting:

$ sudo reboot

After the machine was up again, I connected the Edimax USB adapter. Interestingly the name of the adapter changed in the wireless connection list (in the UI). With the original driver, this was shown as a Realtek adapter, now it just says "Wifi".

Nevertheless I connected to the destination wireless LAN.... No freeze! And the connection was established!

Edimax EW-7811UN Linux Mint 18.1 connection established 

I verified with some ping checks for a couple of minutes and saw a much more stable connection than with the previous Ralink adapter.

By the way the module is shown being in use by wireless:

$ lsmod | grep 8192
8192cu                569344  0
cfg80211              581632  5 iwlmvm,iwlwifi,rt2x00lib,mac80211,8192cu

Success - technically speaking! My plan was to avoid all these manual tasks after all.

 

Add a comment

Show form to leave a comment

Comments (newest first):

No comments yet.

Go to Homepage home
Linux Howtos how to's
Monitoring Plugins monitoring plugins
Links links

Valid HTML 4.01 Transitional
Valid CSS!
[Valid RSS]

6905 Days
until Death of Computers
Why?