TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸

RTL8188GU - Realtek Bluetooth 5 + Wifi AC600 WiFi dongle linux drivers

March 24, 2024

I bought a cheap wifi+bluetooth dongle from AliExpress that works plug and play on Windows but has no linux drivers and wouldn't work on Ubuntu.

The issue was resolved by installing the drivers from the unofficial kablosuz PPA for realtek drivers

Get details about the USB dongle with lsusb. We can see that the Realtek WLAN Adapter is detected

code
lsusb
code
Bus 001 Device 002: ID 0bda:1a2b Realtek Semiconductor Corp. RTL8188GU 802.11n WLAN Adapter (Driver CDROM Mode)

Note the following: Vendor ID is: 0bda Product ID is: 1a2b Version of the chip is: RTL8188GU

Add the repo and install the relevant driver

code
sudo add-apt-repository ppa:kelebek333/
sudo aapt update
sudo apt install rtl8188gu-dkms

We'll use the unofficial PPA for Realtek WiFi drivers kablosuz. If you installed your system in UEFI mode, you must disable secureboot for modules installed by dkms after installation.

You can check installation mode with following command.

code
[ -d /sys/firmware/efi ] && echo "EFI" || echo "BIOS"

You can check status of secureboot with following command.

code
mokutil --sb-state

Troubleshooting

After installing the driver and rebooting, i had two issues:

  • the dongle was still connected in CDROM mode
  • after some time when the dongle automatically switched mode, it could not connect to any of my wifi network, error: Activation of network connection failed

Fixing USB device mode

Changing the mode was relatively easy, you can use usb_modeswitch for that. usb_modeswitch controls the mode of 'multi-state' USB devices.

code
sudo usb_modeswitch -KW -v 0bda -p 1a2b
  • -v is for Vendor ID
  • -p is for Product ID
  • -K is for eject
  • -W is for verbose

Use lsusb to check if the mode has changed. You may have to remove the dongle and insert it again for it to change mode.

For the WiFI, i could not figure out a solution and was not motivated enough to waste hours when there were easy alternatives available to me (ethernet cable, another wifi adapter)

code
# Driver CDROM Mode
Bus 001 Device 002: ID 0bda:1a2b Realtek Semiconductor Corp. RTL8188GU 802.11n WLAN Adapter (Driver CDROM Mode)
code
# WiFi AC
Bus 001 Device 004: ID 0bda:c820 Realtek Semiconductor Corp. 802.11ac NIC

To automate this, so that it is also run on startup, you can create a systemd service to run the command on startup

code
sudo nano /etc/systemd/system/modeswitch_bluetooth_dongle.service
code
[Unit]
Description=Script to make sure usb mode is switched automatically every time we restart
After=network.target
[Service]
ExecStart=/sr/bin/sh -c 'usb_modeswitch -KW -v 0bda -p 1a2b'
[Install]
WantedBy=default.target
code
sudo systemctl daemon-reload
sudo systemctl enable modeswitch_bluetooth_dongle.service
sudo systemctl start modeswitch_bluetooth_dongle.service

ALTERNATIVELY, you can edit usb_modeswitch.rules. Did not work for me when i inserted the dongle again.

code
sudo nano /lib/udev/rules.d/40-usb_modeswitch.rules

Add the follolwing at the end of the file, before the line LABEL="modeswitch_rules_end"

code
# /lib/udev/rules.d/40-usb_modeswitch.rules
# Realtek Wifi AC + Bluetooth USB adapter
ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="/usr/sbin/usb_modeswitch -K -v 0bda -p 1a2b"

sudo nano /etc/usb_modeswitch.d/0bda:1a2b

code
# /etc/usb_modeswitch.d/
# Realtek Wifi AC + Bluetooth USB adapter
# Prevent it from being loaded in CD ROM mode
TargetVendor=0x0bda
TargetProductList="1a2b"
StandardEject=1

At this point, I have limited functionality. The Bluetooth works but WiFi is not working.

Solution 2: Use a different driver, i'm considering the one from lwfinger

usb_modeswitch - control the mode of 'multi-state' USB devices

systemctl --all | grep usb_modeswitch

Solution 1: re-install linux headers (didn't work)

sudo apt install --reinstall linux-headers-$(uname -r) sudo reboot

Linux headers are declarations of a programming interface needed to interface with Linux kernel. In short, if you have a program that talks with the kernel, to build that program, you need those files.1