While trying to remove my broken Windows installation, KDE Partition Manager erased my /boot partition. The system is still running. How do I regenerate the boot partition so that my system will still work once I reboot? I use systemd-boot as the bootloader.
I already tried sudo mkinitcpio -p linux-cachyos in the hope it would put the kernel image back but that just complains about the files not existing anymore.
I had to mount the new partition at /mnt/boot as it doesnât seem to pick it up without a reboot. After setting SYSTEMD_RELAX_ESP_CHECKS to 1 I was able to run bootctl install --esp-path=/mnt/boot.
However sdboot-manage gen --esp-path=/mnt/boot gives the error âThere are no boot loader entries after entry generationâ, probably because there is no kernel image file.
Since the new partition wasnât even recognized, I chrooted into the system from a live USB and did it again. I used cp /usr/lib/modules/6.10.6-3-cachyos/vmlinuz /boot/vmlinuz-linux to put the kernel image back so that the boot loader entry can be generated.
However now it says âError preparing initrd: Not foundâ in red flashing letters when turning the computer on.
THis is not how it works. You just need to reinstall the kernel, to generate these freshly.
Also, it would be not the âvmlinuz-linuxâ, it would be âvmlinuz-linux-cachyosâ
Just run in the chroot, if properly mounted:
sudo pacman -Sy linux-cachyos linux-cachyos-headers
This will put this into the correcte directorys and regenerate the initramfs with mkinitcpio.
linux-cachyos-headers did it, thanks! Regenerating the bootloader entries from within a chroot messed up the ld.luks.name option in the entry but after changing it back to what it said in /etc/fstab my system works again!