“But it was working yesterday”

Locked out of your Fedora installation? Maybe because you’ve just reinstalled Windows (again). Or you’ve been playing with some alternate UEFI boot loaders. But, there is (inevitably) a way to fix it.

Disclaimer: Some stuff might be wrong. I am still learning.

Start by booting the machine with a live Fedora system. The live system should be started in EFI mode.

Once booted,

sudo -s

**Identifying which disks to mount

**

My partition arrangement will differ from yours. You can use the Gnome Disks utility, or terminal commands(…) to identify which partitions are which.

Mounting the system partition

In my case, my Fedora install is on a LVM set-up. As the LVM volumes were auto-detected on my live system, I simply ran:

mount /dev/mapper/jeremy-root /mnt/sweethome

(if LVM) Substitute ‘jeremy-root’ with the one on your system. If unsure, use the terminal command ‘lvdisplay’ (interestingly enough, ‘/dev/fedora/root’ seems to be an alternative path to ‘jeremy-root’ for me).

(if non-LVM) For normal partitioning, look for obvious indicators for your root partition: it’s probably the largest EXT4 partition on the disk.

Mounting the boot partition

mount /dev/sdb5 /mnt/sweethome/boot/

Not everyone has a boot partition, but typical Fedora installations will have it. Mine is a 500MB EXT4.

**Mounting the EFI system partition (aka the ‘esp’)

**

UEFI systems have an extra layer of complication – the esp. You need to mount this too. It should be the small FAT partition near the start of the disk unless you’re on a Mac (i think, could be HFS+, but i don’t have a Mac).

mount /dev/sdb2 /mnt/sweethome/boot/efi/

Finally. We can now chroot.

mount -o bind /dev /mnt/sweethome/dev
mount -o bind /proc /mnt/sweethome/proc
mount -o bind /sys /mnt/sweethome/sys
mount -o bind /run /mnt/sweethome/run
mount -t tmpfs tmpfs /mnt/sweethome/tmp
chroot /mnt/sweethome/

At this point, we are now ‘logged in’ to the system. Any commands will affect the actual Fedora installation – not the Live system. Finally, we can recreate the grub2 efi boot loader files.

yum reinstall grub2-efi grub2-efi-modules shim
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

(First command from Fedora wiki, second command from the Fedora manual)

Depending on your brand of UEFI BIOS, it might pick up Fedora in its Boot menuΒ (think: F8/F12) automatically from last time. Or not. If the latter, you will need to mess with efibootmgr (see Fedora manual – replace X and Y, e.g. for sda2, X is the ‘a‘ and Y is the ‘2‘)

**Done! exit, reboot and try again.

**

But if you still can’t get Fedora booting…

After following these steps, I got successfully booted in grub (yay!) but was getting hung on the line “Started file system check on /dev/mapper/fedora-root”. The rescue mode shell worked though, and I eventually discovered that there was a problem in my /etc/fstab after the Windows™ installer had made partiton changes to the esp. The uuid had changed.

Solution: Comment out or fix the problematic line in /etc/fstab

Try the following from rescue mode (source: randomuser on Ask Fedora):

dracut --regenerate-all --force

Good luck!