I had a similar problem recently. I could recover by following the answer here.
I documented the steps that I followed in a new answer.
I copying my answer here for convenience:
I have a Fedora 30 PC. The boot partition is on /dev/sda3
and the root partition is on an LVLM named Fedora-root
.
I ran all commands with the root account.
I booted from the Fedora live media (from a USB drive)
Mount my root partition
mount /dev/mapper/Fedora-root /mnt
- Mount my boot partition
mount /dev/sda3 /mnt/boot
- Copy the kernel from the live partition to the intended boot partition
cp /boot/vmlinuz-$(uname -r) /mnt/boot/
- Mount system partitions
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
- Change root to
/mnt
chroot /mnt
- Generate the
initramfs
dracut /boot/initramfs-$(uname -r).img $(uname -r) -v
- Re-install grub and re-configure it
grub2-mkconfig -o /boot/grub2/grub.cfg
For some reason which I don't know, generating the initramfs
was very slow and couldn't finish on my system (step 6). However, the command worked normally when I didn't chroot the filesystem. So, I skipped the steps from 3 onwards. I also had to modify the dracut
configuration to point to the root system.
So, the new steps are:
- Point to the root location in the
dracut
configuration
echo "root=/dev/mapper/Fedora/root" > /etc/dracut.conf.d/kernel.conf
- Re-install the
kernel
and generate the initramfs
dracut /dev/sda/initramfs-$(uname -r).img $(uname -r) -v
- I then followed steps 3-6 above, so I can rebuild the grub configuration (this step may be not needed, I was over cautious)
mount /dev/mapper/Fedora-root /mnt`
mount /dev/sda3 /mnt/boot
cp /boot/vmlinuz-$(uname -r) /mnt/boot/
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
chroot /mnt
- Re-install grub and re-configure it
grub2-install /dev/sda
grub2-mkconfig -o /boot/grub2/grub.cfg
Note for NVIDIA owners
I have a NVIDIA GPU, and I had the proprietary drivers installed before the incident.
The restored kernel from the live media used the Nouveau drivers (as it is the default driver in Fedora). The restored kernel was also not the latest version. When I updated the kernel
afterwards using the GUI interface, it used the NVIDIA proprietary drivers.