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

When I updated with pacman my XFCE computer today which has two V6 Linux kernels installed, I got the following:

(11/21) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux518.preset: 'default'
  -> -k /boot/vmlinuz-5.18-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.18-x86_64.img
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-5.18-x86_64'
==> Building image from preset: /etc/mkinitcpio.d/linux518.preset: 'fallback'
  -> -k /boot/vmlinuz-5.18-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.18-x86_64-fallback.img -S autodetect
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-5.18-x86_64'
==> Building image from preset: /etc/mkinitcpio.d/linux519.preset: 'default'
  -> -k /boot/vmlinuz-5.19-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.19-x86_64.img
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-5.19-x86_64'
==> Building image from preset: /etc/mkinitcpio.d/linux519.preset: 'fallback'
  -> -k /boot/vmlinuz-5.19-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.19-x86_64-fallback.img -S autodetect
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-5.19-x86_64'
==> Building image from preset: /etc/mkinitcpio.d/linux60.preset: 'default'
  -> -k /boot/vmlinuz-6.0-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-6.0-x86_64.img
==> Starting build: 6.0.15-1-MANJARO

What can I do to remove the error messages about the old no-longer-installed kernel versions?

Thanks!!!


Moderator edit: In the future, please use proper formatting: [HowTo] Post command output and file content as formatted text

check theses points

sudo mhwd-kernel -li
sudo ls /etc/mkinitcpio.d/*.preset
sudo ls /boot/
sudo ls /usr/lib/modules/
1 Like

I executed all the commands you recommended. All of them returned references to v6 kernels except the second one, which returned:
[david@OptiplexManjaro ~]$ sudo ls /etc/mkinitcpio.d/*.preset
/etc/mkinitcpio.d/linux518.preset /etc/mkinitcpio.d/linux60.preset
/etc/mkinitcpio.d/linux519.preset /etc/mkinitcpio.d/linux61.preset

Can I assume that all I have to do is delete the v5 referenced files to correct my issue?

Any idea why installing the v6 kernels and removing the v5 kernels would have left the .preset files in place for v5?

Thanks!

Just remove the old presets from /etc/mkinitcpio.d/. They’re left over purposely in case one removes a kernel then later reinstalls it so the same settings are intact.

Please also see my edit to your first post. :wink:

sudo rm /etc/mkinitcpio.d/linux518.preset
sudo rm /etc/mkinitcpio.d/linux519.preset
sudo mkinitcpio -P
1 Like

I have been using Manjaro for many years now, and have upgraded the kernel multiple times on multiple computers. This is the first time I have ever seen the error message I got.
If these .preset files are always present after a kernel upgrade, what could have happened that created the error this time that didn’t happen all the other times I upgraded the kernel?

Done. Thanks for your help.

That’s a good question. It’s happened to me on my old Dell laptop, but not on my newer System76 laptops. I just did what @stephane mentioned above it everything was fine. I never did figure out why.

Maybe it was a SCROS (my own term meaning “a Stray Cosmic Ray from Outer Space”)…maybe?

I can confirm your error. On my new hardware linux5.15 has no wifi, so I uninstalled it. Then found no pacsave and looked into mkinitcpio.d and found linux5.15 still present.
Thought it was just a hic-up.

Edit
Yesterday I uninstalled linux6.0 and the file in mkinitcpio.d remained present.
So it is not only a hic-up.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.