Ubuntu: Installing/fixing TP-Link AC1200 (T4UH 1.0) drivers in Ubuntu 20.04 LTS

I wrote an entry about this adapter and Ubuntu 18.04.

This week my 20.04 LTS installation started to freeze randomly. I suspected several things, but through a process of elimination it ended up pointing to the Wi-Fi adapter.

I can’t rule out a hardware issue yet, but the new driver has been very stable and no freezes have happened so far. This started happening after the last Ubuntu upgrade I ran, and to be fair, the Wi-Fi adapter’s DKMS driver I was using was quite dated.

First check the hardware

Unplug and re-plug the adapter, remember that it will only work on USB 3.0 ports, and it won’t be recognised by USB 3.1 ports. Check the output of:

$ dmesg

The following commands will also help in showing if the adapter is correctly detected.

$ lsusb
Bus 004 Device 002: ID 4791:205a G-Technology ArmorATD
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 2357:0103 TP-Link Archer T4UH wireless Realtek 8812AU
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The Bus 003 Device 002: ID 2357:0103 entry above is the one with the USB Wi-Fi adapter on my system. You can remove the adapter and issue the command again and compare results to help you identify yours.

For non-USB adapters you can use:

$ lspci

More detailed information about the device can be obtained with the lshw command.

$ lshw -C network
WARNING: you should run this program as super-user.
  *-network                 
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       [output truncated]
    *-network:2
       description: Wireless interface
       physical id: 4
       bus info: usb@3:1
       logical name: enx18d6c70fbacc
       serial: 18:d6:c7:a1:22:ab
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=rtl8812au ip=192.168.x.2 multicast=yes wireless=IEEE 802.11AC
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.

This last command is really useful because it will give really important information about what driver to use.

In this case the chipset and driver to use is identified in this string driver=rtl8812au. We already knew this in any case. If yours is a different driver/adapter this solution is unlikely to work for you.

Checking the drivers

Now check that the driver is loaded, you need to look for a string that is similar to the driver string above.

$ lsmod | grep 8812
8812au                999424  0

If the module isn’t loaded you can manually load it:

# modprobe 8812au

Installing updated drivers

If all of the above seems to work but the Wi-Fi adapter isn’t detected you can install the drivers manually.

The version of the drivers is newer than the ones provided via apt.

Uninstall the system provided drivers

From the GUI:

  • Go to Software & Updates
  • Select Additional Drivers
  • Find the entry for the Wi-Fi adapter (rtl8812-au) and select Do not use the device

Or from the CLI:

[find the installed driver]

# apt list rtl8812au*

[and uninstall it]

# apt purge rtl8812au-dkms

Install alternative driver

Get the updated drivers from github:

$ git clone https://github.com/gordboy/rtl8812au-5.9.3.2

Move the source code to /usr/src so that DKMS can automatically build the driver when the kernel is updated.

# mv rtl8812au-5.9.3.2/ /usr/src/

Build and install the drivers:

# dkms add -m rtl8812au -v 5.9.3.2
# dkms build -m rtl8812au -v 5.9.3.2
# dkms install -m rtl8812au -v 5.9.3.2

Check that the driver is installed correctly:

# dkms status

Additionally:

[Make sure that in /etc/NetworkManager/NetworkManager.conf]

# vim /etc/NetworkManager/NetworkManager.conf

[The following entry is inserted]

[device]
wifi.scan-rand-mac-address=no

If the driver is recognised you can configure the wireless network as normal. Restart to make sure everything works and remains persistent.

Uninstall

If you ever need to uninstall the driver you can do it with:

# dkms remove -m rtl8812au -v 5.9.3.2 --all

If you edited /etc/modules you will need to revert the changes. In the previous tutorial for Ubuntu 18.04 the module had to be added manually. It isn’t the case for this version.




Ubuntu: Installing/fixing TP-Link AC1200 (T4UH 1.0) drivers in Ubuntu

[Updated instructions for Ubuntu 20.04 here]

I have had this USB wireless adapter working fine on Ubuntu 18.04 LTS for a while. A system update stopped it from working.

Re-installing the OS provided drivers (Software & Updates / Additional Drivers) made no difference. I tested the adapter in other operating systems and it worked fine.

It seems that from kernel version 4.15 onwards the drivers provided with Ubuntu no longer work, but the GUI shows as if the driver is correctly installed, it can see wireless networks and it even tries to connect to them. It will invariably fail to connect to any of them.

Others have encountered and solved this issue before me:

https://www.learningpenguin.net/2018/01/30/install-realtek-rtl8812au-wifi-driver-linux/

https://github.com/gnab/rtl8812au

Find below the steps to troubleshoot similar issues and a summary of the steps to install the correct driver as per the above links.

Check the hardware

Unplug and re-plug the adapter and check the output of:

dmesg

The following commands will also help in showing if the adapter is correctly detected.

$ lsusb
Bus 004 Device 002: ID 1058:25e1 Western Digital Technologies, Inc. 
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 2357:0103  
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The Bus 003 Device 002: ID 2357:0103 entry is the one that is the USB wifi adapter on my system even if it isn’t showing an identifier. You can remove the adapter and issue the command again and compare results to help you identify it.

For non-USB adapters you can use:

$ lspci

More detailed information about the device can be obtained with the lshw command.

$ lshw -C network
WARNING: you should run this program as super-user.
  *-network                 
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       [output truncated]
    *-network:2
       description: Wireless interface
       physical id: 4
       bus info: usb@3:1
       logical name: enx18d6c70fbacc
       serial: 18:d6:c7:a1:22:ab
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=rtl8812au ip=192.168.x.2 multicast=yes wireless=IEEE 802.11AC
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.

This last command is really useful because it will give really important information about what driver to use.

In this case the chipset and driver to use is identified in this string driver=rtl8812au.

Check the drivers

Now check that the driver is loaded, you need to look for a string that is similar to the driver string above.

$ lsmod | grep 8812
8812au                999424  0

If the module isn’t loaded you can use modprobe modulename to load it.

# modprobe 8812au

Installing updated drivers

But in my case all of the above was correct but the card would still not work. This was caused by an incompatibility of the the drivers provided with Ubuntu and the updated kernel.

I should have checked the system logs earlier as I believe there was an entry there indicating a problem.

Uninstall the system provided drivers from the GUI .

  • Go to Software & Updates
  • Select Additional Drivers
  • Find the entry for the wifi adapter (rtl8812-au) and select Do not use the device

You can do the same from the CLI:

[find the one you have installed]

# apt list rtl8812au*

[and uninstall]

# apt purge rtl8812au-dkms

Get the updated drivers from github:

$ git clone https://github.com/gnab/rtl8812au.git

Install the drivers with one of these two commands. They will work as long as you are pointing to the directory generated by the previous git command.

At the time of writing the latest release of the drivers are 4.2.3. Your output might vary.

[this command]

# dkms add ./rtl8812au/

[or this command]

# dkms add -m 8812au -v 4.2.3

Build and install the drivers:

# dkms build -m 8812au -v 4.2.3
# dkms install -m 8812au -v 4.2.3

Check that they were installed correctly:

# dkms status

And finally add the module to autoload during boot.

# echo 8812au | tee /etc/modules

You should now be able to join your wireless network without problems. As the driver is installed via dkms if there is a kernel update it will automatically update and recompile the driver for the new release.

If you ever need to uninstall the driver you can do it with:

# dkms remove -m 8812au -v 4.2.3 --all

You will also need to edit out the entry in /etc/modules.

One additional thing that caught me off was that if the adapter is connected to a USB 3.1 port it won’t work. USB 3.0 ports are fine.




Ubuntu: Fixing network interfaces not showing in GUI on Ubuntu Server

Ubuntu Server and Ubuntu Desktop use different network managers. Ubuntu Server uses networkd which doesn’t have a GUI component. So after adding a desktop to Ubuntu Server you won’t be able to see or change the configuration via the GUI by default.

Ubuntu Desktop Ubuntu Server
Configuration tool netplan netplan
CLI manager nmcli networkd
GUI manager NetworkManager n/a

For you to be able to see the network settings on the GUI you need to switch from networkd to NetworkManager.

Install NetworkManager:

apt install network-manager network-manager-gnome network-manager-openvpn network-manager-openconnect network-manager-openvpn-gnome

Check which systemd network daemons are active:

systemctl list-unit-files | grep -i network

Disable/stop networkd services:

systemctl disable systemd-networkd.service
systemctl disable networkd-dispatcher.service
systemctl stop systemd-networkd
systemctl stop systemd-networkd.socket
systemctl stop systemd-networkd.service
systemctl stop network-dispatcher.service

Remember that nmcli can be used for CLI NetworkManager control also.

Network interfaces are listed in yaml files in /etc/netplan/

Edit /etc/netplan/50-cloud-init.yaml and edit the line or add a line after the version: 2 entry to be renderer: Networkmanager.

network:
  ethernets:
    eno1:
      dhcp4: true
  version: 2
  renderer: NetworkManager

Check the changes and apply them:

netplan generate
netplan try / netplan apply