I deleted all my kernels!

Really dumb error:
I was updating the system. At some point it logged itself off and on again. I believed that it was finished, so I rebooted. But it was still in the process of rebuilding the kernels. At this point there is NO vmlinuz or initramfs in the /boot directory.
I have the live ISO and also access to the drive from another system. What I want to do is replace the kernel without having to wipe the rest of the system.
I have a separate partition for /home, but there are still many programs and customizations in the file system.
What can I do?

You need to install the kernel(s) again.To do that you need to boot a live ISO and chroot into your old root directory and install the kernel(s) with pacman.



OK. Do I have to separately do dracut also?

should not be neccessary. If you reinstall the kernel with pacman it will automatically run dracut.

But you should certainly not only install the kernels but also run a full update again when you are in chroot. Just to make sure that not only the kernels are missing and reinstalled.

The chroot wiki says to mount the efi partion thus:
mount /dev/nvme0n1p1 /mnt/esp
what is esp? is it boot?

If you are using systemd-boot: mount /dev/nvme0n1p1 /mnt/efi

if you are using Grub: mount /dev/nvme0n1p1 /mnt/boot/efi

:eye: https://wiki.archlinux.org/title/ESP

For more detailed instructions, provide the output of:

sudo parted -l


OK. I mounted the partitions and did arch-chroot /mnt.
Then I tried pacman -Syu. I got “failed to synchronize all databases (unable to lock database).”

Remove the lock first:

rm /var/lib/pacman/db.lck


pacman -Syu

Afterwards, reinstall your kernels.

1 Like

done. pacman ran, but said nothing to do. I suppose I have to specify the kernels explicity?

Yes. For LTS kernel (as an example): pacman -S linux-lts

1 Like

OK. I succeeded to install the lts kernel. What is the name of the 6.3.6 version?

Just linux.

1 Like

Successful reboot!
Thank you. You have probably saved me a week’s worth of work if I’d had to rebuild everything. I won’t make this particular mistake again!


This same thing happened to me this weekend(Thursday/Friday): I updated… tried to recover, but was unable to boot because systemd-boot couldn’t see any system.

I wasn’t exactly sure at which point it logged me out, but /sys was completely empty and I just did a reinstall, ran my startup scripts, then ran my Ansible playbook. Everything is good now, but I was annoyed I couldn’t recover my system.

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