Install wifi driver on kernel-update

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
FreshMike
Posts: 4
Joined: Sat Mar 20, 2021 1:28 am

Install wifi driver on kernel-update

Post by FreshMike »

Hi,

I have a wifi dongle with the rtl8188fu driver which is not installed by default.
To get the driver I'm using this script to install the driver:
http://downloads.fars-robotics.net/wifi ... stall-wifi

Of course after an update of the pi kernel the driver is not working.

The script has an option to check for the latest available kernel version when running rpi-update. So this script could be added to /etc/kernel/postinst.d to install the driver,

Now it doesn't look diepi-update will give the same kernel version as the check does from here:
https://github.com/Hexxeh/rpi-firmware

Example:
latest verion of dietpi v7.0.2
Current kernel 5.10.17-v7+ #1403 SMP Mon Feb 22 11:29:51 GMT 2021 armv7l GNU/Linux
no newer kernel is available via apt update.

Running the wifi-install script with -u options give me this
Running command 'sudo rpi-update' will load:

kernel revision = 5.10.23-v7+
kernel build = #1406

Doesn't seem to lineup with dietpi.
Any suggestions or ideas maybe, much appreciated ?



```
echo -n "Please wait ... checking the kernel revision and build you will have after running command 'sudo rpi-update"
if [[ $kernelcommit != "rpi-update" ]] ; then
echo " $kernelcommit'."
else
echo "'."
fi

# download uname string if it exists
if ! (wget -q https://github.com/Hexxeh/rpi-firmware/ ... _id/$uname -O .uname_string) ; then

# download the relevant kernel image if uname_string doesn't exist
if ! (wget -q https://github.com/Hexxeh/rpi-firmware/ ... _id/$image -O .kernel) ; then
echo "Invalid commit-id, kernel not available for your version of the Pi, Pi $pi."
exit 1
fi

# extract uname_string from kernel image

strings -n 10 .kernel | grep "Linux version" > .uname_string
```
User avatar
Joulinar
Posts: 4249
Joined: Sat Nov 16, 2019 12:49 am

Re: Install wifi driver on kernel-update

Post by Joulinar »

Hi,

DietPi is not providing own kernel. They are used from the underlying base image. In your case it seems your are running a Raspberry Pi. Means you have a Raspberry Pi OS. Their the normal RPi OS kernel is used

Actual stable version of RPi OS kernel is 5.10.17

5.10.23 is a development kernel version and available via rpi-upate only. It is not recommended to run development kernel if it doesn't fix a specific issue.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
FreshMike
Posts: 4
Joined: Sat Mar 20, 2021 1:28 am

Re: Install wifi driver on kernel-update

Post by FreshMike »

"It is not recommended to run development kernel if it doesn't fix a specific issue."

Definitely agree with that. Any other better way of doing this ?
I'm running my Pi as a Edge Device with mainly running applications on docker, I would like to auto-update the pi on a monthly cron-schedule, but because a new kernel will break the wifi-driver I can't do this atm.
User avatar
Joulinar
Posts: 4249
Joined: Sat Nov 16, 2019 12:49 am

Re: Install wifi driver on kernel-update

Post by Joulinar »

I had a look to the driver update script and it seems it can be called with an option blank.

Code: Select all

[option]:- 	  blank - update/install driver for currently running kernel"
Not sure what it mean exactly but it seems it will not invoke bleeding edge RPi kernel and you could stay with current stable kernel. ? Maybe you would need to play with the options or check with the developer of this scripts how to avoid using rpi-update
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
FreshMike
Posts: 4
Joined: Sat Mar 20, 2021 1:28 am

Re: Install wifi driver on kernel-update

Post by FreshMike »

Yes, the script will update/install wifi driver for the current loaded version of the kernel, not the one just installed on a kernel update.
I have used it to install the wifi driver when connect via LAN to the internet.

If there is a kernel update, and you install a new kernel, uname -a still shows you the old active kernel, not the one just installed. It will get active after the reboot. If that happens I don't have access to the internet anymore, so the driver update needs to happen together with the kernel update, and after a reboot they will both be active.
User avatar
MichaIng
Site Admin
Posts: 2783
Joined: Sat Nov 18, 2017 6:21 pm

Re: Install wifi driver on kernel-update

Post by MichaIng »

Scripts in /etc/kernel/postinst.d will get the newly installed kernel version as first argument, so the script could be adjusted to make use of this.
FreshMike
Posts: 4
Joined: Sat Mar 20, 2021 1:28 am

Re: Install wifi driver on kernel-update

Post by FreshMike »

aaah! Thanks will give it a try.
Post Reply