Deleted kernel is still set for DKMS and initramfs update during system upgrade

Hi everyone, since deleting the old 5.10 and 5.4 LTS kernels I get the following messages during every major system upgrade:

[2024-02-28T09:19:20+0100] [ALPM-SCRIPTLET] ==> ERROR: Missing 5.4.85-1-MANJARO kernel modules tree for module nvidia/545.29.06.
[2024-02-28T09:20:49+0100] [ALPM] running '90-mkinitcpio-install.hook'...
[2024-02-28T09:20:49+0100] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux510.preset: 'default'
[2024-02-28T09:20:49+0100] [ALPM-SCRIPTLET] ==> Using configuration file: '/etc/mkinitcpio.conf'
[2024-02-28T09:20:49+0100] [ALPM-SCRIPTLET]   -> -k /boot/vmlinuz-5.10-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.10-x86_64.img
[2024-02-28T09:20:49+0100] [ALPM-SCRIPTLET] ==> ERROR: specified kernel image does not exist: '/boot/vmlinuz-5.10-x86_64'
[2024-02-28T09:20:49+0100] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux510.preset: 'fallback'
[2024-02-28T09:20:49+0100] [ALPM-SCRIPTLET] ==> Using configuration file: '/etc/mkinitcpio.conf'
[2024-02-28T09:20:49+0100] [ALPM-SCRIPTLET]   -> -k /boot/vmlinuz-5.10-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.10-x86_64-fallback.img -S autodet
[2024-02-28T09:20:49+0100] [ALPM-SCRIPTLET] ==> ERROR: specified kernel image does not exist: '/boot/vmlinuz-5.10-x86_64'

The system works as expected (I haven’t been using that kernel version in ages and the other kernels are updating just fine) but these messages are bugging me a little bit. Can anyone help me out? What would be the correct (and safe!) way of deleting the remainders of it?

Remove this:


Thanks! I will test this when the next kernel update hits. Does this also fix DKMS trying to install driver modules for the 5.4 kernel though?

Check if you still have anything linux54 related installed.

pacman -Qs linux54

You may want to do a cleanup with your installed kernels and configs

mhwd-kernel -li

Then remove unneeded kernels

mhwd -r <linuxXX>

I had already checked the installed packages and mhwd. The kernels are no longer shown there.

$ pacman -Qs linux54

$ mhwd-kernel -li
Currently running: 6.6.16-2-MANJARO (linux66)
The following kernels are installed in your system:
   * linux515
   * linux61
   * linux66
ls /etc/mkinitcpio.d
ls /boot
$ ls /etc/mkinitcpio.d
linux53.preset.pacsave         linux54.preset.pacsave  linux61.preset  linux419.preset.pacsave  linux515.preset
linux54-custom.preset.pacsave  linux55.preset.pacsave  linux66.preset         
$ ls /boot            
amd-ucode.img                       initramfs-5.15-x86_64.img          linux61-x86_64.kver   vmlinuz-5.15-x86_64
efi                                 initramfs-6.1-x86_64-fallback.img  linux66-x86_64.kver   vmlinuz-6.1-x86_64
EFI                                 initramfs-6.1-x86_64.img           linux515-x86_64.kver  vmlinuz-6.6-x86_64
grub                                initramfs-6.6-x86_64-fallback.img  lost+found            
initramfs-5.15-x86_64-fallback.img  initramfs-6.6-x86_64.img           memtest86+

Does what is attempted to build not just depend on what kernel headers are installed?
Only 515 and 66 are present in mkinitcpio.d here.
I think the kernel headers need to go - not sure though.

That’s how I read the description of dkms.

$ pacman -Q | grep headers       
aarch64-linux-gnu-linux-api-headers 6.0-1
linux-api-headers 6.7-1
linux515-headers 5.15.148-2
linux61-headers 6.1.77-2
linux66-headers 6.6.16-2

This does not seem to be the trigger :confused:

ls /usr/lib/modules
ls /var/lib/dkms/*
sudo dkms status

Ah, there we have some leftover files:

$ ls /var/lib/dkms/*
/var/lib/dkms/mok.key  /var/lib/dkms/

470.63.01                        kernel-5.10.63-1-MANJARO-x86_64   kernel-6.1.77-2-MANJARO-x86_64
510.54                           kernel-5.10.102-1-MANJARO-x86_64  kernel-6.6.16-2-MANJARO-x86_64
545.29.06                        kernel-5.10.105-1-MANJARO-x86_64  
kernel-5.4.144-1-MANJARO-x86_64  kernel-5.15.148-2-MANJARO-x86_64  

3.6.0  kernel-5.15.148-2-MANJARO-x86_64  kernel-6.1.77-2-MANJARO-x86_64
3.7.0  kernel-6.1.26-1-MANJARO-x86_64    kernel-6.6.16-2-MANJARO-x86_64
$ sudo dkms status
Error! Could not locate dkms.conf file.
File: /var/lib/dkms/nvidia/470.63.01/source/dkms.conf does not exist.

DKMS triggers only for 5.4 though, not for 5.10.

Edit: I just installed the new stable update and (as expected) the mkinitcpio section doesn’t run for 5.10 anymore after removing the .preset file. DKMS still runs for 5.4, only through 70-dkms-install.hook though:

[2024-03-07T09:43:21+0100] [ALPM] running '71-dkms-remove.hook'...
[2024-03-07T09:43:25+0100] [ALPM-SCRIPTLET] ==> dkms remove --no-depmod nvidia/545.29.06 -k 5.15.148-2-MANJARO
[2024-03-07T09:43:26+0100] [ALPM-SCRIPTLET] ==> dkms remove --no-depmod nvidia/545.29.06 -k 6.1.77-2-MANJARO
[2024-03-07T09:43:27+0100] [ALPM-SCRIPTLET] ==> dkms remove --no-depmod nvidia/545.29.06 -k 6.6.16-2-MANJARO
[2024-03-07T09:43:27+0100] [ALPM-SCRIPTLET] ==> dkms remove --no-depmod openrazer-driver/3.7.0 -k 6.6.16-2-MANJARO
[2024-03-07T09:43:28+0100] [ALPM-SCRIPTLET] ==> dkms remove --no-depmod openrazer-driver/3.7.0 -k 6.1.77-2-MANJARO
[2024-03-07T09:43:28+0100] [ALPM-SCRIPTLET] ==> dkms remove --no-depmod openrazer-driver/3.7.0 -k 5.15.148-2-MANJARO
[2024-03-07T09:43:28+0100] [ALPM-SCRIPTLET] ==> depmod 6.6.16-2-MANJARO
[2024-03-07T09:43:31+0100] [ALPM-SCRIPTLET] ==> depmod 6.1.77-2-MANJARO
[2024-03-07T09:43:33+0100] [ALPM-SCRIPTLET] ==> depmod 5.15.148-2-MANJARO
[2024-03-07T09:46:22+0100] [ALPM] running '70-dkms-install.hook'...
[2024-03-07T09:46:22+0100] [ALPM-SCRIPTLET] ==> dkms install --no-depmod openrazer-driver/3.7.0 -k 5.15.150-1-MANJARO
[2024-03-07T09:46:31+0100] [ALPM-SCRIPTLET] ==> dkms install --no-depmod nvidia/550.54.14 -k 5.15.150-1-MANJARO
[2024-03-07T09:47:04+0100] [ALPM-SCRIPTLET] ==> dkms install --no-depmod openrazer-driver/3.7.0 -k 6.6.19-1-MANJARO
[2024-03-07T09:47:12+0100] [ALPM-SCRIPTLET] ==> dkms install --no-depmod nvidia/550.54.14 -k 6.6.19-1-MANJARO
[2024-03-07T09:47:59+0100] [ALPM-SCRIPTLET] ==> dkms install --no-depmod openrazer-driver/3.7.0 -k 6.1.80-1-MANJARO
[2024-03-07T09:48:07+0100] [ALPM-SCRIPTLET] ==> dkms install --no-depmod nvidia/550.54.14 -k 6.1.80-1-MANJARO
[2024-03-07T09:48:54+0100] [ALPM-SCRIPTLET] ==> depmod 5.15.150-1-MANJARO
[2024-03-07T09:48:58+0100] [ALPM-SCRIPTLET] ==> depmod 6.6.19-1-MANJARO
[2024-03-07T09:48:59+0100] [ALPM-SCRIPTLET] ==> depmod 6.1.80-1-MANJARO
[2024-03-07T09:49:00+0100] [ALPM-SCRIPTLET] ==> ERROR: Missing 5.4.85-1-MANJARO kernel modules tree for module nvidia/550.54.14.

what does the path look like now ?

ls /var/lib/dkms/nvidia/*
$ ls /var/lib/dkms/nvidia/*         
5.4.144-1-MANJARO  5.10.63-1-MANJARO  source

5.10.102-1-MANJARO  5.10.105-1-MANJARO  source

5.15.150-1-MANJARO  6.1.80-1-MANJARO  6.6.19-1-MANJARO  source

log  module

log  module

log  module

log  module

log  module

log  module

log  module

The plot thickens :sweat_smile: