FS#49052 - [linux] DKMS modules - mkinitcpio - execution order in kernel update is backwards
Attached to Project:
Arch Linux
Opened by James (thx1138) - Friday, 22 April 2016, 15:59 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 18 November 2016, 00:51 GMT
Opened by James (thx1138) - Friday, 22 April 2016, 15:59 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 18 November 2016, 00:51 GMT
|
Details
pacman 5.0.1-2
If or when a DKMS-built kernel module is desired in the initramfs-linux.img, currently, mkinitcpio must be manually re-run after a pointless automatic mkinitcpio run, because the new-kernel version of the module is not available when mkinitcpio is first run. This is an uncommon use case, but here is an example, though not the best use case. Perhaps an early-boot driver would be a better use case. Still... ... :: Running pre-transaction hooks... (1/1) Remove DKMS modules ==> dkms -q remove -q -m kdbus -v 3227.245fe93 -k 4.5.1-1-ARCH :: Processing package changes... ... (4/8) upgrading linux [################################################] 100% >>> Updating module dependencies. Please wait ... >>> Generating initial ramdisk, using mkinitcpio. Please wait... ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default' -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img ... ==> ERROR: module not found: `kdbus' ... ==> ERROR: module not found: `kdbus' ==> Generating module dependencies ==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img ==> WARNING: errors were encountered during the build. The image may not be complete. ... :: Running post-transaction hooks... (1/1) Install DKMS modules ==> dkms -q install -m kdbus -v 3227.245fe93 -k 4.5.2-1-ARCH So now, to add the just-built module to /boot/initramfs-linux-fallback.img, mkinitcpio must be run again. Of course, the kernel has to be installed before the module can be re-built. So, it would be better to run dkms after installing the kernel but before running mkinitcpio. Running mkinitcpio could itself be a "post-transaction hook", for instance, run after "Install DKMS modules". |
This task depends upon
Closed by Doug Newgard (Scimmia)
Friday, 18 November 2016, 00:51 GMT
Reason for closing: Fixed
Additional comments about closing: linux 4.8.8-2
Friday, 18 November 2016, 00:51 GMT
Reason for closing: Fixed
Additional comments about closing: linux 4.8.8-2
The initcpio should also be generated in a PostTransaction hook, which runs after the DKMS hook. The hook should probably part of the mkinitcpio package. In addition this would reduce code duplication between the install scripts of the kernel packages.
For now I'm using the following hook in /etc/pacman.d/hooks/75-mkinitcpio.hook:
[Trigger]
Operation = Install
Operation = Remove
Operation = Upgrade
Type = File
Target = usr/lib/modules/*/
Target = usr/src/*/dkms.conf
[Action]
Description = rebuild initial ramdisk environment
Depends = mkinitcpio
Exec = /usr/bin/mkinitcpio --allpresets
When = PostTransaction
With nvidia blob drivers you need to include nvidia, nvidia_modeset, nvidia_uvm and nvidia_drm into initramfs to enable DRM kernel mode setting.
So I need to run an extra mkinitcpio manually or via a hook after the failed one every time when nvidia-dkms or linux/linux-lts updates.
For people who want to combine out of tree module rebuilds to this hook:
The hook is currently named 80-linux.hook but there's already a commit that renames it to 99-linux.hook.
By creating a hook file with the same name in /etc/pacman.d/hooks/ you can override the default hook and extend it by appending new [Trigger] conditions to it.
Just remember to copy the contents of the original hook file into the overriding one.
For example my hook to append nvidia-dkms trigger events to it:
------------------------
[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Target = boot/vmlinuz-linux
Target = usr/lib/initcpio/*
[Trigger]
Type = Package
Operation = Install
Operation = Upgrade
Operation = Remove
Target = nvidia-dkms
[Action]
Description = Updating Arch Linux initramfs image
When = PostTransaction
Exec = /usr/bin/mkinitcpio -p linux
------------------------