I’ve had this issue for over a year now and have been resolving it by, after every kernel upgrade, booting into a separate distro, mounting and chrooting into the arch install, running mkinitcpio manually, and copying the kernel and initram to where reFIND searches for them. I figure it’s time I understand and fix it. I am sure this is my fault, a result of some customization I made to my boot process (multi-booting with reFIND).
Here’s part of the output of my most recent yay -Syu.
(13/27) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux510.preset: 'default'
-> -k /boot/efi/Manjaro/vmlinuz-5.10-x86_64 -c /etc/mkinitcpio.conf -g /boot/efi/Manjaro/initramfs-5.10-x86_64.img
==> ERROR: '/lib/modules/5.10.89-1-MANJARO' is not a valid kernel module directory
==> Building image from preset: /etc/mkinitcpio.d/linux510.preset: 'fallback'
-> -k /boot/efi/Manjaro/vmlinuz-5.10-x86_64 -c /etc/mkinitcpio.conf -g /boot/efi/Manjaro/initramfs-5.10-x86_64-fallback.img -S autodetect
==> ERROR: '/lib/modules/5.10.89-1-MANJARO' is not a valid kernel module directory
error: command failed to execute correctly
The only file I have in /etc/mkinitcpio.d is a file named linux510.preset
From the Arch linux wiki on mkinitcpio I read:
Every time a kernel is installed or upgraded, a pacman hook automatically generates a .preset file saved in /etc/mkinitcpio.d/. For example linux.preset for the official stable linux kernel package. A preset is simply a list of information required to create initial ramdisk images, instead of manually specifying the various parameters and the location of the output files. By default, it contains the instructions to create two images:
I have the script and hook in /usr/share/libalpm. I don’t understand what I’m seeing when I view them though. I haven’t been able to track down the issue.
less /usr/share/libalpm/scripts/mkinitcpio-install
less /usr/share/libalpm/hooks/90-mkinitcpio-install.hook
I found those by searching the arch github for “preset” which led me to this page for a file that looked relevant: scripts/mkinitcpio-install
My partition/boot scheme has EFI with reFIND on one partition. That gives me options to boot windows or kernels/initrams from a 1 gig unencrypted partition where my root filesystem is a luks encrypted device.
Hope I provided enough info to be pointed in the right direction. Happy to provide more. Thanks.
Just to gather some data:
is /lib a symlink to /usr/lib? ls -hl /lib
What is in /lib/modules? ls -hl /lib/modules
What is in the preset file? cat /etc/mkinitcpio.d/linux510.preset
No need to post it, but I have read of people who had an empty file there …