RTL8192EU being broken after every kernel upgrade

Hi!

Using KDE with 5.15-LTS on stable branch

I’m using the rtl8192eu-git driver from the AUR as without it the adapter can’t connect to any network (but sees them)

The problem is that the system update brings with it a kernel update, which is why I have to rebuild the driver, as it “falls off”. But building the driver requires running headers, and for this I need to restart the system after the update, and after restarting I have no internet to rebuild the driver

Please help, maybe I’m doing something wrong? Here is my usual full system update script (this is the only script I use since I rarely update the system)

# update mirrors
sudo pacman-mirrors --fasttrack --timeout 2

# upgrade all packages (normal + aur)
pamac upgrade --no-confirm --force-refresh --enable-downgrade --aur --devel

# install headers (required by the driver)
sudo pacman -S $(pacman -Qsq "^linux" | grep "^linux[0-9]*[-rt]*$" | awk '{print $1"-headers"}' ORS=' ') --noconfirm

# reinstall wifi driver (required if kernel was upgraded)
pamac build rtl8192eu-git --no-confirm
echo "blacklist rtl8xxxu" | sudo tee /etc/modprobe.d/rtl8xxxu.conf

# remove all junk packages
pamac remove --no-confirm --orphans

# clean installation caches
pamac clean --no-confirm --verbose --build-files --keep 0

# clean system as root
sudo bleachbit --clean firefox.cache firefox.crash_reports firefox.vacuum firefox.backup discord.vacuum discord.cache system.cache system.clipboard system.desktop_entry system.recent_documents system.rotated_logs system.tmp system.trash thumbnails.cache journald.clean system.localizations

# clean system as normal user
bleachbit --clean firefox.cache firefox.crash_reports firefox.vacuum firefox.backup discord.vacuum discord.cache system.cache system.clipboard system.desktop_entry system.recent_documents system.rotated_logs system.tmp system.trash thumbnails.cache journald.clean system.localizations

# send TRIM to SSD
sudo fstrim /

echo " "
echo " "
echo " "
echo " "
echo " "
echo " "
echo " "
echo "======= DONE ======="

This driver requires DKMS
If you set it (DKMS) up correctly - and have/install the appropriate kernel headers
the driver will be rebuilt and installed before you shut down and reboot.
So it will be available and work once you reboot.

I installing them during update every time

How can I do it?

look in Arch wiki for it?
or maybe here on the forum?

https://wiki.archlinux.org/title/Dynamic_Kernel_Module_Support

I dont see anything about “dkms setup”

If I understand the

User does not have to wait for a company, project, or package maintainer to release a new version of the module. Since the introduction of pacman hooks, the rebuild of the modules is handled automatically when a kernel is upgraded

correctly, pacman must rebuild modules on its own when updating the kernel. But the problem is that I install via AUR. Also, the Arch Wiki clearly states the concept

DKMS modules automatically rebuilt when a new kernel is installed

and does not include any configuration. This should work out of the box

It should indeed - and it does for me.

But I’m not on Manjaro.
and thus can’t really gauge your problem - slightly different system …
… but it should work just the same, provided the correct headers for the used kernel are installed

Installing a new kernel version for me triggers the rebuilding of any DKMS modules/drivers

before a reboot

they are thus present and working
once rebooted

Perhaps - just perhaps
you could use some other tool than pamac
(like yay, for example)
to update your system (your systems AUR packages)?

For me, installing new kernels not triggers rebuilding and I can`t rebuild driver by my own without reboot. I neved changed system configs so it’s default Manjaro behavior

I used yay before and there are the same problem

Then I can’t be really of help
but just refer you to the documentation for Manjaro on how to use it (DKMS) properly.

The whole purpose of it is to compile/provide working software/drivers
to make a flawless reboot possible
… instead of dealing with the problem on a case by case basis
after/when you already have a disfunctional driver after boot, because it is not matching the kernel you are using

Try 8192eu-dkms package from AUR.

… that’s probably it :wink:
although in the dependencies of the other one was: DKMS …

The package you are using is not based on dkms - which is why have to rebuild after each kernel sync.

In such case you need to maintain the driver manually.

A search in the AUR database AUR (en) - Packages shows a dkms based package for your devices

https://aur.archlinux.org/packages/8192eu-dkms-git

Clone the package

git clone https://aur.archlinux.org/8192eu-dkms-git
cd 8192-dkms-git
makepkg

Once you have the kernel headers in place for your kernel - I noted 5.15 LTS - the headers will be synced when you sync your system and with the package installed - dkms will rebuild the modules when new kernel (same release e.g. 5.15) is synced.

That is because dkms setup is not needed on an Arch based system - the command is used on Debian based systems.

When you install dkms and kernel headers for your actual kernel(s) and any package labelled -dkms you will get the necessary files for building the module in question.

That is one of the reasons you - unless experienced in building from source - should avoid manually building kernel modules or other binaries - using make && sudo make install. Another reason is the likelihood of getting file conflicts when syncing repo packages onto the system.

An example on how it works is the repo package virtualbox-host-dkms. To get the full picture of what happens I invite you to download the packages - unpack then into a temporary folder and examine exactly what they do. It is very educating and what I do when I don’t quite understand what is going on.

Example to fetch the files into a temporary folder in your home

mkdir ~/temp
sudo pacman -S --downloadonly dkms virtualbox-host-dkms --cachedir ~/temp

The package contains the c source and headers for the virtualbox host modules and installs those to /usr/src along with the necessary make files and dkms configuration.

The package also installs a configuration in the distribution wide location /usr/lib/modules-load.d

The package pulls the package dkms as an obvious dependency - which in turn contains pacman hooks which are executed when a kernel sync condition exist.

The logic behind hooks is quite simple and if the pkgbuild for RTL8192EU is based on dkms the modules are rebuild when syncing a new kernel.

Thanks a lot for such a detailed answer! Do I need to manually check for up-to-date headers each time?

Each time? linuxXXX-headers package is just like any other package - it gets updated with the rest of packages. You only install new headers with new kernel.

2 Likes

No you don’t.

When a package - in this case linux515-headers has been installed onto the system - all subsequent sync will include it if the package has changed.

Only in the event you are moving to a new kernel release e.g. 5.18 or the next LTS you will have to explicitly install kernel headers for that kernel.

Unlike pacman - which must be specifically instructed - if you use mhwd-kernel to move to a new kernel and you have the headers for the current kernel installed mhwd-kernel will install the headers without being specifically instructed to - thus helping you by applying your current kernel related packages.

1 Like