How to enable external wifi-usb-card-antenna on Kodi/OSMC?

I have a problem with weak wifi signal on my Pi3. Here is the topic:

So I bought an external wifi-usb-card-antenna SELTY BW5-000, which is confirmed by many users that it works with Linux.

However, the problem for me is, how do I make it work, or in other words, how do I make my Pi3 to use it instead of the built-in wifi-card?

Will the device switch to it automatically after it is plugged (plug and play)?
Should I do reboot?
Should I install some packages?
Should I edit some config?

The Kodi interface is very primitive and has very simple network settings and no way to choose the wifi-card. I can access my device over ssh, open terminal, and then what? Use network manager cli commands like nmcli or something else?

I would appreciate some helpe. Thank you

EDIT: I probably found that the system is seeing this device:


$ dmesg | grep "usb"
[...]
[2700358.256227] usb 1-1.3: new high-speed USB device number 12 using dwc_otg
[2700358.387140] usb 1-1.3: New USB device found, idVendor=0bda, idProduct=c811, bcdDevice= 2.00
[2700358.387173] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[2700358.387190] usb 1-1.3: Product: 802.11ac NIC
[2700358.387206] usb 1-1.3: Manufacturer: Realtek
[2700358.387222] usb 1-1.3: SerialNumber: 123456

I found this article about manually editing/adding network interfaces:

However, it depends on the file /etc/network/interfaces, which doesn’t exist on OSMC.

I have no idea how network is configured in OSMC and don’t know all possible solutions how it is done, so I have no clue where to look for current files. I have also too little knowledge to try to switch to alternate solutions.
I need some help with setting a network using a proper device.

1 Like

Thanks. If I understand, when I properly install and configure it, the wifi-usb-card will work. However, what about switching or using it?

Probably, it will be wise to make some backup, in case something goes wrong. I believe I saw here some Q&A about system backup.

Hi,

You need to add dtoverlay=disable-wifi to /boot/config.txt

This will disable the on board, so you can use the USB dongle.

Regards Tom.

1 Like

Thanks!
I assume I need to add it to [all] section of that file, because others relate to different type of hardware?
Also, do I need to reconfigure grub somehow, like with update-grub command afterwards?

Probably the whole operation will take me some time, because I have some choirs to do after work, so probably I’ll sit to it at weekend, and then let you know if it worked.

I don’t think the all is required, I may be wrong; adding it won’t cause an issues either.

Regards Tom.

No, I meant that in the /boot/config.txt file there are sections like [Pi4], or [board-type=0x0e], [pi02] and of course [all]. I asked, to which section should I add dtoverlay=disable-wifi line. I have no idea what this board-type=0x0e is, but [all] is the safest bet.

You should not edit that file directly

Sam

In theory, all root files should be left alone. However, if we need something and there is no other way, those files are there just for it.
If you have any proposition how to do it in different way, I am all ears.

Edit the user version of that file. There is a suggestion to do so in the first line of the file.

1 Like

As said earlier, at weekend (meaning now), I found some time to dig in.

I did a backup via timeshift (the backup via MyOSM doesn’t seem to work, complain about lack of set directory, although directory is already set in backup configuration).

Went to the Realtek RTL8811CU/RTL8821CU github page given above and followed the instruction:

Install dependencies: make, gcc, linux-header/kernel-devel, bc and git

If I understand it correctly, inux-header/kernel-devel means I can install one or the other?

The problem here is, there is no linux-headers-5.10.78-5-osmc

I’m stuck at this point.

I also installed some additional packages needed to follow the instruction like dkm, usbutils and usb-modeswitch.

I’m not sure what to do now without linux-headers. There seems to be only headers for 4.19 and no headers specific to osmc. Without headers, dkms install script won’t work.

Is there any repo that I can add to get this package?

Hi,

Headers:

I don’t believe DKMS is supported on OSMC, I suggest building without; this does mean it will need to be rebuilt after every kernel update.

Regards Tom.

Ok, then to install it without DKMs, I should do this:

cd ~/build/rtl8821CU
make
sudo make install

The problem is, that I get:

make ARCH=arm CROSS_COMPILE= -C /lib/modules/5.10.78-5-osmc/build M=/home/osmc/build/rtl8821CU  modules
make[1]: *** /lib/modules/5.10.78-5-osmc/build: No such file or directory.  Stop.
make: *** [Makefile:2217: modules] Error 2

So I added build/ directory to that location, but that didn’t help, because something in it was expected:

make ARCH=arm CROSS_COMPILE= -C /lib/modules/5.10.78-5-osmc/build M=/home/osmc/build/rtl8821CU  modules
make[1]: Entering directory '/usr/lib/modules/5.10.78-5-osmc/build'
make[1]: *** No rule to make target 'modules'.  Stop.
make[1]: Leaving directory '/usr/lib/modules/5.10.78-5-osmc/build'
make: *** [Makefile:2217: modules] Error 2

What now? How do I find this rule to make modules, so I could put it in this directory?

Hi,

Have you created the symlink for the headers, as directed in the link I posted?

Regards Tom.

Did you mean: sudo ln -s /usr/src/rbp2-headers-$(uname -r) /lib/modules/$(uname -r)/build ?

Didn’t help. Besides, I fail to understand the purpose of such symlink if headers don’t exist. Nevertheless, I created it, but I get the same error as above.

If I find time, I’ll read the topic you posted more carefully. I probably missed something. EDIT: Ah, wait, now I found the info about different header name. Will follow it and then let you know how it went.

Hi,

I think if you issue:

sudo apt-get install rbp2-headers-$(uname -r)

and recreate the symlink or should be good.

Regards Tom.

Yeap, I did:

sudo apt install rbp2-headers-$(uname -r)

then

sudo ln -s /usr/src/rbp2-headers-$(uname -r) /lib/modules/$(uname -r)/build
ln: failed to create symbolic link '/lib/modules/5.10.78-5-osmc/build/rbp2-headers-5.10.78-5-osmc': File exists

The symlink existed already since I first created it before installing the header.

So I went with dkms script and I got:

About to run dkms install steps...
Error! DKMS tree already contains: rtl8821CU-5.4.1
You cannot add the same module/version combo more than once.
Error! Your kernel headers for kernel 5.10.78-5-osmc cannot be found.
Please install the linux-headers-5.10.78-5-osmc package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 5.10.78-5-osmc cannot be found.
Please install the linux-headers-5.10.78-5-osmc package,
or use the --kernelsourcedir option to tell DKMS where it's located
Finished running dkms install steps.

Maybe I need a reboot first? Nope, the same.

I see here two problems:

  1. Error! DKMS tree already contains: rtl8821CU-5.4.1

Since it didn’t create correctly the module, the saved data is wrong, so I need to delete it somehow

  1. Error! Your kernel headers for kernel 5.10.78-5-osmc cannot be found.

Although the symlink exists, dkm still complains. I may use --kernelsourcedir to point where it’s located. Hmm… Maybe like that?

sudo ./dkms-install.sh --kernelsourcedir /usr/src/rbp2-headers-$(uname -r)

Nope. Maybe the script expects the symlink to be named linux-header-*? Maybe It would be good to change the symlink’s name?

Hi,

What happens if you build and install without dkms?

Does make still fail?

Regards Tom.

First, I removed the var/lib/dkms/rtl8821CU/5.4.1/ manually and it gave me:

sudo ./dkms-install.sh
About to run dkms install steps...

Creating symlink /var/lib/dkms/rtl8821CU/5.4.1/source ->
                 /usr/src/rtl8821CU-5.4.1

DKMS: add completed.
Error! Your kernel headers for kernel 5.10.78-5-osmc cannot be found.
Please install the linux-headers-5.10.78-5-osmc package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 5.10.78-5-osmc cannot be found.
Please install the linux-headers-5.10.78-5-osmc package,
or use the --kernelsourcedir option to tell DKMS where it's located
Finished running dkms install steps.

So I know how to bypass the first issue. However, the script still doesn’t see the header, even if I use this parameter or created a copy of a symlink with name linux-headers-5.10.78-5-osmc.

Without dkms, I get still the error:

make[1]: Entering directory '/usr/lib/modules/5.10.78-5-osmc/build'
make[1]: *** No rule to make target 'modules'.  Stop.
make[1]: Leaving directory '/usr/lib/modules/5.10.78-5-osmc/build'
make: *** [Makefile:2217: modules] Error 2

Will try to figure out what to do.