RTL8821CU USB-WIFI adapter not recognised [solved]

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
GS3
Level 8
Level 8
Posts: 2360
Joined: Fri Jan 06, 2017 7:51 am

RTL8821CU USB-WIFI adapter not recognised [solved]

Post by GS3 »

For the purpose of trying to un-crowd (if you know what I mean) the 2.4 GHz WIFI band at home I bought on eBay a no name brand USB-WIFI adapter described as
AC600 Mbps Dual Band 2.4/5Ghz Wireless USB WiFi Network Adapter w/Antenna 802.11ac,802.11a,802.11n,802.11g, 802.11b

I plugged it in but it is not recognised.

Code: Select all

 lsusb
Bus 001 Device 012: ID 0bda:c811 Realtek Semiconductor Corp. 
It came with a mini-CD with drivers but the Linux folder has a bunch of files that I have no idea how to use them.

I found this page https://askubuntu.com/questions/1089790 ... mtp-device where the solution is said to be:
sudo apt-get install dkms
cd Downloads/
git clone https://github.com/whitebatman2/rtl8821CU.git
export DRV_NAME=rtl8821CU
export DRV_VERSION=5.2.5.3
set |grep DRV
sudo mkdir /usr/src/${DRV_NAME}-${DRV_VERSION}
git archive master | sudo tar -x -C /usr/src/${DRV_NAME}-${DRV_VERSION}
cd rtl8821CU/
git archive master | sudo tar -x -C /usr/src/${DRV_NAME}-${DRV_VERSION}
sudo dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
sudo dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
sudo dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
which is Greek to me and is probably not applicable. At any rate, I gather the chipset it has is RTL8821CU.

The closest I can find in the CD is a file named rtl8821AU_WiFi_linux_v5.2.6_21981.20170407_COEX20170206-6760.tar.gz so the suffix is not the same.

This page seems relevant: https://github.com/MingxuZhang/rtl8821cu

I am afraid that this is getting too complicated if I have to compile etc. I was hoping for plug and play. Is there a not too complicated way to get this device working?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
ernie dingbat

Re: USB-WIFI adapter not recognised

Post by ernie dingbat »

GS3 wrote: Fri Jun 26, 2020 7:40 pm Is there a not too complicated way to get this device working?
Hi, GS3

0bda:c811 in your output is the correct identifier for the rtl8821CU. This device isn't supported out of the box because the vendor won't or hasn't released the required binary blobs for inclusion in the linux kernel. The instructions you linked to at https://askubuntu.com/questions/1089790 ... mtp-device are the correct instructions to follow, and they should work however I would make some minor but important changes.

Code: Select all

sudo apt-get install build-essential dkms git
DRV_NAME=rtl8821CU
DRV_VERSION=5.2.5.3
sudo mkdir /usr/src/${DRV_NAME}-${DRV_VERSION}
git archive master | sudo tar -x -C /usr/src/${DRV_NAME}-${DRV_VERSION}
sudo dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
sudo dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
sudo dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
On the bright side, the driver will be installed using dkms so it should be automatically rebuilt and added when the kernel is updated. You can copy/paste each line above so this should be a no-brainer even though it looks scary.

Ernie
sleeper12
Level 22
Level 22
Posts: 15463
Joined: Thu May 25, 2017 3:22 pm

Re: USB-WIFI adapter not recognised

Post by sleeper12 »

You might need to disable Secure Boot in UEFI/BIOS also. You can check that with:

Code: Select all

 mokutil --sb-state 
User avatar
GS3
Level 8
Level 8
Posts: 2360
Joined: Fri Jan 06, 2017 7:51 am

Re: USB-WIFI adapter not recognised

Post by GS3 »

ernie dingbat wrote: Fri Jun 26, 2020 9:08 pm

Code: Select all

sudo apt-get install build-essential dkms git
DRV_NAME=rtl8821CU
DRV_VERSION=5.2.5.3
sudo mkdir /usr/src/${DRV_NAME}-${DRV_VERSION}
git archive master | sudo tar -x -C /usr/src/${DRV_NAME}-${DRV_VERSION}
sudo dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
sudo dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
sudo dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
Thanks. I tried those lines but got an error and did not continue:

Code: Select all

~ git archive master | sudo tar -x -C /usr/src/${DRV_NAME}-${DRV_VERSION}
fatal: Not a git repository (or any of the parent directories): .git
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
The way I interpret the error is that it is expecting to find a file in /usr/src/rtl8821CU-5.2.5.3 but could not find it. Now what?

The seller says the rtl8821AU driver provided in the CD should work with the RTL8821CU but I do not even know what to do with the file rtl8821AU_WiFi_linux_v5.2.6_21981.20170407_COEX20170206-6760.tar.gz
If I decompress it I can see a bunch of folders and files. Now what?

This Realtek page https://www.realtek.com/en/component/zo ... u-software has driver for Windows only, not Linux, but uses the same driver for RTL8821AU and RTL8821CU. I cannot find any Linux driver on that Realtek site.

This page https://github.com/brektrou/rtl8821CU says it has a driver but I cannot understand a single word.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
ernie dingbat

Re: USB-WIFI adapter not recognised

Post by ernie dingbat »

GS3 wrote: Sat Jun 27, 2020 4:37 am Thanks. I tried those lines but got an error and did not continue:
Hi, GS3

I tried it an got a similar error. It's a git problem and the instructions on the github page have the same command so something must have changed and the documentation hasn't been updated. If you've closed your terminal, start again with:

Code: Select all

DRV_NAME=rtl8821CU
DRV_VERSION=5.2.5.3
Then skip these two lines.

Code: Select all

sudo mkdir /usr/src/${DRV_NAME}-${DRV_VERSION}
git archive master | sudo tar -x -C /usr/src/${DRV_NAME}-${DRV_VERSION}
If you haven't closed your terminal, continue from here.

Use git clone https://github.com/whitebatman2/rtl8821CU.git to clone the driver repo. Do this in your home directory so we don't get lost. You can delete the directory that the git clone command created after it's copied ready for dkms, or after it's built and installed...

sudo cp -R ~/rtl8821CU /usr/src/${DRV_NAME}-${DRV_VERSION}

Next, you can continue with:

Code: Select all

sudo dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
sudo dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
sudo dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
Ernie
User avatar
GS3
Level 8
Level 8
Posts: 2360
Joined: Fri Jan 06, 2017 7:51 am

Re: USB-WIFI adapter not recognised

Post by GS3 »

ernie dingbat wrote: Sat Jun 27, 2020 5:16 amUse git clone https://github.com/whitebatman2/rtl8821CU.git to clone the driver repo.
That executed without error. Then I got

Code: Select all

sudo dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
Error! Could not locate dkms.conf file.
File: /usr/src/rtl8821CU-5.2.5.3/dkms.conf does not exist.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
ernie dingbat

Re: USB-WIFI adapter not recognised

Post by ernie dingbat »

GS3 wrote: Sat Jun 27, 2020 5:37 am
ernie dingbat wrote: Sat Jun 27, 2020 5:16 amUse git clone https://github.com/whitebatman2/rtl8821CU.git to clone the driver repo.
That executed without error. Then I got

Code: Select all

sudo dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
Error! Could not locate dkms.conf file.
File: /usr/src/rtl8821CU-5.2.5.3/dkms.conf does not exist.
Oh, dear. What a mess. You're going to have to install it manually.

Code: Select all

cd /usr/src/rtl8821CU-5.2.5.3/
make
sudo make install
sudo modprobe 8821cu
Unfortunately you'll have to do that for every time the kernel is updated. You can try to make your own dkms.conf for that driver. Someone posted a tutorial in the tutorials section so you may want to do an advanced search of that forum for driver dkms.

It might be worthwhile doing sudo update-initramfs -u when it's finished and installed.
User avatar
GS3
Level 8
Level 8
Posts: 2360
Joined: Fri Jan 06, 2017 7:51 am

Re: USB-WIFI adapter not recognised

Post by GS3 »

ernie dingbat wrote: Sat Jun 27, 2020 5:45 am Oh, dear. What a mess. You're going to have to install it manually.
Let's back up a bit. Maybe what I am about to say makes no sense because I have no understanding about any of this but I figure there is probably a simpler way of installing a driver than all this. The seller says the driver on the CD, rtl8821AU_WiFi_linux_v5.2.6_21981.20170407_COEX20170206-6760.tar.gz, should work and I have also downloaded rtl8821CU-master.zip from https://github.com/whitebatman2/rtl8821CU so I have two drivers to choose from. I do not understand why installing a driver can be so complicated. I would expect it to be something like running an installation program or right click on file and choose "install". You know, like in Windows. In fact, this device works with Windows with no problem whatsoever.

I still have the option of returning the device to the seller and if it is really this complicated then I might choose to do that but I feel a bit bad because it seems to me the cause of the problem is not so much with him as with Linux.

I feel frustrated. If after all this all I can do is a half baked solution where I have to keep reinstalling the driver after every kernel update then I think I should probably return the item to the seller. (And I guess I can look forward to more frustration arguing about who pays for the return shipping, ::sigh::)
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
sleeper12
Level 22
Level 22
Posts: 15463
Joined: Thu May 25, 2017 3:22 pm

Re: USB-WIFI adapter not recognised

Post by sleeper12 »

Try:

Code: Select all

sudo apt update
sudo apt install build-essential git dkms
git clone https://github.com/brektrou/rtl8821CU.git
cd rtl8821CU
chmod +x dkms-install.sh
sudo ./dkms-install.sh
sudo modprobe 8821cu 
Reboot
User avatar
GS3
Level 8
Level 8
Posts: 2360
Joined: Fri Jan 06, 2017 7:51 am

Re: USB-WIFI adapter not recognised

Post by GS3 »

sleeper12 wrote: Sat Jun 27, 2020 11:10 amTry:

Code: Select all

sudo apt update
sudo apt install build-essential git dkms
git clone https://github.com/brektrou/rtl8821CU.git
cd rtl8821CU
chmod +x dkms-install.sh
sudo ./dkms-install.sh
sudo modprobe 8821cu 
Reboot
Thanks! Although I had a few glitches along the way and had to correct some things, I finally did manage to complete those commands and I think the USB-WIFI adapter is working. I still need to check for several things.

Some questions and please pardon my ignorance.

The device is supposed to be 802.11ac (5 GHz) capable but I just see a list of access points, including our home router which does have 5 GHz, but how can I know it is connecting in that band? Is it possible to restrict the device to only the 5 GHz band? I thought the 5 GHz access point appeared as a different WIFI name but I don't see it. I seem to remember seeing for instance "MyWifi-1234", "MyWifi-1234-guest" and "MyWifi-1234_5G" all from the same router AP. I am a bit confused as I have never used 802.11ac before. Could it be that the device is only working in 802.11g/n modes?

Is the folder /home/xxx/rtl8821CU needed or can I delete it? Is it temporary for the installation or is it necessary for the use of the device?

Is this driver installation permanent or will I have to do it again with every kernel update? I am guessing the dkms part means it will not require my intervention?

This page https://www.realtek.com/en/products/com ... /rtl8821cu says the chipset also does Bluetooth 4.2. Any way to test for this? Would it require a separate driver?

Thanks again.

ETA: Looking at the router AP configuration it seems both 2.4 and 5 Ghz have the same name so I am going to assume if the client is capable of both the autonegotiate whatever works best. Yes?
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
sleeper12
Level 22
Level 22
Posts: 15463
Joined: Thu May 25, 2017 3:22 pm

Re: USB-WIFI adapter not recognised

Post by sleeper12 »

I don't know enough to answer your questions. Maybe someone else can. I just copied that solution from here:
https://askubuntu.com/questions/1162974 ... uctor-corp

Like you, I'm guessing the driver install is permanent.
User avatar
GS3
Level 8
Level 8
Posts: 2360
Joined: Fri Jan 06, 2017 7:51 am

Re: USB-WIFI adapter not recognised

Post by GS3 »

sleeper12 wrote: Sat Jun 27, 2020 11:10 amTry:

Code: Select all

sudo apt update
sudo apt install build-essential git dkms
git clone https://github.com/brektrou/rtl8821CU.git
cd rtl8821CU
chmod +x dkms-install.sh
sudo ./dkms-install.sh
sudo modprobe 8821cu 
Reboot
This is an old thread. I just want to confirm that this solution for RTL8821CU has worked for me on three different occasions on three different computers running LM19 and LM20. Always straightforward and with no problem. Thanks.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
sleeper12
Level 22
Level 22
Posts: 15463
Joined: Thu May 25, 2017 3:22 pm

Re: USB-WIFI adapter not recognised

Post by sleeper12 »

Good to hear, thanks for the follow-up.
Locked

Return to “Beginner Questions”