tl;dr
Is there a recommended way of generating the initramfs
in case the presets in /etc/mkinitcpio.d
do not match the version in /boot
?
Today I booted my computer and got a
kernel panic - not syncing:
VFS: Unable to mount root fs on …
error. I investigated it and I am completely certain that the issue is that I don’t have an initramfs
for the kernel 5.10.47-1-rt46
.
I have an initramfs-5.4-x86_64.img
so I can still login after rebooting and choosing the old version.
I understand that I need to generate a new initramfs. So I run
sudo pacman -S mkinitcpio
followed by (I don’t have another linux510 preset, so this is the only one I can run)
mkinitcpio -p linux510-rt
but I get the following error message
==> Building image from preset: /etc/mkinitcpio.d/linux510-rt.preset: ‘default’
→ -k /boot/vmlinuz-5.10-rt-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.10-rt-x86_64.img
==> ERROR: specified kernel image does not exist:/boot/vmlinuz-5.10-rt-x86_64' ==> Building image from preset: /etc/mkinitcpio.d/linux510-rt.preset: 'fallback' -> -k /boot/vmlinuz-5.10-rt-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.10-rt-x86_64-fallback.img -S autodetect ==> ERROR: specified kernel image does not exist:
/boot/vmlinuz-5.10-rt-x86_64’
If I run
ls /boot
I get the following two versions of vmlinuz:
vmlinuz-5.10-x86_64
vmlinuz-5.4-x86_64
Furthermore
cat /etc/mkinitcpio.d/linux510-rt.preset
returns this
#mkinitcpio preset file for the ‘linux510-rt’ package
ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-5.10-rt-x86_64"PRESETS=(‘default’ ‘fallback’)
#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-5.10-rt-x86_64.img"
#default_options=""#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-5.10-rt-x86_64-fallback.img"
fallback_options="-S autodetect"
Clearly, the preset path to the kernel does not match what is in the /boot
folder. I can imagine that just changing the name in the preset will allow me to run the mkinitcpio
and produce the initramfs
, but I am not sure whether that is the “correct” way of doing this and I would like to avoid breaking anything else.
My question is
Is there a recommended way of generating the initramfs
in case the presets in /etc/mkinitcpio.d
do not match the version in /boot
?
And if the answer is no, what should I do to minimize the chances of things getting screwed up again in the future?
EDIT:
I created another preset linux510.preset
, which is the same as linux510-rt.preset
except that I substituted 5.10-rt with 5.10. Then I ran mkinitcpio
with root privileges and the initramfs was generated. Unfortunately, after booting, I still get the error.
I did more research earlier and I saw that one of the causes of this could be the lack of space in /boot. I don’t think that this can be the problem, since
df -sh
returns
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 511M 3.8M 508M 1% /boot/efi
among other things.