You are not logged in.

#1 2024-01-04 12:50:35

squareofn
Member
Registered: 2024-01-04
Posts: 6

Grub menu is not showed after installation

I'm trying to install Arch Linux for the first time in dual boot with Windows, but faced with the small problem. I'm trying to setup GRUB but when I start the PC, Windows loads without the GRUB menu ever displayed. I tried some solutions but none of them help me.
Here's what I did:

1. I mounted root partition
   

 mount /dev/nvme0n1p6 /mnt 

2. I mounted EFI partition
   

mount /dev/nvme0n1p2 /mnt/efi

3. I logged in to the system
   

 arch-root /mnt 

4. I installed grub
   

 grub-install --target=x86_64-efi --efi-directory=/efi/ --bootloader-id=GRUB 

5. And generated grub config
   

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

So here is what installer generated and here's nothing about windows:

#
# 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 btrfs
search --no-floppy --fs-uuid --set=root e5bb549c-2301-4d33-a4ca-f7be8fa28d1a
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
fi
terminal_input console
terminal_output gfxterm
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-e5bb549c-2301-4d33-a4ca-f7be8fa28d1a' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt
	insmod btrfs
	search --no-floppy --fs-uuid --set=root e5bb549c-2301-4d33-a4ca-f7be8fa28d1a
	echo	'Loading Linux linux ...'
	linux	/boot/vmlinuz-linux root=UUID=e5bb549c-2301-4d33-a4ca-f7be8fa28d1a rw  loglevel=3 quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-e5bb549c-2301-4d33-a4ca-f7be8fa28d1a' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-e5bb549c-2301-4d33-a4ca-f7be8fa28d1a' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod btrfs
		search --no-floppy --fs-uuid --set=root e5bb549c-2301-4d33-a4ca-f7be8fa28d1a
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=e5bb549c-2301-4d33-a4ca-f7be8fa28d1a rw  loglevel=3 quiet
		echo	'Loading initial ramdisk ...'
		initrd	/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-e5bb549c-2301-4d33-a4ca-f7be8fa28d1a' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt
		insmod btrfs
		search --no-floppy --fs-uuid --set=root e5bb549c-2301-4d33-a4ca-f7be8fa28d1a
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=e5bb549c-2301-4d33-a4ca-f7be8fa28d1a rw  loglevel=3 quiet
		echo	'Loading initial ramdisk ...'
		initrd	/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/25_bli ###
if [ "$grub_platform" = "efi" ]; then
  insmod bli
fi
### END /etc/grub.d/25_bli ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
if [ "$grub_platform" = "efi" ]; then
	fwsetup --is-supported
	if [ "$?" = 0 ]; then
		menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
			fwsetup
		}
	fi
fi
### 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 ###

Then I also tried to uncomment line in /etc/default/grub

GRUB_DISABLE_OS_PROBER=false 

Did the same things but it didn't detect Windows anyway. Here's the message I received after generating GRUB config:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  initramfs-linux-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Adding boot menu entry for UEFI Firmware Settings ...
done

But result is the same.

Also, here's all my partitions:

Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1       2048    1023999    1021952   499M Windows recovery environment
/dev/nvme0n1p2    1024000    1228799     204800   100M EFI System
/dev/nvme0n1p3    1228800    1261567      32768    16M Microsoft reserved
/dev/nvme0n1p4    1261568 1409193983 1407932416 671.4G Microsoft basic data
/dev/nvme0n1p5 1952376832 1953521663    1144832   559M Windows recovery environment
/dev/nvme0n1p6 1409193984 1948162047  538968064   257G Linux filesystem
/dev/nvme0n1p7 1948162048 1952376831    4214784     2G Linux swap

Moreover, I don't know why but my uefi doesn't detect grub bootloader at all

Here's the result of efibootmgr command

BootCurrent: 0005
Timeout: 1 seconds
BootOrder: 0005,0004,0001
Boot0001* Windows Boot Manager	HD(2,GPT,da178692-f29b-4f3d-acbf-e3259f35817a,0xfa000,0x32000)/File(\EFI\GRUB\GRUBX64.EFI)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000061000100000010000000040000007fff0400
Boot0004* Windows Boot Manager	HD(2,GPT,da178692-f29b-4f3d-acbf-e3259f35817a,0xfa000,0x32000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)0000424f
Boot0005* UEFI:  USB DISK 2.0 PMAP, Partition 1	PciRoot(0x0)/Pci(0x1,0x2)/Pci(0x0,0x0)/USB(6,0)/HD(1,MBR,0x36f5a9fc,0x800,0x39d1800)0000424f

I tried to copy data from grubx64.efi  to bootx64.efi by

cp /efi/EFI/GRUB/grubx64.efi /efi/EFI/Microsoft/Boot/bootx64.efi

but it also was useless.
Then I told Windows bootloader to run grubx64.efi by

bcdedit /set "{bootmgr}" path "L:\EFI\grub\grubx64.efi"

and it didn't help me.
The last thing I tried to do is to use

 efibootmgr --create --disk /dev/nvme0n1 --loader /efi/EFI/GRUB/grubx64.efi --label "GRUB" --unicode

to create a grub bootloader. And it creates it successfully and add to to the first place. But after rebooting this bootloader disappears.

I know that this question can sound kinda stupid, but it the first time when I install arch so I really hope for your help. Thank you in advance!

Last edited by squareofn (2024-01-04 13:10:13)

Offline

#2 2024-01-04 12:57:40

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,744
Website

Re: Grub menu is not showed after installation

If you copied grubx64.efi over bootmgfw.efi then Windows shouldn't be able to boot at all. You didn't do that but copying it to bootx64.efi in the Windows folder won't do anything. Sorry for the noise but quote tags make things less readable.

That bcdedit command is wrong, the path should be given without reference to any Windows drive identifiers: https://wiki.archlinux.org/title/Unifie … boot_order EDIT: maybe I'm wrong, the boot entry has been added.

If the motherboard firmware doesn't keep added NVRAM entries the usual advice is to follow https://wiki.archlinux.org/title/GRUB#D … _boot_path.

Please replace the quote tags with code tags for the terminal output. I may have missed something. Good OP otherwise though.

EDIT2: use efibootmgr to place Boot0001 above Boot0004 in the boot order, that should get GRUB booting.

My post is really messy now, sorry about that.

Last edited by Head_on_a_Stick (2024-01-04 13:03:46)

Offline

#3 2024-01-04 13:29:25

squareofn
Member
Registered: 2024-01-04
Posts: 6

Re: Grub menu is not showed after installation

@Head_on_a_Stick Thank you for answer.

Head_on_a_Stick wrote:

That bcdedit command is wrong, the path should be given without reference to any Windows drive identifiers: https://wiki.archlinux.org/title/Unifie … boot_order

I tried to do this way to but it also didn't help.

Head_on_a_Stick wrote:

If the motherboard firmware doesn't keep added NVRAM entries the usual advice is to follow https://wiki.archlinux.org/title/GRUB#D … _boot_path

I also tried to follow this article by doing these commands:

mv /efi/EFI/GRUB/ /efi/EFI/Boot/
mv /efi/EFI/Boot/GRUB/grubx64.efi /efi/EFI/Boot/bootx64.efi

But the result is the same: windows boots without grub and there is not other option in bios except windows boot loader

Offline

#4 2024-01-04 13:33:29

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,744
Website

Re: Grub menu is not showed after installation

Can you select the drive directly in the firmware boot menu? That should launch bootx64.efi.

Are there two boot options for "Windows Boot Manager"? One should start bootmgfw.efi and the other should point to grubx64.efi.

Last edited by Head_on_a_Stick (2024-01-04 13:34:14)

Offline

#5 2024-01-04 13:44:38

squareofn
Member
Registered: 2024-01-04
Posts: 6

Re: Grub menu is not showed after installation

Head_on_a_Stick wrote:

Are there two boot options for "Windows Boot Manager"? One should start bootmgfw.efi and the other should point to grubx64.efi.

Well, actually, I don't know what happened, but one of the windows boot loader just disappeared and now efibootmgr output looks like this:

BootCurrent: 0005
Timeout: 1 seconds
BootOrder: 0005, 0004
Boot0004* Windows Boot Manager	HD(2,GPT,da178692-f29b-4f3d-acbf-e3259f35817a,0xfa000,0x32000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)0000424f
Boot0005* UEFI:  USB DISK 2.0 PMAP, Partition 1	PciRoot(0x0)/Pci(0x1,0x2)/Pci(0x0,0x0)/USB(6,0)/HD(1,MBR,0x36f5a9fc,0x800,0x39d1800)0000424f

Offline

#6 2024-01-04 13:49:59

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,744
Website

Re: Grub menu is not showed after installation

Your motherboard's firmware is defective, which is unfortunately common.

Is there an option to select the drive directly, as you do for the USB stick? I won't ask again :-)

Offline

#7 2024-01-04 13:52:58

squareofn
Member
Registered: 2024-01-04
Posts: 6

Re: Grub menu is not showed after installation

Yes, there is. But when I select it the windows starts. I guess I do something wrong.

Last edited by squareofn (2024-01-04 13:56:11)

Offline

#8 2024-01-04 13:57:12

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,744
Website

Re: Grub menu is not showed after installation

The ultimate hack for this problem is to copy Windows' bootmgfw.efi to another location on the EFI system partition then copy grubx64.efi to /EFI/Microsoft/Boot/bootmgfw.efi and create a custom GRUB menuentry for the original copy of bootmgfw.efi but that really is a last resort and it will be overridden every time Windows has an update.

More here: https://www.rodsbooks.com/efi-bootloade … ive-naming

Offline

#9 2024-01-04 14:02:20

squareofn
Member
Registered: 2024-01-04
Posts: 6

Re: Grub menu is not showed after installation

Alright, thanks, I'll try it now smile

Offline

#10 2024-01-04 14:10:34

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,744
Website

Re: Grub menu is not showed after installation

This stanza in /boot/grub/custom.cfg should start the copy of Windows' bootmgfw.efi:

menuentry 'Windows' {
   search --fs-uuid --set=root $uuid
   chainloader /path/to/copy/of/bootmgfw.efi
}

Use the correct path relative to the EFI system partition (ie, without the leading /efi/) and replace $uuid with the actual filesystem UUID of the EFI system partition, which can be found with

lsblk -no uuid /dev/nvme0n1p2

Last edited by Head_on_a_Stick (2024-01-04 14:12:21)

Offline

#11 2024-01-04 15:13:49

squareofn
Member
Registered: 2024-01-04
Posts: 6

Re: Grub menu is not showed after installation

Well, it also didn't help me sad First thing, lsblk command didn't print me anything, so I used blkid command.
Here, what I wrote in custom.cfg:

manuentry 'Windows' {
	search --fs-uuid --set=root 0CF4-2478
	chainloader /EFI/Microsoft/Boot/bootmgfw.efi
} 

Offline

#12 2024-01-04 15:43:58

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,744
Website

Re: Grub menu is not showed after installation

My original post had "o" instead of "0" in the lsblk command, sorry about that, I really can't type for shit.

What does "didn't help me" mean, exactly? Please describe the current booting situation in full.

And why have you used the original path to bootmgfw.efi in custom.cfg? Did you copy the Windows file somewhere else?

Offline

Board footer

Powered by FluxBB