Selecting windows in grub returns to grub again

I installed fedora 37 together with windows 10, but at the time of the grub it took me directly to fedora and windows did not appear in the grub.

I tried several methods to solve this problem where I followed the solution in this question.
Reinstalled Fedora, and now GRUB menu doesn’t show up, so can’t access Windows dual-boot
It did not work
I also followed this documentation
How to repair the EFI bootloader on a GPT Hard Drive for Windows 7, 8, 8.1 and 10 on your Dell personal computer

the same problem kept occurring until I ran

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

And it showed me that windows had been added and on reboot it shows fedora next to windows in the grub, but when I select windows it returns me back to the grub.
I don’t know what else to do really, I have read something about menuentry, but I don’t understand it very well, I don’t have a high knowledge in linux.

A lot of information is needed in order to diagnose that. Get some of that information using commands described below and use the forum’s Preformated text (Ctrl-E) button when pasting the blocks of information into this thread.

I suggest installing the following package (generally nice to have, plus it has the lsblk command, which is a good way to get some of the info to post:
sudo dnf install util-linux

post the output from
lsblk -o NAME,FSTYPE,SIZE,LABEL,FSSIZE,FSUSE%,MOUNTPOINTS,uuid

post the output from
sudo more /boot/loader/entries/* | cat

Seeing those will likely trigger requests for related info. But before seeing those, I don’t have a good guess at what other info we would need to see.

output from
lsblk -o NAME,FSTYPE,SIZE,LABEL,FSSIZE,FSUSE%,MOUNTPOINTS,uuid


NAME        FSTYPE   SIZE LABEL                 FSSIZE FSUSE% MOUNTPOINTS UUID
zram0                  8G                                     [SWAP]      
nvme0n1            465.8G                                                 
├─nvme0n1p1 vfat     100M                                                 4C64-4F29
├─nvme0n1p2           16M                                                 
├─nvme0n1p3 ntfs   315.1G                                                 9034D84134D82BCA
├─nvme0n1p4 ntfs     543M                                                 B0EE2CB0EE2C7130
├─nvme0n1p5            1M                                                 
├─nvme0n1p6 ext4       1G                       973.4M    21% /boot       37c43b46-cb6e-46bd-ab5c-cdb02011dadc
└─nvme0n1p7 btrfs    149G fedora_localhost-live   149G     7% /home       c77f1125-46f0-4736-8e9f-2f3a9bc2ce2c

output from
sudo more /boot/loader/entries/* | cat

::::::::::::::
/boot/loader/entries/3b6e9b4b49d24811bdbc776d663daa33-0-rescue.conf
::::::::::::::
title Fedora Linux (0-rescue-3b6e9b4b49d24811bdbc776d663daa33) 37 (Workstation Edition)
version 0-rescue-3b6e9b4b49d24811bdbc776d663daa33
linux /vmlinuz-0-rescue-3b6e9b4b49d24811bdbc776d663daa33
initrd /initramfs-0-rescue-3b6e9b4b49d24811bdbc776d663daa33.img
options root=UUID=c77f1125-46f0-4736-8e9f-2f3a9bc2ce2c ro rootflags=subvol=root rhgb quiet 
grub_users $grub_users
grub_arg --unrestricted
grub_class fedora
::::::::::::::
/boot/loader/entries/3b6e9b4b49d24811bdbc776d663daa33-6.0.7-301.fc37.x86_64.conf
::::::::::::::
title Fedora Linux (6.0.7-301.fc37.x86_64) 37 (Workstation Edition)
version 6.0.7-301.fc37.x86_64
linux /vmlinuz-6.0.7-301.fc37.x86_64
initrd /initramfs-6.0.7-301.fc37.x86_64.img
options root=UUID=c77f1125-46f0-4736-8e9f-2f3a9bc2ce2c ro rootflags=subvol=root rhgb quiet 
grub_users $grub_users
grub_arg --unrestricted
grub_class fedora

I should have included:
sudo grep -A 12 menuentry /boot/grub2/grub.cfg

It may also be necessary to mount nvme0n1p1 at some mount point and show the contents. Do you know how to do such things?

I assume either the 315Gb partition or the 0.5Gb partition is your original windows C drive. Do you know which?

Ah, no problem

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
--
menuentry 'Fedora Linux (6.0.7-301.fc37.x86_64) 37 (Workstation Edition)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-6.0.7-301.fc37.x86_64-advanced-c77f1125-46f0-4736-8e9f-2f3a9bc2ce2c' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt6'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint='hd0,gpt6'  37c43b46-cb6e-46bd-ab5c-cdb02011dadc
	else
	  search --no-floppy --fs-uuid --set=root 37c43b46-cb6e-46bd-ab5c-cdb02011dadc
	fi
	echo	'Loading Linux 6.0.7-301.fc37.x86_64 ...'
--
menuentry 'Fedora Linux (0-rescue-3b6e9b4b49d24811bdbc776d663daa33) 37 (Workstation Edition)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-3b6e9b4b49d24811bdbc776d663daa33-advanced-c77f1125-46f0-4736-8e9f-2f3a9bc2ce2c' {
	load_video
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt6'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint='hd0,gpt6'  37c43b46-cb6e-46bd-ab5c-cdb02011dadc
	else
	  search --no-floppy --fs-uuid --set=root 37c43b46-cb6e-46bd-ab5c-cdb02011dadc
	fi
	echo	'Loading Linux 0-rescue-3b6e9b4b49d24811bdbc776d663daa33 ...'
	linux	/vmlinuz-0-rescue-3b6e9b4b49d24811bdbc776d663daa33 root=UUID=c77f1125-46f0-4736-8e9f-2f3a9bc2ce2c ro rootflags=subvol=root rhgb quiet 
--
menuentry 'Windows 10 (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id_option 'osprober-chain-4C64-4F29' {
	insmod part_gpt
	insmod fat
	set root='hd0,gpt1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint='hd0,gpt1'  4C64-4F29
	else
	  search --no-floppy --fs-uuid --set=root 4C64-4F29
	fi
	drivemap -s (hd0) ${root}
	chainloader +1
}
# Other OS found, undo autohiding of menu unless menu_auto_hide=2
--
	menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
		fwsetup
	}
fi
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/35_fwupd ###
### END /etc/grub.d/35_fwupd ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

If I’m reading that correctly, your menuentry for booting Windows is doing a legacy (not efi) boot of the first partition of your hard drive, in order to give control to the Windows bootloader.

By the symptoms you described, that isn’t working. But so far I’m just guessing at why that might not work.

Do you know whether your bios supports both efi and legacy? Did you change that choice when installing linux? Do you know what is selected for that in your bios now?

i have an asus prime b550m-k and i understand that it is uefi.
when I installed fedora I selected automatic partitioning and the 315Gb partition is the original windows partition.
I was able to mount the nvme0n1p1 partition and it shows the following directories Boot bootmgr BOOTNXT EFI. in the EFI directory has these directories Boot, Microsoft and Recovery

I should have been clearer: efi vs. legacy are settings for boot in your bios.

The fact that it wasn’t clear implies that you didn’t change it when installing linux.

I hope some expert jumps into this thread, because I’m not quite an expert on this stuff. But meanwhile I’ll try a bit more (helps me learn some things I want to know).

My best guess is that Windows was installed on your system to only be bootable efi, not legacy. So the the correct answer is to modify the contents of /boot/grub2/grub.cfg so the transfer of control from grub to the Windows bootloader is in efi mode.

I expect there is some standard command to rebuild that file that way. But I don’t know that side of it at all. I think I can find the right commands that could be manually edited into that file (or the file that is source for building it). But I’d like to be more sure it should be done for efi. That only makes sense if the bios boot was in efi mode before you installed linux (so if you never changed that, is still in efi mode).

I just googled this issue and was reminded of the command
file /sys/firmware/efi
If the result says directory then the linux you are running was booted in efi (not legacy) mode.

I was checking my bios and I see the following:
In boot device control is in UEFI and Legacy OPROM and in boot from storage devices is Legacy Only.
so I guess my bios is currently set to legacy?
I just ran the file /sys/firmware/efi command and the result says cannot open /sys/firmware/efi (No such file or directory) so, is legacy

Yes, all the aspects of boot seem to be consistently in legacy mode and the grub.cfg file looks correct for chainloading windows in that mode.

So I have neither a explanation for why it doesn’t work, nor an easy way to fix it.

Those instructions require you to have some bootable Windows recovery media. Do you?

Those instructions assume you will be booting in efi mode, not legacy and might be what broke your windows boot loader to not be bootable in legacy mode.

Do you recall which steps you followed from those instructions? There are a lot of options there and I can’t guess what you actually did.

Assuming you followed those instructions and they went all the way to making windows correct for efi, one choice would be to continue in that direction.

One test that might work, is to go into the bios setup and change that from legacy boot to uefi, then go into the bios boot menu (typically some key to press when booting) and see if the bios boot menu can launch windows correctly (implying it is fully set up for uefi boot).

If that all works, Fedora could also be fixed for uefi, or might just work, or might be easier to just reinstall once the bios is set for uefi boot.

Gents:

New to this forum, but not new to multi-booting linux systems with OSX . . . and numerous issues with keeping grub working properly going back to '07.

In my experience grub doesn’t “recognize” OSX and OSX doesn’t recognize linux or grub, so my recommend would be to simply use grub to boot Fedora and use the BIOS boot keystroke to boot windows . . . easy-peasy.

e.e.p.

I would think from what has been posted that windows was booting UEFI.

And from that it appears fedora was installed in legacy (MBR) boot mode. Grub cannot boot fedora in legacy mode and windows in uefi mode.

The only fix I know is to remove the fedora install by booting to the live media and using gparted or gdisk to delete the fedora partitions and leave that space unallocated. Do not touch /dev/sda1 since that is the efi partition.

Now the simplest fix for the reinstall is, before you reinstall, set bios to UEFI boot only so it will only boot and install fedora in UEFI mode. If you fail to do that then when you are selecting the USB device to boot for doing the install there should be the same device displayed twice. One will be legacy boot and one will be marked as UEFI. Selecting the one marked uefi will boot in uefi mode. The install is performed in the mode used to boot the live media (which may have caused the errors experienced).

1 Like

Nowhere in this topic has OSX been mentioned (except by you), nor is it a factor here.

Yes. I’m using that as an example of “non-linux” system, that may show as listed in grub menu, but clicking on it returns to grub menu, as per the title of this thread.

That would imply Jonathan changed that bios boot setting from uefi to legacy. I’m pretty sure he would know and have said by now if that happened.

So windows might now be configured to boot UEFI, due to actions taken since the last time windows was booted. But it wasn’t previously booting uefi.

I think that makes fixing this potentially harder, unless the configuration of Windows to boot in uefi has been tested.

That is why I suggested switching the bios to uefi boot, then verifying that windows does boot that way, and only after confirming that, is removing and reinstalling Fedora (with the bios still set to uefi boot) the least confusing path forward.

As for “how” (as opposed to “whether”) to remove and reinstall Fedora, your instructions are more likely to be right than any I might give.

In legacy mode the bios boot menu only selects between drives, not between partitions nor between OS’s. So that answer assumes everything is in uefi boot mode.
Once everything is in uefi boot mode, we think grub2 will be able to chain to the Windows bootloader. But if it doesn’t, the bios boot menu would then be a fallback choice to get to Windows.

1 Like

I tried the option to change the bios to efi, but still the same problem, on the other hand I also tried with the windows recovery media for legacy mode and I could not.
In the end I did the windows 10 installation again but with the bios in efi mode and then the fedora installation and now the dualboot works correctly.

Thank you very much for the help, now I know how to install a dualboot.

1 Like

Not true.
If the bios is set to CSM or similar that allows booting in either mode then the user can select the boot mode when booting from the bios boot menu, particularly with a hybrid boot image such as the fedora live image iso.

Congratulations.
It is always almost imperative that all OSes on the same system boot in the same mode. That can be gotten around if the user wants to use the bios boot menu, but is usually a pain.

Anyway, I am glad to hear that things worked out for you. :clap:

2 Likes