How to properly remove kernel modules for RTL88x2BU in Ubuntu MATE 19.04

I have installed Realtek RTL88x2BU drivers from Cilynx's GitHub repo using DKMS installation in Ubuntu MATE 19.04 with kernel 5.3.4 (and later 5.3.7)

Drivers worked fine for a week, then suddenly stopped detecting TP-Link Archer T3U AC1300 Wireless USB Adapter altogether. The same adapter works fine with other PC.

This is how drivers were installed:

cd rtl88x2bu
VER=$(sed -n 's/\PACKAGE_VERSION="\(.*\)"/\1/p' dkms.conf)
sudo rsync -rvhP ./ /usr/src/rtl88x2bu-${VER}
sudo dkms add -m rtl88x2bu -v ${VER}
sudo dkms build -m rtl88x2bu -v ${VER}
sudo dkms install -m rtl88x2bu -v ${VER}
sudo modprobe 88x2bu

So how could I completely remove kernel modules of all the previous versions (1.1, 5.6.1, etc) for RTL88x2BU? Many thanks.


You can do the reverse steps:

  1. Unload module

    sudo modprobe -r 8822bu
    sudo modprobe -r rtl88x2bu
    
  2. Check for all module builds status

    sudo dkms status
    

    output

    8822bu, 1.1: added
    rtl88x2bu, 5.6.1, 5.2.21-050221-generic, x86_64: installed
    rtl88x2bu, 5.6.1, 5.3.7-050307-generic, x86_64: installed
    
  3. Unregister it from DKMS, sudo dkms uninstall .. is optional as we are looking for complete purge.

    sudo dkms remove -m 8822bu/1.1
    sudo dkms remove -m rtl88x2bu/5.6.1 -k 5.2.21-050221-generic
    sudo dkms remove -m rtl88x2bu/5.6.1 -k 5.3.7-050307-generic
    
  4. Remove source from DKMS

    cd /usr/src/
    

    WARNING: Be careful rm -r is a dangerous command!

    sudo rm -r rtl88x2bu-*