Installing Wireless USB in Linux (RTL8xxxu Chipset)
Linux has always been an open OS with unlimited freedom — a playground for noobs, neckbeards and alike. For it's sheer power to run on any architecture with a unified kernel, robust file systems (Ext2/Ext3, Btrfs and XFS), system snapshots, to fastest file/folder lookup, it empowers enterprise servers, mobile phones, cloud architecture, deep space exploration among other things. Having worked on UNIX, Mac OSX, and M$ Windows earlier, my eccentric expeditions somehow gravitates back to Linux after subsequent failures with Red Hat 6. However, it wasn't always like this.
Around late 2000's — hardware vendor support in Linux was volatile. Glancing back at how steadfast Linux distros have outgrown, the OpenSuSE distro has been on top of my list for web/mobile development. While most hardware vendors are supporting Linux OS now, you can still run into that gray area.
My intellect's devour — with Linux power
Held up with OpenSuSE 13 Linux desktop (assembled in 2014) which was left with severe damages to motherboard between logistics. It was beyond repair with obsolete hardware — ASUS AM3 Socket Motherboard, 8GB DDR3 RAM with a busted nVidia GeForce Graphic Card fan and Cooler Master cabinet.
Come October 2019, determined to rebuilt with new hardware while preserving the 1TB + 500GB SATA hard drives which were hopefully functional, I hit the new assembly with:
- Cooler Master GLite 311 cabinet
- MSI Arsenal Gaming ATX Motherboard (B450 Tomahawk)
- Corsair 16 GB Vengeance LPX DDR4 RAM
- AMD Ryzen 5 2600 Desktop Processor (AM4 Socket)
- MSI GT 710 2GD3H LP DDR3 Gaming Graphic Card
- TP-Link TL-WN725N 150Mbps Wireless N Nano USB Adapter (exchanged)
- TP-Link TL-WN823N 300Mbps Mini Wireless-N USB Adapter
- Sennheiser PC 3 Chat On-Ear Headphone with Mic
All went well with a few glitches, after all renewing unpolished skills with hardware assembly after a long time. Here's the final assembly:
Satisfactory progress but then comes the moment of truth. Booted up this new system — lo and behold! The old OpenSuSE 13 picked up new hardware and landed on the KDM login screen. A sign of relief and happiness:
Fresh Installation of OpenSuSE 15.1
Proceeded with a fresh OpenSuSE 15.1 install from USB stick using full DVD image. Within post installation updates it was evident that there was consistent signal loss with TL-WN725N 150Mbps Wireless USB device. Doing a quick search for vendor supported drivers or updated drivers didn't help so replaced it with TL-WN823N 300Mbps Wireless USB device which appeared to be supported on Linux, only to reveal another glorious failure!
Overcoming poor driver support and signal strength, there were fewer choices like a wireless booster, nevertheless went with a TP-Link TL-WN822N N300 Wireless High Gain USB Adapter with antennas. This device has dual 3dBi external antennas that increase Wi-Fi coverage area, virtually doing the same job as wireless booster.
Installing RTL8xxxu Chipset KM Drivers
In most cases Linux distros have KM (Kernel Module) drivers that work with generic chipsets, like RTL8192u in this case. However the default KM driver for RTL8xxxu chipset was quite unstable and after several retries it couldn't connect to the wireless network successfully. Driver support from TP-LINK went off in flames, it didn't work either.
Looking for answers it brought me (citation) to another patched (reverse engineered) driver for the same RTL chipset. Hanging by a thread, I cloned the rtl8192eu linux drivers repository from GitHub and followed the installation steps. For a KM driver source installation, some dependency packages like kernel-devel, kernel-headers, kernel-sources, gcc, dkms are required based on your distro. After cloning fired up console and followed these steps:
$ sudo dkms add .;
# 2. Install the kernel module and rebuild the kernel
$ sudo dkms install rtl8192eu/1.0;
# 3. Blacklist the default rtl8xxxu driver
$ echo "blacklist rtl8xxxu" | sudo tee /etc/modprobe.d/rtl8xxxu.conf;
# 4. Activate the driver during boot
$ echo -e "8192eu\n\nloop" | sudo tee /etc/modules;
# 5. Fixes idling issues with devices (power management)
$ echo "options 8192eu rtw_power_mgnt=0 rtw_enusbss=0" | sudo tee /etc/modprobe.d/8192eu.conf;
# 6.0 Update grub and initramfs (kernel boot process). Works with Debain based distros
$ sudo update-grub; sudo update-initramfs -u;
# 6.1 OpenSuSE/CentOS/Fedora equivalent
$ grub2-mkconfig -o /boot/grub2/grub.cfg; sudo mkinitrd;
# 7. Reboot the system
$ systemctl reboot -i;
Step 6.0 may vary on your distro, refer 6.1 for other distros (be careful). After reboot try this on console $ sudo lshw -c network; to ensure the correct driver was loaded, usually ouputs driver=8192eu in console. Alternatively $ sudo hwinfo --network for non-Debian distros. That should dump your network device information like:
[Created at net.126]
Unique ID: AYEt.QXn1l67RSa1
Parent ID: KRJj.c09MnnfPkn0
SysFS ID: /class/net/wlan0
SysFS Device Link: /devices/pci0000:00/0000:00:07.1/0000:27:00.3/usb3/3-1/3-1:1.0
Hardware Class: network interface
Model: "WLAN network interface"
Driver Modules: "8192eu"
Device File: wlan0
HW Address: d0:37:45:52:ba:e8
Permanent HW Address: d0:37:45:52:ba:e8
Link detected: yes
Config Status: cfg=no, avail=yes, need=no, active=unknown
Attached to: #40 (Unclassified device)
Additionally $ sudo iwconfig wlan0; to verify the device is connected to WiFi successfully. It did the job for me with flying colors! The new TP-Link TL-WN822N N300 Wireless with antennas worked flawlessly without any signal loss, interruptions, and connects to WiFi router easily.
Why not Windows?
That's the obvious anticipation yet the easiest way out! If your active development is on M$ Windows it's bound to keep you busy, mostly with virus, malware, and spyware threats — condescending some nostalgic memories of Monkey Virus (aka Stoned.Monkey), and W32 Nimda. They not only took over master boot record along with partition tables but also replicated from floppies, zip drives, even morphed (polymorphic virus), particularly the Stoned.Monkey virus. Then there are never ending perils of disk defragmentation, cleaning temporary files, and optimizing registry.
Let's rewind back to late 90's, M$ was high, sales pitch was set for Win95/98 and Windows XP. Uncle Bill's chill pill was sold at every candy store. Worst bit was reading this misquote in my academic years (Aptech Computer Education):
Bill ***** showing maturity above his age...
A second wave of overbloated atrocity in the line was "Windows NT" — goofed up to outwit Novell Netware. The Win32 kernel was inconceivably pathetic, open to attacks, as was the NTFS file system. A cancer cell that broke to advanced melanoma as most of this witchcraft was embezzled from Xerox, Bell Labs, Novell Netware, Netscape (formerly Mosaic) and Steve Jobs. Then came 64-bit architecture with more red tape in Windows Vista, moreover Kernel level/mode debugging was going for a rocky ride.
Few Honorable Mentions
Here is the living disproof of the old adage that nothing is as dead as yesterday’s newspaper. A flashback of x86 reverse engineering tools, not to mention some well known-unknown binary packers like UPX, Softlocx, Armadillo, PELock, Petite and HASP (DRM); worth including with the bespoke list.