You are not logged in.
This problem is getting kind of repetitive but I couldn't actually find a solution to my specific problem. I have installed Arch along side Windows and I have made a FAT32 partition which host Grub and Windows boot loader. The problem is that when I run efibootmgr, the Windows shows up but when I run os-prober, there is nothing and hence my grub can't detect Windows boot loader. I can boot into Windows only if I put my BIOS priority to Windows. I have checked and I have Windows installed with UEFI. Does anybody know what could be the cause of this problem?
Here are some outputs.
For efibootmgr I get:
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 2001,0001,0003,2002,2003
Boot0001* Arch_Linux HD(1,GPT,576e6cae-b67b-584b-886d-aa127636a7cc,0x800,0x82000)/File(\EFI\Arch_Linux\grubx64.efi)
Boot0003* Windows Boot Manager HD(1,GPT,576e6cae-b67b-584b-886d-aa127636a7cc,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
Boot2001* EFI USB Device RC
Boot2002* EFI DVD/CDROM RC
Boot2003* EFI Network RC
For lsblk I get:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 953.9G 0 disk
├─nvme0n1p1 259:1 0 260M 0 part /boot/efi
├─nvme0n1p2 259:2 0 300.6G 0 part /run/media/mohammadreza/Windows
├─nvme0n1p3 259:3 0 251G 0 part /run/media/mohammadreza/Partition1
├─nvme0n1p4 259:4 0 151G 0 part /run/media/mohammadreza/Partition2
├─nvme0n1p5 259:5 0 150G 0 part /
├─nvme0n1p6 259:6 0 93G 0 part /home
└─nvme0n1p7 259:7 0 8G 0 part [SWAP]
Offline
Did you enable os-prober in /etc/default/grub? See also https://wiki.archlinux.org/title/GRUB#MS_Windows
If you can't get os-prober working then see https://wiki.archlinux.org/title/GRUB#W … I/GPT_mode for a stanza that can be added to either /boot/grub/custom.cfg or /etc/grub.d/40_custom (the latter location needs grub-mkconfig for it to be added to the menu).
Para todos todo, para nosotros nada
Offline
os-prober was enabled by default in /etc/default/grub. I have tried to add manually the Windows boot loader to grub but it does not work. Could it be related to some kind of mount issues?
Offline
How exactly did you attempt to manually add the Windows menuentry? Please post the configuration file that was added or edited and also the full content of /boot/grub/grub.cfg,
Please also share the output of
# blkid
Para todos todo, para nosotros nada
Offline
Here is the output of
blkid
/dev/nvme0n1p7: UUID="522fb482-ee75-40c8-9819-d0078a04c71f" TYPE="swap" PARTUUID="443d2b6c-d02d-564b-ac4c-38062f147832"
/dev/nvme0n1p5: UUID="fc20a978-2012-456d-8a38-debbddc18320" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="260fd788-e554-554d-9659-cec33efe8f16"
/dev/nvme0n1p3: LABEL="Partition1" BLOCK_SIZE="512" UUID="A4EC3CE6EC3CB500" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="87f2f298-8c1e-41b8-9d28-3d65efa000cb"
/dev/nvme0n1p1: LABEL_FATBOOT="NO_LABEL" LABEL="NO_LABEL" UUID="E23D-EDCC" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="576e6cae-b67b-584b-886d-aa127636a7cc"
/dev/nvme0n1p6: UUID="0e15e6f2-5842-4f47-a24e-b04c51f1f07e" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="8e420e0c-19e6-6048-a0f8-0d79e82fa411"
/dev/nvme0n1p4: LABEL="Partition2" BLOCK_SIZE="512" UUID="A0507F78507F53CE" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="756fa30e-9fa5-42c1-88f5-4843d5e30960"
/dev/nvme0n1p2: LABEL="Windows" BLOCK_SIZE="512" UUID="9E9044E49044C50D" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="6e3de74a-3ed0-4bcb-a711-acf4adb4f13b"
To add the entry menu for windows, I put blew code into
/etc/grub.d/40_custom
:
#!/bin/sh
exec tail -n +3 $0
# 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 [ "${grub_platform}" == "efi" ]; then
menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {
insmod part_gpt
insmod fat
insmod chain
search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid
chainloader /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
}
fi
and after this i ran the command
grub-mkconfig
and here is the content of my
/boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi
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}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root fc20a978-2012-456d-8a38-debbddc18320
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_input console
terminal_output gfxterm
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root fc20a978-2012-456d-8a38-debbddc18320
insmod gfxmenu
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_32.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_sans_12.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_sans_14.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_sans_16.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_sans_24.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/dejavu_sans_48.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/terminus-12.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/terminus-14.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/terminus-16.pf2
loadfont ($root)/usr/share/grub/themes/Vimix/terminus-18.pf2
insmod jpeg
insmod png
set theme=($root)/usr/share/grub/themes/Vimix/theme.txt
export theme
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=5
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-fc20a978-2012-456d-8a38-debbddc18320' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root fc20a978-2012-456d-8a38-debbddc18320
echo 'Loading Linux linux ...'
linux /boot/vmlinuz-linux root=UUID=fc20a978-2012-456d-8a38-debbddc18320 rw quiet resume=UUID=522fb482-ee75-40c8-9819-d0078a04c71f loglevel=3 audit=0
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-fc20a978-2012-456d-8a38-debbddc18320' {
menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-fc20a978-2012-456d-8a38-debbddc18320' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root fc20a978-2012-456d-8a38-debbddc18320
echo 'Loading Linux linux ...'
linux /boot/vmlinuz-linux root=UUID=fc20a978-2012-456d-8a38-debbddc18320 rw quiet resume=UUID=522fb482-ee75-40c8-9819-d0078a04c71f loglevel=3 audit=0
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-linux.img
}
menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-fc20a978-2012-456d-8a38-debbddc18320' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root fc20a978-2012-456d-8a38-debbddc18320
echo 'Loading Linux linux ...'
linux /boot/vmlinuz-linux root=UUID=fc20a978-2012-456d-8a38-debbddc18320 rw quiet resume=UUID=522fb482-ee75-40c8-9819-d0078a04c71f loglevel=3 audit=0
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-linux-fallback.img
}
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/30_uefi-firmware ###
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
### END /etc/grub.d/30_uefi-firmware ###
### 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.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###
Offline
You need to actually write out the entry to standard out e.g.
echo 'menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {
insmod part_gpt
insmod fat
insmod chain
search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}'
Note that i dropped the /boot/efi from the chainloader line because you need to write paths relative to the ESP root.
Also grub-mkconfig without the -o argument will write to stdout, make sure you properly write the correct config file as well.
Online
I did this and the problem is that when I click on the Windows entry in grub menu, it says that this path does not exist. Why this is happening? Because I can enter to Windows if I just change boot orders in my BIOS. Is this happening because the Windows boot loader is not correctly put into the correct path ?
Here is the content of my /boot/ folder:
drwx------ - root 1 Jan 1970 efi
drwxr-xr-x - root 17 Feb 15:51 grub
.rw-r--r-- 51k root 10 Feb 14:22 amd-ucode.img
.rw------- 24M root 16 Feb 22:07 initramfs-linux-fallback.img
.rw------- 6.8M root 16 Feb 22:06 initramfs-linux.img
.rw-r--r-- 4.7M root 8 Feb 22:07 intel-ucode.img
.rw-r--r-- 10M root 16 Feb 22:05 vmlinuz-linux
Last edited by mohammadreza99a (2022-02-17 14:59:10)
Offline
You need to actually write out the entry to standard out.
No, the stanza can be added directly, as stated on the linked ArchWiki page.
when I click on the Windows entry in grub menu, it says that this path does not exist.
Please share the updated /boot/grub/grub.cfg that contains the Windows entry.
Did you replace $hints_string & $fs_uuid with the actual, correct string & UUID? The ArchWiki page shows how to do that.
Is this happening because the Windows boot loader is not correctly put into the correct path ?
Check under /boot/efi and see if /EFI/Mircosoft/Boot/bootmgfw.efi is present. It should be there, the Arch & Windows NVRAM entries are both using the same PARTUUID (/dev/nvme0n1p1).
Para todos todo, para nosotros nada
Offline
@HoaS if you directly edit /boot/grub.cfg sure, if you intend /etc/grub.d/40_custom to be picked up by grub-mkconfig you'll definitely need to echo out the intended text somewhere. But still yes, the correct replacement variables have to be replaced anyway.
Online
if you intend /etc/grub.d/40_custom to be picked up by grub-mkconfig you'll definitely need to echo out the intended text somewhere
Nope:
archie:~$ cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# 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.
menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {
insmod part_gpt
insmod fat
insmod chain
search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
archie:~$ doas grub-mkconfig 2>/dev/null | grep -A6 Vista
menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {
insmod part_gpt
insmod fat
insmod chain
search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
archie:~$
Even 40_custom disagrees with you
Para todos todo, para nosotros nada
Offline
I stand corrected
Online
Did you replace $hints_string & $fs_uuid with the actual, correct string & UUID? The ArchWiki page shows how to do that.
While running grub-probe --target=hints_string /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi in order to get$hints_string, I get this error:
grub-probe: warning: unknown device type nvme0n1.
For $fs_uuid I get a response.
I mean this is just a warning but it is weird that there is not any output.
Offline
Head_on_a_Stick wrote:Did you replace $hints_string & $fs_uuid with the actual, correct string & UUID? The ArchWiki page shows how to do that.
While running grub-probe --target=hints_string /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi in order to get$hints_string, I get this error:
grub-probe: warning: unknown device type nvme0n1.
So I have a fix for this issus. What i did was to copy the output in the wiki and I changed hd0 to nvme0n1 and I can finally successfully load into Windows from Grub. But the main issus always remains. The fact that os-prober is not able to find Windows loader.
Here is my /etc/grub.d/40_custom for those that might have the same issus:
#!/bin/sh
exec tail -n +3 $0
# 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 [ "${grub_platform}" == "efi" ]; then
menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {
insmod part_gpt
insmod fat
insmod chain
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=nvme0n1,gpt1 --hint-baremetal=ahci0,gpt1 E23D-EDCC
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
fi
Thank you both for helping me.
Last edited by mohammadreza99a (2022-02-17 20:02:58)
Offline
The --hint options are only needed if you have multiple partitions with the same filesystem UUID.
All I have ever needed is
menuentry 'Windows' {
search.fs_uuid $uuid
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
search.fs_uuid is an alias for search --fs-uuid and the root variable is the presumed default.
Para todos todo, para nosotros nada
Offline