Making TP-Link TL-WN725N USB Wifi adapter work with Fedora 26
So you decided to get the TP-Link TL-WN725N USB wifi adapter! And when you just plugged it in your USB port on your Fedora 26 machine, you realized that there was no internet connectivity. This came as a surprise to me since Fedora always comes with the latest Linux kernel (4.12.x) and that the drivers should have been included.
TP-Link TL-WN725N uses the RTL8188EU driver. You can find this out by firing out a terminal and giving lsusb.
[root@localhost /]# lsusb Bus 002 Device 002: ID 8087:8000 Intel Corp. Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 8087:8008 Intel Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 005: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter Bus 003 Device 003: ID 045e:0782 Microsoft Corp. Bus 003 Device 002: ID 413c:2106 Dell Computer Corp. Dell QuietKey Keyboard Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The official driver listed on TP-LINK's site for TL-WN725N supports only Linux kernel versions between 2.6.18 and 3.19.3 while Fedora 26 uses 4.12.x. However, the driver is part of the staging folder of the Linux kernel and Fedora has a policy of not building and shipping them since it could be either be buggy, cause kernel panics, put undue burden on the kernel team, etc.
Don't fret! Not all is lost. You can still compile it by yourself. First, download the source of the driver on a computer that has internet connection from here. Next, download some of the necessary rpms that the driver requires like
elfutils-libelf-devel-0.169-1.fc26.x86_64.rpm kernel-devel-4.11.8-300.fc26.x86_64.rpm kernel-headers-4.11.8-300.fc26.x86_64.rpm
Go to your target computer and install the above rpms by double clicking it or by giving
[root@localhost /]# dnf install *.rpm
Warning: Using dnf might try to connect to the online repos and error out even though you have all these rpms locally. So, installing by double clicking could be the easiest.
Once you have installed the above rpms, extract the source code of the driver that you downloaded from GitHub and do the following preferably as root
[root@localhost /]# cd rtl8188eu-master [root@localhost rtl8188eu-master]# make all
If the above command finishes without any error, then install the driver by giving
[root@localhost rtl8188eu-master]# make install
This should copy the driver rtl8188eufw.bin to the folder /lib/firmware/rtlwifi . You would see something like the following on your shell
mkdir -p /lib/firmware/rtlwifi cp rtl8188eufw.bin /lib/firmware/rtlwifi/
Finally, insert your USB dongle now in the USB port. If you had been doing this while your dongle was in the port, then just remove the dongle from the port and reconnect it.
You will now see the LED blinking :).
You are now connected to the internet.
Since you have compiled the driver yourself and this is not part of the kernel yet, everytime you update the kernel, you will have to recompile the driver by repeating the above steps. If you would like to avoid this and want the driver to be part of the kernel, you can build a custom kernel. You can check about this approach here.
A lot of times, you will see connection drops or you will see that NetworkManager will show the Wifi signal as being connected, but when you hit the browser you will see that you are actually not connected to the internet. Firing up a terminal and hitting dmesg, you will see something like this
[22177.944547] R8188EU: INFO indicate disassoc [22178.459739] R8188EU: INFO indicate disassoc [22179.309493] R8188EU: INFO indicate disassoc [22181.212994] IPv6: ADDRCONF(NETDEV_UP): wlp0s20u5: link is not ready [22181.605695] IPv6:ADDRCONF(NETDEV_UP): wlp0s20u5: link is not ready [22182.933052] R8188EU:INFO indicate disassoc [22184.375390] R8188EU: INFO assoc success [22184.375458] IPv6: ADDRCONF(NETDEV_CHANGE): wlp0s20u5: link becomes ready [22633.346511] R8188EU: INFO indicate disassoc [22635.043480] R8188EU: INFO assoc success
The line R8188EU: INFO indicate disassoc is because that NetworkManager uses the modern nl80211 driver while the Realtek chipset uses the deprecated wext driver. A hack solution would be to turn off Wi-Fi in NetworkManager and turn it back on. This seems to solve the connectivity problem. The only issue is you might have to do this quite frequently.
If you're looking for a foolproof solution, then you can disable NetworkManager and install wicd.
If you want to hack even further, i.e not use any network managers at all, then you can use wpa_supplicant. For more details on this, check this blog here.
Further reading and reference
http://www.thelinuxrain.com/articles/getting-realtek-8188eu-wireless-adapters-to-work-in-linux-and-possibly-other-wireless-realtek-chipsets
https://linuxmender.wordpress.com/2017/07/05/fedora-26-rtl8188eu-the-hard-way/
http://www.tp-link.com/us/download/TL-WN725N.html#Driver
https://fedoraproject.org/wiki/KernelStagingPolicy
https://github.com/lwfinger/rtl8188eu/