0

I have this menu starting my laptop. As you can see, I have multiple entries for CentOS 8. But, I want to set like default, my Windows Boot Manager (on /dev/nvme01p1) entry…

I was thinking in efibootmgr.

Reading this article https://www.lifewire.com/change-the-efi-boot-order-efibootmgr-4028027 and this article https://www.linuxbabe.com/command-line/how-to-use-linux-efibootmgr-examples and https://www.runscripts.com/support/guides/tools/multiboot-usb/dual-booting-repair

ESP (EFI System Partition)

Is it possible to keep the menu entries, changing to Windows with efibootmgr?

enter image description here

Here my efibootmgr -v:

[root@centos /]# efibootmgr -v
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0000,0017,0001,0012,0014,0015,0016,0018,0019,001A
Boot0000* CentOS Linux  HD(6,GPT,5291c15b-2f5c-42a0-b3e3-2c69f27b801b,0x1b7ec800,0x200000)/File(\EFI\centos\shimx64.efi)
Boot0001* Windows Boot Manager  HD(1,GPT,31ebd6ef-ec98-42c7-a57b-7855c2c9a1f3,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...7................
Boot0010  Setup FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9)
Boot0011  Boot Menu FvFile(86488440-41bb-42c7-93ac-450fbf7766bf)
Boot0012* NVMe: SKHynix_HFM512GDHTNI-87A0B              PciRoot(0x0)/Pci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,AC-E4-2E-00-0A-25-B5-D3)....2.LN........
Boot0013  UEFI Diagnostics  FvFile(f8397897-e203-4a62-b977-9e7e5d94d91b)
Boot0014* ATA HDD:  VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f604)
Boot0015* ATA HDD:  VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f605)
Boot0016* ATAPI CD: VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a354)
Boot0017* USB HDD:  VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,33e821aaaf33bc4789bd419f88c50803)
Boot0018* PCI LAN:  VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)
Boot0019* USB FDD:  VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,6ff015a28830b543a8b8641009461e49)
Boot001A* USB CD:   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55)
[root@centos /]#

enter image description here

And the content of my /etc/default/grub file

[root@centos /]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto resume=UUID=42640b78-ce32-403c-8705-8c12e2d02855 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
[root@centos /]#

enter image description here

[root@centos /]# grep /efi /proc/mounts
efivarfs /sys/firmware/efi/efivars efivarfs rw,nosuid,nodev,noexec,relatime 0 0
/dev/nvme0n1p6 /boot/efi vfat rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro 0 0
[root@centos /]# 
[root@centos /]# readlink /etc/grub2-efi.cfg
../boot/efi/EFI/centos/grub.cfg
[root@centos /]# 
[root@centos /]# readlink /etc/grub2.cfg
../boot/grub2/grub.cfg
[root@centos /]# 
[root@centos /]# sudo grub2-mkconfig -o "$(readlink /etc/grub2-efi.cfg)"
Generating grub configuration file ...
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
[root@centos /]# sudo grub2-mkconfig -o "$(readlink /etc/grub2.cfg)"
Generating grub configuration file ...
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
[root@centos /]#

enter image description here

1 Answers1

1

You can use efibootmgr to also set the time it waits for confirmation.

However, what you're seeing is probably not the EFI loader itself, but the GRUB bootloader, which was loaded by your UEFI firmware, and will load the Linux kernel.

You can configure that to your heart's delight by editing /etc/default/grub. The file is fairly self-explanatory; I use GRUB_TIMEOUT=2 and GRUB_DEFAULT=saved.

Then run (make sure your EFI partition is mounted under /boot/efi, e.g. via grep /efi /proc/mounts):

sudo grub2-mkconfig -o "$(readlink /etc/grub2-efi.cfg)"

If that changes nothing, you're probably not actually booting via EFI and need to do

sudo grub2-mkconfig -o "$(readlink /etc/grub2.cfg)"

instead.

  • Apparently with GRUB_DEFAULT=saved it should mark Windows as the next boot. Unfortunately I have not been able to understand And I still can't choose Windows as the default entry. –  Jun 13 '21 at 16:52
  • Look in /boot/loader/entries/ – jsbillings Jun 14 '21 at 00:45