Old uninstalled kernel versions are still present in mkinitcpio.d

History, Updating linux initcpios... errors for old uninstalled kernel versions

This problem was addressed quite some time ago, but it seems that we were not taken seriously by anyone in the team.
I uninstalled linux60 via mhwd (GUI).
Result after mkinitcpio -P

==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-6.0-x86_64'
==> Building image from preset: /etc/mkinitcpio.d/linux60.preset: 'fallback'
  -> -k /boot/vmlinuz-6.0-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-6.0-x86_64-fallback.img -S autodetect
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-6.0-x86_64'
==> Building image from preset: /etc/mkinitcpio.d/linux61.preset: 'default'
  -> -k /boot/vmlinuz-6.1-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-6.1-x86_64.img

Usually these files transform to a pacsave, but this does no longer happen.

1 Like

For the record, I have not a single version there that shouldn’t be:

$ ls -l /boot
drwx------ root root 4.0 KB Thu Jan  1 02:00:00 1970 efi
drwxr-xr-x root root 4.0 KB Fri Feb  3 09:40:48 2023 grub
.rw------- root root  58 MB Fri Feb  3 09:39:58 2023 initramfs-5.10-x86_64-fallback.img
.rw------- root root  11 MB Fri Feb  3 09:39:40 2023 initramfs-5.10-x86_64.img
.rw------- root root  69 MB Fri Feb  3 09:40:20 2023 initramfs-5.15-x86_64-fallback.img
.rw------- root root  10 MB Fri Feb  3 09:40:02 2023 initramfs-5.15-x86_64.img
.rw------- root root  83 MB Fri Feb  3 09:40:44 2023 initramfs-6.2-x86_64-fallback.img
.rw------- root root  12 MB Fri Feb  3 09:40:25 2023 initramfs-6.2-x86_64.img
.rw-r--r-- root root 5.4 MB Tue Nov  8 21:02:49 2022 intel-ucode.img
.rw-r--r-- root root  23 B  Wed Feb  1 14:01:30 2023 linux510-x86_64.kver
.rw-r--r-- root root  22 B  Wed Feb  1 14:02:17 2023 linux515-x86_64.kver
.rw-r--r-- root root  23 B  Mon Jan 30 14:16:52 2023 linux62-x86_64.kver
drwxr-xr-x root root 4.0 KB Wed Jan 25 10:51:24 2023 memtest86+
drwxr-xr-x root root 4.0 KB Sat Nov 26 12:31:04 2022 syslinux
.rw-r--r-- root root 9.3 MB Fri Feb  3 09:39:35 2023 vmlinuz-5.10-x86_64
.rw-r--r-- root root  10 MB Fri Feb  3 09:39:35 2023 vmlinuz-5.15-x86_64
.rw-r--r-- root root  12 MB Fri Feb  3 09:39:35 2023 vmlinuz-6.2-x86_64
$ ls -l /etc/mkinitcpio.d/
.rw-r--r-- root root 396 B Sat Feb  6 08:19:34 2021 linux419.preset.pacsave
.rw-r--r-- root root 396 B Thu Dec 31 11:14:46 2020 linux510.preset
.rw-r--r-- root root 396 B Mon Nov 15 09:32:49 2021 linux515.preset
.rw-r--r-- root root 396 B Mon Jan  3 14:54:15 2022 linux516.preset.pacsave
.rw-r--r-- root root 396 B Sun Feb  6 09:19:46 2022 linux517.preset.pacsave
.rw-r--r-- root root 396 B Fri May 13 10:24:34 2022 linux518.preset.pacsave
.rw-r--r-- root root 396 B Mon Jun 13 10:35:45 2022 linux519.preset.pacsave
.rw-r--r-- root root 392 B Mon Sep 14 13:09:52 2020 linux54.preset.pacsave
.rw-r--r-- root root 392 B Fri Sep 11 18:41:10 2020 linux58.preset.pacsave
.rw-r--r-- root root 392 B Mon Oct 17 09:12:15 2022 linux60.preset.pacsave
.rw-r--r-- root root 392 B Thu Nov  3 14:47:01 2022 linux61.preset
.rw-r--r-- root root 395 B Wed Jan 25 11:19:12 2023 linux62.preset

More users reporting:

…but this has nothing to do with todays update.

I had already removed Kernel 6.0 before the last update (2023-01-24) and did not get the error when i did that update, and as it popped up on this update (2023-02-03) is why I’m confused why this happened this time and not on the last update.

After removing linux60 you haven’t regenerated initramfs, have you?

No, just used manjaro settings manager GUI to install 6.1 then rebooted and used it again to remove 6.0 (after testing 6.1 with benchmarks, etc), and that was before the 2023-01-24 update.

This time after the error happened (was only warnings update still worked), i went looking to why and that’s when i spotted the “linux60.preset” so renamed it to “linux60.preset.pacsave” then just did “sudo mkinitcpio -P” from terminal and “sudo update-grub” and the Kernel 6.0 error has gone.

I might not of needed the update-grub but better safe then sorry.

2 Likes

I have similar also.
Installed 6.2, rebooted into it. Removed 6.1 via msm then ran the update.

(41/56) upgrading linux62-nvidia                                                                      [------------------------------------------------------------] 100%
cat: /usr/lib/modules/extramodules-6.1-MANJARO/version: No such file or directory
depmod: ERROR: Bad version passed 
error: command failed to execute correctly

…

==> Starting build: 6.2.0-1-MANJARO
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [resume]
  -> Running build hook: [filesystems]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-6.2-x86_64-fallback.img
==> Image generation successful
error: command failed to execute correctly

In the past the present files were part of the kernel packages. now they get autogenerated. We have to see why those won’t get removed in some cases.

pacman -Qo /etc/mkinitcpio.d/linux60.preset
error: No package owns /etc/mkinitcpio.d/linux60.preset

most likely due to this change:

this should fix it: [pkg-upd] 34-1.1 (a2fb55ca) · Commits · Packages / Core / mkinitcpio · GitLab

4 Likes