Installing Realtek Wireless Driver for Ubuntu on a Desktop PC
Recently I did a fresh install of Ubuntu (actually Kubuntu) 20.04 on my desktop PC. Unfortunately, my PC motherboard (Gigabyte Z370) does not have any built in wireless or bluetooth chipset, and somehow I need to get internet working. Also I live in a place where there is no ethernet ports, which makes the process more difficult. So, I use one of the cheap USB WiFi adapter I bought from Amazon. It uses Realtec RTL8811CU chipset.
I will talk about the troubles I went through in the next section. Then in the solution section, I go over the exact steps I took to get internet working.
Of the many articles on stack exchange and Ubuntu forums, the “proper” way to install these essential drivers is to already have an internet connection and use
apt install to install more packages. 🙄 this is counter-productive for me at the moment as I need to somehow get an internet connection in the first place.
Attempt 1: Download driver from Realtek and use USB flash drive
The first thing I tried was to download the RTL8811CU chipset from Realtek’s website from my MacBook, copy it to an USB flash drive, eject it, plug it into my Linux desktop, and try to install it from there. While the installation procedure for Windows and Mac is as simple as running some executable, the Linux version comes in source code, so I need to build it myself. Unfortunately, my newly installed Ubuntu doesn’t have gcc nor make — which the install script included in the download required.
Attempt 2: Use my iPhone’s Personal Hotspot
Nowadays all mobile devices comes with personal hotspot where it turns itself into a “router” while connected to internet via cellular network. As mentioned before, my Ubuntu PC doens’t have WiFi nor Bluetooth, so the only option left is to connect my iPhone to the PC using USB. However while this allows Ubuntu to detect the device as a wired connection, there is no internet access. After some digging around, it turns out I need to install another package called
ipheth-utils1 — no good.
Attempt 3: Using Window Laptop’s Network Sharing
In Windows Settings app, there is an option to turn on “Network Sharing” but it straight up did not work. Once I connected the ethernet, Windows automatically thinks the other end of the ethernet is the router/modem -_-. There wasn’t any feedback/error message in the Settings app, so there was not much to do.
To get it fully working, the procedures can be split into two parts:
- Getting internet on Ubuntu in the first place so we can download packages.
- Get the driver setup.
1. Create a Bridged Connection Using Another Laptop
Since I don’t have access to the router directory to get internet, I went back to failed attempt #3 and modified my method. I followed this procedure from WindowsCentral 2. The steps are summarized as follows:
cmdand enter the command
- Note the IPv4 Address, Subnet Mask, Default Gateway, and DNS Servers.
- Open Control Panel (yes, the old one — because the new Settings app doesn’t have these settings).
- Go to Network Connections, and select both the Ethernet adapter and the Wireless adapter.
- Right click and select Bridge Connections. Upon click, it will automatically create a new “bridged” adapter and it will show up in the Network Connections window.
- Right click the newly created bridge adapter and go into Properties.
- Go into the Properties dialog of Internet Protocol Version 4 (TCP/IPv4) menu item.
- Select “Use the following IP addresses” radio button and enter the IPv4 Address, Subnet Mask, Default Gateway, and DNS Servers we have noted earlier.
- “OK” every dialog window. After, Windows may offer to “troubleshoot and fix” the internet, say yes.
- Reconnect to WiFi if needed.
At this point we should have successfully bridged the network and the Ubuntu finally has internet access! 🥳
2. Installing the Driver3
Get the basic stuff.
sudo ubuntu-drivers autoinstall sudo apt update sudo apt install build-essential dkms gcc git make
Find the USB device ID so we can find the right driver.
lsusb | grep -i Realtek
Bus 001 Device 010: ID 0bda:c811 Realtek Semiconductor Corp.
So the ID is
0bda:c811, a quick search reveals this is for RTL8811CU chip. Luckily, there is a working version for this chip for Linux 4.4.x up to 5.x: https://github.com/brektrou/rtl8821CU.git4. So I cloned it.
git clone https://github.com/brektrou/rtl8821CU.git
Run the install script.
cd rtl8821CU/ chmod +x dkms-install.sh sudo ./dkms-install.sh
Add module to Linux kernel.
sudo modprobe 8821cu
Finally, upon clicking on the little network symbol on the menu bar I was so happy to see a list of nearby WiFi networks. Yay! 🎉 Of course, after this is done, I disconnect ethernet from the Ubuntu machine, I removed the bridged ethernet adapter on Windows as well.