Warning: session_start(): open(/tmp/sess_3f6c5affba59ebb3c97ab162c6f3a5e9, O_RDWR) failed: No space left on device (28) in /var/www/html/inc/init.php on line 265

Warning: session_start(): Failed to read session data: files (path: ) in /var/www/html/inc/init.php on line 265

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/inc/init.php:265) in /var/www/html/inc/auth.php on line 432

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/inc/init.php:265) in /var/www/html/inc/actions.php on line 38
reinstall_grub2_efi_fedora [Ben's notes]

Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


Fedora - reinstall / fix grub2 UEFI

Some hints to fix booting your favourite OS. Tested with Fedora 25 and Windows 10.


  • Boot from live USB
  • Switch to root and mount the needed filesystems:
    sudo -i
    mkdir -p /mnt/sysimage
    mount /dev/fedora/root /mnt/sysimage
    mount --bind /dev /mnt/sysimage/dev
    mount --bind /run /mnt/sysimage/run
    mount -t devpts pts /mnt/sysimage/dev/pts
    mount -t proc proc /mnt/sysimage/proc
    mount -t sysfs sys /mnt/sysimage/sys 
    modprobe efivarfs
    mount -t efivarfs efivarfs /mnt/sysimage/sys/firmware/efi/efivars
  • Copy the resolv.conf to have some networking in the chroot:
    mkdir -p /mnt/sysimage/var/run/NetworkManager
    cp /var/run/NetworkManager/resolv.conf /mnt/sysimage/var/run/NetworkManager
  • Enter the chroot and mount /boot and /boot/efi filesystems:
    chroot /mnt/sysimage
    mount /boot
    mount /boot/efi
  • Reinstall grub2:
    dnf -y reinstall grub2 grub2-efi grub2-efi-modules shim
    grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
  • Check if entry exists in EFI menu:
  • Add entry if it is missing:
    grep efibootmgr /var/log/anaconda/program.log 
    22:47:35,458 INFO program: Running... efibootmgr
    22:47:35,477 INFO program: Running... efibootmgr -c -w -L Fedora -d /dev/nvme0n1 -p 2 -l \EFI\fedora\shim.efi
    #Run the command found above:
    efibootmgr -c -w -L Fedora -d /dev/nvme0n1 -p 2 -l '\EFI\fedora\shim.efi'
  • (optional) Add another OS for example:
    efibootmgr -c -w -L Windows -d /dev/nvme0n1 -p 2 -l '\EFI\Microsoft\Boot\bootmgfw.efi'
  • (optional) Change the boot order:
    efibootmgr -o 1,0
  • (optional) Delete entry:
    efibootmgr -b 0 -B
  • (optional) Change timeout:
    efibootmgr -t 2
  • Unmount filesystems and reboot:
    umount /boot/efi
    umount /boot
    umount /mnt/sysimage/sys/firmware/efi/efivars
    umount /mnt/sysimage/sys
    umount /mnt/sysimage/run
    umount /mnt/sysimage/proc
    umount /mnt/sysimage/dev/pts
    umount /mnt/sysimage/dev
    umount /mnt/sysimage

Windows 10

  • Modify the path for the Windows boot manager to Fedora:
    bcdedit /set {bootmgr} path \EFI\fedora\shim.efi
  • Alternatively you can use EasyUEFI to edit the entries.
reinstall_grub2_efi_fedora.txt · Last modified: 2021/10/09 15:14 by