RTL8188 adapter upgrade hell

On my desktop I've been running Linux Mint for the last few years, and have always done the distro upgrade-in-place. This time I tried it and there were too many errors — the upgrade tool wanted to remove around 50 apps, disable all my repos, and generally mess around with my system in too many ways, so I opted to go the "wipe and install fresh" route. My reasoning was also that after 6 years of upgrades, there were probably a few extra files on there, that I didn't need ( a mysterious 3 Gb in the flatpak directory for eg), and I'd messed around with the system config a few times over the time — pipewire, different DNS resolvers etc — so a fresh install would be a good thing. And it was, but for one nightmare: my RTL8188 adapter.

The adapter I'd bought and installed during the intervening period. My ISP router now had dual channel 2.4 and 5Ghz, so I upgraded the 2.4Ghz TPLink adapter to a dual channel one, bought online. It was a little fiddly to set up, involving downloading drivers from a github repository. I can't remember the decision process that took me to that repo, but it worked, and that was all I required. It was reported by lsusb as

Bus 003 Device 005: ID 0bda:c811 Realtek Semiconductor Corp. 802.11ac NIC

So I copied the Linux Mint image to the USB stick, installed the root partition, rebooted, mounted my home directory, pruning some files out of there too, installed the wifi drivers, and started installing additional software I'd need. After a couple of hours I was looking OK, and it was the end of the day, so I shutdown and left the computer.

The next day, I switched on the computer to a blank screen. Nothing. The BIOS screen came up, then nothing, not even grub, not even holding down ESC / Shift. I tried to boot off a USB stick. Nothing. Not even the install disk I had used the previous day. Something badly wrong. I managed to get a boot rescue disk to boot, and used it to reinstall grub. Then … nothing. No booting. Black screen.

OK, so time to reinstall again then I thought. I burned a new install USB and inserted it. Again nothing, so tried the install in compatibility mode. Got a lot of USB bus reset messages, which meant the USB connection was downgraded to USB 2.0 or 1.1, so I left it. When I came back after lunch it had booted, so I re-did the root install process, mounted my home partition, this time taking extra care to make sure grub was going in the right place, and that anything disk-related was double- and triple-checked. And then rebooted. And then black screen again.

This time I just sat and watched. After 3 minutes I saw a Linux Mint logo appear. Something happened!. After another 7 minutes the login screen appeared. After that I could login as normal, the speed seemed OK, and there was nothing strange in the syslog or boot logs. A normal, previous boot time would be less than ten seconds, for comparison.

I spent a long time trying to figure out what was going on. This time the wifi drivers hadn't worked, so I'd plugged the computer in with a long lead. At some point I took out the wifi adapter, and the next time I rebooted, it was back to normal. So, long story short, it was the wifi adapter all along. In lsusb it had appeared in CD Mode:  "ID 0bda:1a2b Realtek Semiconductor Corp. RTL8188GU 802.11n WLAN Adapter (Driver CDROM Mode)". This was, I guess, forcing the OS to consider it as a disk, which somehow delayed the boot by around ten minutes. With the wifi adapter out of the equation, the system boots fine.

I have gone back to the original TP-link adapter, which is plug and play, although a little slower. I've also been noticing a lot of USB bus instability: if I plug in a new device, it sometimes freezes all other USB devices and I have to reboot. Maybe this is all related. I'm not sure of the root cause at this point, but at this point, I'm connecting all my peripherals before I boot and not touching them. I figure the new kernel version might have something to do with it. Maybe I'll update this post if I come up with anything of interest.

UPDATE December 2022.

Finally got the magic incantation. I'd looked around the internet and found all these references to editing /lib/udev/rules.d/40-usb_modeswitch.rules, and adding the line:

# Realtek 8211CU Wifi AC USB
ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="/usr/sbin/usb_modeswitch -K -v 0bda -p 1a2b"

That worked for plug and play while the computer was already running, but failed to do anything on boot. This was what I'd done on the previous computer, but it seemed that Ubuntu 22 wasn't co-operating. Finally I hit upon another post which required me to create a file in /etc/usb_modeswitch.d/ called 0bda:1a2b

# Troublesome Dlink Realtek 8211CU
TargetVendor=0x0bda
TargetProductList="1a2b"
StandardEject=1

And finally, that worked on boot as well. Glad I got it sorted, but not very happy to have spent two or three hours trying to figure it out.

Leave a Comment