Repair/Reinstall GRUB after Windows 11 Update (Dual Boot Fedora F39) (original) (raw)

April 15, 2024, 11:24am 1

Dear Community,

Unfortunately, I am getting loss and have not found a solution that works. My problem is the following:

I use Windows 11 and Fedora 39 as Dual Boot. After the last windows/bios update, notebook starts directly in Windows. I can’t find a easy and workable solution to show GRUB on boot again.

No options in bios/uefi and also boot-repair-disk (boot-repair-disk download | SourceForge.net) don’t work. boot-repair-disk don’t shows the “Recommended Repair” button and also with advanced I see nothing. Maybe because my Fedora filesystem is btrfs??

Also when I boot into the UEFI boot menu, I only see the Windows Bootloader. No entry for Fedora.

So I need your help and kindly ask for an step-by-step tutorial to fix/repair/reinstall GRUB
(I can use the installed Windows 11 or the Fedora 39 Live CD)

Thank you so much.
Tom

anon91881872 (anon91881872) April 15, 2024, 11:35am 2

can you still boot from bios to Fedora? if so this might fix the issue
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

sometimes W11 did this to me and i still could boot to Fedora from bios and then fixing grub again worked

majortom-de (Major Tom) April 15, 2024, 2:17pm 3

Hello Marko,
thats my problem: I found no solution to boot into Fedora. Entry is not available in UEFI Boot menu. I can only boot into Windows 11 or start Fedora from USB-Stick.

Is there a solution to fix this from Windows or with Fedora Live (USB-Stick)

Thank you
Tom

You can use a Fedora Live USB to chroot/systemd-nspawn into your broken Fedora and fix grub from there. Let me gather some instructions for you. I have old notes.

BRB

gnwiii (George N. White III) April 15, 2024, 3:00pm 5

Windows supports hibernation, aka, “faststartup”. On a dual-boot system I sometimes have to disable fast startup after updating Windows 11.

Mount the Fedora Partition:

Identify and Mount Partitions:

You should see the GRUB menu allowing you to choose between Windows and Fedora. Test both entries to ensure they boot correctly.

If anything else, please let us know.

Your instructions are great for systems using MBR boot, but do not account for the changes from ext4 to btrfs and sub-volumes, nor do they account for use of UEFI.

Windows 11 only uses UEFI so the fedora install also uses UEFI and proper instructions must reflect that.

When in the live system first make certain that the internet connection is properly functioning.
Then to mount the root subvolume with a btrfs file system it would be necessary to identify the btrfs partition with lsblk -f then mount it as.

  1. su to enter the root user environment
  2. mount -t btrfs -o subvol=root,compress=zstd:1 UUID=<uuid of btrfs partition> /mnt
    then mount the other needed system file systems as
  3. for fs in proc sys run dev ; do mount -o bind /$fs /mnt/$fs ; done
  4. chroot /mnt
  5. mount -a which will then mount the remaining file systems for the installed system according to the /etc/fstab entries.
  6. then perform the steps above to repair grub.

I have not tried systemd-nspawn but if that works as it appears from the man page then it may be possible to replace my steps 3 thru 5 with the systemd-nspawn command given above.

So the mount command could be /dev/sdaX /mnt -o subvol=@ instead? I should try this real quick in a VM while I’m here. Outside of that I do not see much difference in the commands 🤔

---------------------------------------------------------------------------------------------------------------------------------------

Would you have some points to add, amend to this process? I stated earlier these are older commands and I did make assumptions as the Title does say F39. I do not know may people who frequent the forums to use my type of setup with systemd-boot , Most users are running Grub/standard installs.

I agree, and the instructions I give here seem correct for recovery as long as the live system is booted into the proper mode. Though it is important to note that systemd-boot is significantly different than grub boot. The standard fedora btrfs structure does not name a subvol as @ (I think that may be a systemd boot requirement). The root file system is in the subvol root instead.

majortom-de (Major Tom) April 15, 2024, 6:34pm 10

Hey,

thanks for your comments and your help. I tried the following from above, but with Igrub2-install and grub2-mkconfig I got the errors below.

Do you have further tips for me?

SSD = nvme0n1
EFI Partition = nvme0n1p1
Boot Partition = nvme0n1p6
Fedora Partition = nvme0n1p7

mount /dev/nvme0n1p7 /mnt/
mount /dev/nvme0n1p6 /mnt/root/boot
mount /dev/nvme0n1p1 /mnt/root/boot/efi

mount -o bind /dev /mnt/root/dev
mount -o bind /sys /mnt/root/sys
mount -o bind /proc /mnt/root/proc
mount -o bind /run /mnt/root/run

chroot /mnt/root

mount -a

dnf reinstall grub2* shim

This works fine and I can access my local fedora files

grub2-install /dev/nvme0n1

Installing for x86_64-efi platform.
grub2-install: error: This utility should not be used for EFI platforms because it does not support UEFI Secure Boot. If you really wish to proceed, invoke the --force option.
Make sure Secure Boot is disabled before proceeding.

Secure Boot is disabled. If I try to use the --force command I also get an error:

Installing for x86_64-efi platform.
EFI variables are not supported on this system.
EFI variables are not supported on this system.
grub2-install: error: efibootmgr failed to register the boot entry: No such file or directory.

How can I install it for UEFI??

grub2-mkconfig -o /boot/grub2/grub.cfg

/usr/sbin/grub2-probe: error: cannot find a device for / (is /dev mounted?).

/dev is mounted. What is missing???

I assume the chroot command was a typo?

What is the output of mount while in the chroot environment? Does it show /dev properly mounted? Does it show all the required devices mounted?
/
/boot
/boot/efi
/home
/dev
/sys
/proc
/run
If you exit from the chroot environment all those should show an entry at /mnt/root/…

There also may be a discrepancy depending upon which live iso you are using to boot (kernel related). The release version of the iso had kernel 6.5.6. Your installed system likely has kernel 6.8.X (or maybe 6.7.X). Grub has been updated as well.

Booting from the live iso obtained from Index of /pub/alt/live-respins would give you an iso with (almost) current software and kernel which probably would assist with that grub2-mkconfig error since the booted kernel would be much closer to the updated kernel on the installed system (as would be almost all the other software). The respin iso as of today is dated 20240401.

gnwiii (George N. White III) April 15, 2024, 7:07pm 12

Using Fedora 39 Workstation defaults, you get btrfs subvolumes for root and home. Here:

% df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p7  405G   93G  308G  24% /
devtmpfs        4.0M     0  4.0M   0% /dev
tmpfs           7.8G     0  7.8G   0% /dev/shm
efivarfs        256K  104K  148K  42% /sys/firmware/efi/efivars
tmpfs           3.1G  2.1M  3.1G   1% /run
tmpfs           7.8G   16K  7.8G   1% /tmp
/dev/nvme0n1p7  405G   93G  308G  24% /home
/dev/nvme0n1p6  974M  308M  599M  34% /boot
/dev/nvme0n1p1  646M  100M  547M  16% /boot/efi
tmpfs           1.6G  156K  1.6G   1% /run/user/1000

Note that root and home are both on /dev/nvme0n1p7 , but need to be mounted using -0 subvol=<name>... as shown above in @computersavvy’s post. Note that there is no need to mount the home subvolume.

majortom-de (Major Tom) April 15, 2024, 8:43pm 13

Guys - you made my day. Thank you so much.

Together with your input and this Gist I found, I was able to restore GRUB :smiley:

su

mount -o subvol=root /dev/nvme0n1p7 /mnt/
mount /dev/nvme0n1p6 /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot/efi

mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc
mount -o bind /run /mnt/run
mount -o bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars

chroot /mnt

mount -a

dnf reinstall shim-* grub2-*

grub2-mkconfig -o /boot/grub2/grub.cfg

efibootmgr -c -d /dev/nvme0n1p1 -p 1 -L Fedora -l '\EFI\fedora\shimx64.efi.efi'

After this I was able to boot Fedora via UEFI Boot Menu. Then I executed this and after restart, GRUB is shown again:

dnf reinstall shim-* grub2-*

grub2-mkconfig -o /boot/grub2/grub.cfg

Crazy challenge but again learned a lot about Linux :sweat_smile:

Fedora is a long time learning experience, even for those of us with more than 20 years experience. 🤓

gdaga (manohar daga) July 29, 2024, 1:46am 15

just open Microsoft_window boot efi and select Fadora as first boot option in Boot configration… this can be done by presing power button+volume down in surface laptop, your may be different ,just try this.

I Followed these steps, i had issues trying to dual boot two fedora installs but i’m posting this here because this post is one of the top search results on Google:

Delete the EFI partition. Fedora was the only OS in my drive anyways and I had messed with the EFI partition. I then recreated the EFI partition by doing an Ubuntu install.

Boot into a fedora live session using a USB stick. Open the terminal.

Then I followed the steps in your comment:

  1. su
  2. mount -t btrfs -o subvol=root,compress=zstd:1 UUID=<uuid of btrfs partition> /mnt
  3. for fs in proc sys run dev ; do mount -o bind /$fs /mnt/$fs ; done
  4. chroot /mnt
  5. mount -a
  6. I had an error in the fstab in my fedora install with the wrong UUID for the EFI partition so I edited the UUID in the fstab in my fedora install manually. I got the UUID from the gnome Disks app in the fedora live session, selecting my disk and then selecting the EFI partition
  7. mount -a again

Then I followed the steps here:

I have an EFI system.