You are not logged in.
Hello. Everytime kernel is updated, my wifi drivers don't work. I need to use this to get my adapter working: https://aur.archlinux.org/packages/8192cu-dkms/ .
After kernel update, I have to manually reinstall the package, so the kernel module gets rebuilt. Is there any way to make it automatic?
Offline
You could use a custom mkinitcpio hook -- create a file at /usr/lib/initcpio/install/wifi-update with this content:
#!/usr/bin/env bash
build() {
/root/watch.sh &
}
help() {
cat <<HELPEOF
This hook waits for mkinitcpio to finish and re-installs the wi-fi drivers from the AUR
HELPEOF
}
Then write a script (/root/watch.sh) to re-install the package with this format:
#!/usr/bin/env bash
while [[ -d "/proc/$PPID" ]]; do
sleep 1
done
/usr/bin/wget https://aur.archlinux.org/packages/81/8192cu-dkms/8192cu-dkms.tar.gz
/usr/bin/tar xf 8192cu-dkms.tar.gz
cd 8192cu-dkms
/usr/bin/su <user name> -c 'makepkg -fics'
echo "Re-installed drivers :)"
Then add "wifi-update" to the list of HOOKS in /etc/mkinitcpio.conf
I have no idea if this will actually work, I've just cobbled it together -- you might want to improve it
EDIT: Added `cd`
Last edited by Head_on_a_Stick (2015-06-02 06:49:55)
Online
As another idea, perhaps you could use incrond to run a script when the kernel is upgraded?
Or you could wait for pacman hooks...
Offline
Thank you very much for this script. I'm not sure if it works, how do I test it without waiting for kernel update? I tried mkinitcpio -p linux , but this is something different than updating kernel via pacman, isn't it? Your script didn't run and wifi drivers still work, same for graphics drivers.
Offline
Thank you very much for this script. I'm not sure if it works, how do I test it without waiting for kernel update? I tried mkinitcpio -p linux , but this is something different than updating kernel via pacman, isn't it? Your script didn't run and wifi drivers still work, same for graphics drivers.
I added a `cd` command to the "script" a few minutes ago -- the AUR package will not build without this.
I really don't know if it will work and I have no way of testing it on my hardware.
I would suggest manually removing the wireless driver then running `mkinitcpio -p linux` and see if they are installed by the script.
Online
I noticed it, but your script doesn't run at all when I type `mkinitcpio -p linux`. And wifi still works after reboot. Same for graphics driver, it has a hook at shutdown, that rebuilds its module after kernel update, it haven't run too and graphics driver works. It's like 'mkinitcpio -p linux' does nothing to the system.
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
-> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 4.0.4-2-ARCH
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [autodetect]
-> Running build hook: [modconf]
-> Running build hook: [block]
-> Running build hook: [filesystems]
-> Running build hook: [keyboard]
-> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
-> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> Starting build: 4.0.4-2-ARCH
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [modconf]
-> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: aic94xx
-> Running build hook: [filesystems]
-> Running build hook: [keyboard]
-> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img
==> Image generation successful
Last edited by kox (2015-06-02 07:18:24)
Offline
Did you add the "wifi-update" hook to mkinitcpio.conf?
Perhaps you should try the incron method suggested by @pypi
Online
I forgot about it. It seems to work now, thanks!
Offline
Why do you have to reinstall the package? A simple "dkms autoinstall" should do wonders, there is even an aur package available: mkinitcpio-dkms.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
@OP: Excellent news!
@progandy: D'oh!
Online