Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Modify Grub EFI file location with Multi-Boot OS
-
- Posts: 13
- Joined: 2019-06-07 03:16
Modify Grub EFI file location with Multi-Boot OS
Dear Debian Users,
Ever since I started using linux, I have had trouble getting the Grub Boot Loader to work. It is probably cause I don't understand how to configure it correctly.
With some searching I have found some helpful tools that have fixed problems I had, but I have had no success getting Grub to boot as default on an HP Pavillion X360 laptop.
What I am interested in doing is finding out how to change the default efi file used with the Grub Boot loader, and how to set it as default.
Almost every time I reboot my computer I have to hit the F9 key to change boot options and select the correct boot loader.
My configuration is as follows:
/dev/sda1 - EFI system partition
/dev/sda2 - Windows 10
/dev/sda3 - /dev/sda10 (Various linux distributions: Kali, Elementary, Debian, Manjaro, MX Linux, etc..)
I would like Debian as the default boot loader (/EFI/Debian/grubx64.efi) which is on /dev/sda8
How would I be able to set this and use Debian as the default Grub Boot Loader.
Thanks,
Simon
Ever since I started using linux, I have had trouble getting the Grub Boot Loader to work. It is probably cause I don't understand how to configure it correctly.
With some searching I have found some helpful tools that have fixed problems I had, but I have had no success getting Grub to boot as default on an HP Pavillion X360 laptop.
What I am interested in doing is finding out how to change the default efi file used with the Grub Boot loader, and how to set it as default.
Almost every time I reboot my computer I have to hit the F9 key to change boot options and select the correct boot loader.
My configuration is as follows:
/dev/sda1 - EFI system partition
/dev/sda2 - Windows 10
/dev/sda3 - /dev/sda10 (Various linux distributions: Kali, Elementary, Debian, Manjaro, MX Linux, etc..)
I would like Debian as the default boot loader (/EFI/Debian/grubx64.efi) which is on /dev/sda8
How would I be able to set this and use Debian as the default Grub Boot Loader.
Thanks,
Simon
-
- Posts: 1100
- Joined: 2016-01-07 12:25
- Has thanked: 5 times
- Been thanked: 16 times
Re: Modify Grub EFI file location with Multi-Boot OS
Have you looked at efibootmgr? it can be used to re-order your boot menu as well as add/delete/rename etc.
If you type efibootmgr -v it will give you the boot entries and also show you the boot order and you can use the boot entry numbers for re-ordering them to your preference.
If you type efibootmgr -v it will give you the boot entries and also show you the boot order and you can use the boot entry numbers for re-ordering them to your preference.
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: Modify Grub EFI file location with Multi-Boot OS
How ? By name ("debian"), by path (\EFI\debian\grubx64.efi)... ?LechonLover wrote:I have to hit the F9 key to change boot options and select the correct boot loader.
grubx64.efi must be in an EFI system partition. Do you mean that /dev/sda8 is an EFI system partition ?LechonLover wrote:I would like Debian as the default boot loader (/EFI/Debian/grubx64.efi) which is on /dev/sda8
FWIW, the few UEFI HP laptops I have used had a broken UEFI boot implementation. It just ignored any EFI boot entry created by efibootmgr and only booted using the fallback path bootloader at /EFI/boot/bootx64.efi. This is Windows fallback bootloader by default. If you have such broken UEFI firmware, you have to replace it with GRUB, for example with the following command :
Code: Select all
grub-install --removable
-
- Posts: 13
- Joined: 2019-06-07 03:16
Re: Modify Grub EFI file location with Multi-Boot OS
Thank you for the reply, and sorry for the confusion.
When I get into the boot menu, I select the volume label, then navigate through the efi directory and find debian folder, and then select the grubx64.efi which then loads the Debian Grub boot loader.
I have dev/sda1 as the main EFI partition which is used for both Windows and My Linux OS.
If I try the command you mentioned, grub-install --removable will my Windows OS on the same EFI partition be able to boot. Also, what exactly does that command do, I understand the first part, but what is --removable mean
Thanks.
When I get into the boot menu, I select the volume label, then navigate through the efi directory and find debian folder, and then select the grubx64.efi which then loads the Debian Grub boot loader.
I have dev/sda1 as the main EFI partition which is used for both Windows and My Linux OS.
If I try the command you mentioned, grub-install --removable will my Windows OS on the same EFI partition be able to boot. Also, what exactly does that command do, I understand the first part, but what is --removable mean
Thanks.
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: Modify Grub EFI file location with Multi-Boot OS
By default, grub-install installs GRUB's core image as EFI/debian/grubx64.efi in the EFI partition mounted on /boot/efi and registers a boot entry pointing to it in EFI variables. You can see EFI boot entries Boot#### with the command "efibootmgr" (-v for more details). Normally, a UEFI firmware tries to boot using these boot entries in the order defined by the BootOrder variable. If the "debian" entry is not first in order, then it will not boot by default. If Windows boot manager is first, the boot order can be changed with efibootmgr (see man page) or running grub-install without argument again.
With the --removable option, grub-install installs GRUB's core image as EFI/boot/bootx64.efi, which is called the "removable device path" and does not register an EFI boot entry. A UEFI firmware uses this special pathname as a fallback boot loader when no registered EFI boot entry can be used or for booting an external (removable) drive such as an installer or a live system.
During the installation of Windows, the Windows Boot Manager is installed both as EFI/Microsoft/boot/bootmgfw.efi with a registered boot entry and in the removable device path, so that it can boot if the EFI boot entry does not work.
Running grub-install with --removable will overwrite the existing EFI/boot/bootx64.efi installed by Windows and, hopefully, will make GRUB appear at boot. Windows should be present in GRUB's menu. You can make a backup copy of bootx64.efi for safety before running the command. Also you can still boot Windows using the F9 boot menu and selecting bootmgfw.efi.
There are other possible explanations that GRUB does not appear at boot :
- No EFI boot entry was created (check with efibootmgr)
- The debian boot entry is not first in the boot order (ditto)
- The boot loader path is hardcoded for Windows in the UEFI firmware (and the above will not help)
With the --removable option, grub-install installs GRUB's core image as EFI/boot/bootx64.efi, which is called the "removable device path" and does not register an EFI boot entry. A UEFI firmware uses this special pathname as a fallback boot loader when no registered EFI boot entry can be used or for booting an external (removable) drive such as an installer or a live system.
During the installation of Windows, the Windows Boot Manager is installed both as EFI/Microsoft/boot/bootmgfw.efi with a registered boot entry and in the removable device path, so that it can boot if the EFI boot entry does not work.
Running grub-install with --removable will overwrite the existing EFI/boot/bootx64.efi installed by Windows and, hopefully, will make GRUB appear at boot. Windows should be present in GRUB's menu. You can make a backup copy of bootx64.efi for safety before running the command. Also you can still boot Windows using the F9 boot menu and selecting bootmgfw.efi.
There are other possible explanations that GRUB does not appear at boot :
- No EFI boot entry was created (check with efibootmgr)
- The debian boot entry is not first in the boot order (ditto)
- The boot loader path is hardcoded for Windows in the UEFI firmware (and the above will not help)
-
- Posts: 13
- Joined: 2019-06-07 03:16
Re: Modify Grub EFI file location with Multi-Boot OS
Thanks for the details and explanations, it helps a lot. I was able to make a backup copy of my EFI directory before performing the command.
I checked efibootmgr, and by default debian is not loading first, so I will need to fix that, below is what it shows:
BootOrder: 0000,3000,2001,0003,2002,2004
Boot0000* ubuntu
Boot0003* Windows Boot Manager
Boot0004* kali
Boot0005* UEFI Hard drive
Boot0006* debian
Boot000A* Manjaro
Boot000B* Windows Boot Manager
Boot000C* MX18.3
Boot000D* feren
Boot2001* EFI USB Device
Boot3000* Internal Hard Disk or Solid State Disk
Also, when I ran the command "grub-install --removable" I received an error "bash: grub-install: command not found
I have received similar errors before, which had to do with my sources file not pulling from the correct repository, so I am not sure if this might be the case with this as well. I will check later and see what I can find.
I checked efibootmgr, and by default debian is not loading first, so I will need to fix that, below is what it shows:
BootOrder: 0000,3000,2001,0003,2002,2004
Boot0000* ubuntu
Boot0003* Windows Boot Manager
Boot0004* kali
Boot0005* UEFI Hard drive
Boot0006* debian
Boot000A* Manjaro
Boot000B* Windows Boot Manager
Boot000C* MX18.3
Boot000D* feren
Boot2001* EFI USB Device
Boot3000* Internal Hard Disk or Solid State Disk
Also, when I ran the command "grub-install --removable" I received an error "bash: grub-install: command not found
I have received similar errors before, which had to do with my sources file not pulling from the correct repository, so I am not sure if this might be the case with this as well. I will check later and see what I can find.
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: Modify Grub EFI file location with Multi-Boot OS
The "debian" boot entry number (0006) is not even present in the BootOrder. Conversely, the BoorOrder contain boot entry numbers which do not even exist...LechonLover wrote:I checked efibootmgr, and by default debian is not loading first
According to the BootOrder, Ubuntu should be loaded by default. Does this happen ?
You can try to add Debian to the boot order in first position with a command such as
Code: Select all
efibootmgr -o 0006,0000,3000,2001,0003,2002,2004
Did you run the command as root ? If you used "su" to get a root shell, did you add the "-", "-l" or "--login" option to set up a proper environment (with usual root $PATH) ?LechonLover wrote:Also, when I ran the command "grub-install --removable" I received an error "bash: grub-install: command not found
-
- Posts: 13
- Joined: 2019-06-07 03:16
Re: Modify Grub EFI file location with Multi-Boot OS
Thank you for the reply.
Debian is boot entry # 0006. Although Ubuntu is loaded by default, it does not load automatically, it bypasses it and goes straight to windows. The only way to get the grub menu is to press F9 to load the boot options, in which case it lists 2 boot managers, Ubuntu and Windows Boot Manager.
On another note, I was able to fix the "command not found error". I found another user who had the same issue and re-installing grub-pc did the trick "sudo apt-get install --reinstall grub-pc". After that I ran the command grub-install --removable
Then I changed the boot order to only boot debian (0006), which it did change. I then attempted to restart my computer, and still went straight to Windows Boot Manager. Below is a copy of my efibootmgr entries
simon@HP-X360:~$ efibootmgr
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001,3001,0000,2001,2002,2004
Boot0000* Windows Boot Manager
Boot0001* ubuntu
Boot0003* Windows Boot Manager
Boot0004* kali
Boot0005* UEFI Hard drive
Boot0006* debian
Boot000A* Manjaro
Boot000B* Windows Boot Manager
Boot000C* MX18.3
Boot000D* feren
Boot2001* EFI USB Device
Boot3001* Internal Hard Disk or Solid State Disk
simon@HP-X360:~$ sudo efibootmgr -o 6
[sudo] password for simon:
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0006
Boot0000* Windows Boot Manager
Boot0001* ubuntu
Boot0003* Windows Boot Manager
Boot0004* kali
Boot0005* UEFI Hard drive
Boot0006* debian
Boot000A* Manjaro
Boot000B* Windows Boot Manager
Boot000C* MX18.3
Boot000D* feren
Boot2001* EFI USB Device
Boot3001* Internal Hard Disk or Solid State Disk
One thing that confuses me is that is says boot current is 0001, which is Ubuntu, but I am running debian. Is there a way to change boot current to 0006. I have not found any topics on how to do that.
Thanks again for your assistance.
Debian is boot entry # 0006. Although Ubuntu is loaded by default, it does not load automatically, it bypasses it and goes straight to windows. The only way to get the grub menu is to press F9 to load the boot options, in which case it lists 2 boot managers, Ubuntu and Windows Boot Manager.
On another note, I was able to fix the "command not found error". I found another user who had the same issue and re-installing grub-pc did the trick "sudo apt-get install --reinstall grub-pc". After that I ran the command grub-install --removable
Then I changed the boot order to only boot debian (0006), which it did change. I then attempted to restart my computer, and still went straight to Windows Boot Manager. Below is a copy of my efibootmgr entries
simon@HP-X360:~$ efibootmgr
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001,3001,0000,2001,2002,2004
Boot0000* Windows Boot Manager
Boot0001* ubuntu
Boot0003* Windows Boot Manager
Boot0004* kali
Boot0005* UEFI Hard drive
Boot0006* debian
Boot000A* Manjaro
Boot000B* Windows Boot Manager
Boot000C* MX18.3
Boot000D* feren
Boot2001* EFI USB Device
Boot3001* Internal Hard Disk or Solid State Disk
simon@HP-X360:~$ sudo efibootmgr -o 6
[sudo] password for simon:
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0006
Boot0000* Windows Boot Manager
Boot0001* ubuntu
Boot0003* Windows Boot Manager
Boot0004* kali
Boot0005* UEFI Hard drive
Boot0006* debian
Boot000A* Manjaro
Boot000B* Windows Boot Manager
Boot000C* MX18.3
Boot000D* feren
Boot2001* EFI USB Device
Boot3001* Internal Hard Disk or Solid State Disk
One thing that confuses me is that is says boot current is 0001, which is Ubuntu, but I am running debian. Is there a way to change boot current to 0006. I have not found any topics on how to do that.
Thanks again for your assistance.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Modify Grub EFI file location with Multi-Boot OS
Instruct Windows to start Debian's bootloader by running this command from an Administrator prompt in PowerShell:LechonLover wrote:Then I changed the boot order to only boot debian (0006), which it did change. I then attempted to restart my computer, and still went straight to Windows Boot Manager.
Code: Select all
bcdedit /set "{bootmgr}" path "\EFI\debian\grubx64.efi"
deadbang
-
- Posts: 13
- Joined: 2019-06-07 03:16
Re: Modify Grub EFI file location with Multi-Boot OS
Sorry for the delay, but I have had a busy week, and didn't get around to trying your command until now, which unfortunately didn't work.
I loaded Windows, opened the powershell with "Run as Administrator" and entered the following command bcdedit /set "{bootmgr}" path "\EFI\debian\grubx64.efi" rAfter that I restarted the computer, and by default the Windows Boot Loader started.
I am wondering if maybe the only way to fix this is to install the Linux OS first, and then install Windows. So hopefully, by default the system will load Linux Boot loader first.
Previously I did use Boot-Repair in Ubuntu, which has helped me fix a lot of boot errors. I also used it to set the default boot device, which worked once, but when I restarted the system, it went back to using the Windows Boot Manager. Is it possible that during boot, their might be a system check that defaults to Windows no matter what you do?
I loaded Windows, opened the powershell with "Run as Administrator" and entered the following command bcdedit /set "{bootmgr}" path "\EFI\debian\grubx64.efi" rAfter that I restarted the computer, and by default the Windows Boot Loader started.
I am wondering if maybe the only way to fix this is to install the Linux OS first, and then install Windows. So hopefully, by default the system will load Linux Boot loader first.
Previously I did use Boot-Repair in Ubuntu, which has helped me fix a lot of boot errors. I also used it to set the default boot device, which worked once, but when I restarted the system, it went back to using the Windows Boot Manager. Is it possible that during boot, their might be a system check that defaults to Windows no matter what you do?
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: Modify Grub EFI file location with Multi-Boot OS
That was wrong.LechonLover wrote: I found another user who had the same issue and re-installing grub-pc did the trick "sudo apt-get install --reinstall grub-pc".
1) grub-install is part of grub2-common, not grub-pc.
2) You have an EFI boot setup so you must install grub-efi-amd64 (if 64-bit UEFI) or grub-efi-ia32 (if 32-bit UEFI, unlikely), instead of grub-pc which is meant for BIOS/legacy boot setup.
Can you post the output of
Code: Select all
efibootmgr -v
Here are possible causes I can think of that the UEFI firmware always boots Windows boot manager and the expected solutions :
- ignores EFI boot entries and uses the "removable device path" -> replace /EFI/BOOT/bootx64.efi (with grub-install --removable)
- uses the boot entry labelled "Windows Boot Manager" regardless of boot order -> bcdedit
- uses the hardwired Windows boot manager pathname -> replace /EFI/Microsoft/bootmgfw.efi
-
- Posts: 13
- Joined: 2019-06-07 03:16
Re: Modify Grub EFI file location with Multi-Boot OS
This is most likely the cause, but if you have experienced this and know how to fix it, I would appreciate it if you could explain it to me.p.H wrote:
Here are possible causes I can think of that the UEFI firmware always boots Windows boot manager and the expected solutions :
- ignores EFI boot entries and uses the "removable device path" -> replace /EFI/BOOT/bootx64.efi (with grub-install --removable)
- uses the boot entry labelled "Windows Boot Manager" regardless of boot order -> bcdedit
- uses the hardwired Windows boot manager pathname -> replace /EFI/Microsoft/bootmgfw.efi
Thanks
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Modify Grub EFI file location with Multi-Boot OS
If you want people to help you , please post the output of commands as requested, the output is needed to see how to proceed.by p.H »Can you post the output of:showing the EFI executable path associated with each boot entry ?Code: Select all
efibootmgr -v
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
-
- Posts: 13
- Joined: 2019-06-07 03:16
Re: Modify Grub EFI file location with Multi-Boot OS
My apologies, I do appreciate everyone's help on the forums, I will make sure to read through the suggestions properly moving forward. I did see the code and ran it, but didn't realize at the time, I needed to provide an output of the code. So, as requested, here is the code from efibootmgr -v
simon@HP-X360:~$ efibootmgr -v
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0000,3000,2001,0001,2002,2004
Boot0000* Windows Boot Manager HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
Boot0001* ubuntu HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\ubuntu\shimx64.efi)
Boot0002* Windows Boot Manager HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
Boot0003* sparky HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\sparky\grubx64.efi)
Boot0004* Windows Boot Manager HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\Debian\grubx64.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.}....................
Boot0005* UEFI Hard drive HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\Boot\bootx64.efi)
Boot0006* debian HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\debian\shimx64.efi)
Boot000A* Manjaro HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\Manjaro\grubx64.efi)
Boot000C* MX18.3 HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\MX18.3\grubx64.efi)
Boot000D* feren HD(13,GPT,7877efd7-da44-4246-8ed3-042cbb2693f4,0x608f1800,0x7d000)/File(\EFI\feren\shimx64.efi)
Boot2001* EFI USB Device RC
Boot3000* Internal Hard Disk or Solid State Disk RC
Something must clearly be changing the efi default boot, because in one of my previous posts, I had listed this output (it might not have been -v detailed version), but what I noticed was that I changed the boot order to boot only Debian - Boot0006 but after a reboot it somehow changed itself back to the previous state, similar to what is show above.
Also, on another note, I did install the grub-efi-amd64
Thank you,
Simon
simon@HP-X360:~$ efibootmgr -v
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0000,3000,2001,0001,2002,2004
Boot0000* Windows Boot Manager HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
Boot0001* ubuntu HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\ubuntu\shimx64.efi)
Boot0002* Windows Boot Manager HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
Boot0003* sparky HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\sparky\grubx64.efi)
Boot0004* Windows Boot Manager HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\Debian\grubx64.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.}....................
Boot0005* UEFI Hard drive HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\Boot\bootx64.efi)
Boot0006* debian HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\debian\shimx64.efi)
Boot000A* Manjaro HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\Manjaro\grubx64.efi)
Boot000C* MX18.3 HD(1,GPT,041dbf90-92cc-4b19-b0bb-89ccf64084c1,0x800,0x82000)/File(\EFI\MX18.3\grubx64.efi)
Boot000D* feren HD(13,GPT,7877efd7-da44-4246-8ed3-042cbb2693f4,0x608f1800,0x7d000)/File(\EFI\feren\shimx64.efi)
Boot2001* EFI USB Device RC
Boot3000* Internal Hard Disk or Solid State Disk RC
Something must clearly be changing the efi default boot, because in one of my previous posts, I had listed this output (it might not have been -v detailed version), but what I noticed was that I changed the boot order to boot only Debian - Boot0006 but after a reboot it somehow changed itself back to the previous state, similar to what is show above.
Also, on another note, I did install the grub-efi-amd64
Thank you,
Simon
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Modify Grub EFI file location with Multi-Boot OS
The bcdedit command wasn't passed successfully because the Windows boot entries should point to the Debian .efi loader, did you see any error messages after running my suggested command?
Have you tried p.H's other suggestions?
Have you tried p.H's other suggestions?
deadbang
-
- Posts: 13
- Joined: 2019-06-07 03:16
Re: Modify Grub EFI file location with Multi-Boot OS
I didn't see any error messages when performing the command. I used powershell, and opened it as administrator.
I did it again, and took a screenshot this time. I entered the following bcdedit /set "{bootmgr}" path "\EFI\Debian\grubx64.efi
Unfortunately it will not let me attach the file, it says the board attachment quota has been reached. Anyway it said, operation completed successfully.
I have tried most of what p.H. has suggested other than the last part, where he pointed out what might be the problem with the UEFI, but I am not quite sure how to resolve. (See Below)
Here are possible causes I can think of that the UEFI firmware always boots Windows boot manager and the expected solutions :
- ignores EFI boot entries and uses the "removable device path" -> replace /EFI/BOOT/bootx64.efi (with grub-install --removable)
- uses the boot entry labelled "Windows Boot Manager" regardless of boot order -> bcdedit
- uses the hardwired Windows boot manager pathname -> replace /EFI/Microsoft/bootmgfw.efi
I did it again, and took a screenshot this time. I entered the following bcdedit /set "{bootmgr}" path "\EFI\Debian\grubx64.efi
Unfortunately it will not let me attach the file, it says the board attachment quota has been reached. Anyway it said, operation completed successfully.
I have tried most of what p.H. has suggested other than the last part, where he pointed out what might be the problem with the UEFI, but I am not quite sure how to resolve. (See Below)
Here are possible causes I can think of that the UEFI firmware always boots Windows boot manager and the expected solutions :
- ignores EFI boot entries and uses the "removable device path" -> replace /EFI/BOOT/bootx64.efi (with grub-install --removable)
- uses the boot entry labelled "Windows Boot Manager" regardless of boot order -> bcdedit
- uses the hardwired Windows boot manager pathname -> replace /EFI/Microsoft/bootmgfw.efi
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Modify Grub EFI file location with Multi-Boot OS
That is incorrect, the debian directory does not start with a capital D. Try again with the correct path.LechonLover wrote:I entered the following bcdedit /set "{bootmgr}" path "\EFI\Debian\grubx64.efi
If it still doesn't work then the only option left to try is the last one.
Mount the ESP:
Code: Select all
# mount /dev/sda1 /mnt
Code: Select all
# cp /mnt/EFI/Microsoft/Boot/bootmgfw.efi{,.bak}
Code: Select all
# cp /mnt/EFI/debian/grubx64.efi /mnt/EFI/Microsoft/Boot/bootmgfw.efi
Code: Select all
# cp /mnt/EFI/debian/shimx64.efi /mnt/EFI/Microsoft/Boot/bootmgfw.efi
# cp /mnt/EFI/debian/grubx64.efi /mnt/EFI/Microsoft/Boot
Code: Select all
menuentry 'Windows (renamed)' {
set root=(hd0,1)
chainloader /EFI/Microsoft/Boot/bootmgfw.efi.bak
}
Code: Select all
search --set=root --UUID $uuid --hint hd0,1
EDIT: corrected path to bootmgfw.efi
Last edited by Head_on_a_Stick on 2019-07-07 07:27, edited 1 time in total.
deadbang
-
- Posts: 13
- Joined: 2019-06-07 03:16
Re: Modify Grub EFI file location with Multi-Boot OS
Head_on_a_Stick - Thank you very much, you solved my problem
I first tried as you suggested, and performed the bcdedit command, but this time using lowercase for debian. I restarted the computer, but unfortunately, it went to booting windows again.
I then followed through the steps you provided. My bootmfgw.efi was in a different location than you suggested but I was able to figure it out by opening nautilus /dev/sda1
Here is a copy of my entries from terminal.
simon@HP-X360:~$ mount /dev/sda1 /mnt
mount: only root can do that
simon@HP-X360:~$ sudo mount /dev/sda1 /mnt
simon@HP-X360:~$ cp /mnt/EFI/Microsoft/bootmgfw.efi{,.bak}
cp: cannot stat '/mnt/EFI/Microsoft/bootmgfw.efi': No such file or directory
simon@HP-X360:~$ sudo nautilus /dev/sda1
** (nautilus:2029): WARNING **: 23:08:35.702: Unable to get contents of the bookmarks file: Error opening file /root/.gtk-bookmarks: No such file or directory
^C
simon@HP-X360:~$ cp /mnt/EFI/Microsoft/Boot/bootmgfw.efi{,.bak}
cp: cannot create regular file '/mnt/EFI/Microsoft/Boot/bootmgfw.efi.bak': Permission denied
simon@HP-X360:~$ sudo cp /mnt/EFI/Microsoft/Boot/bootmgfw.efi{,.bak}
simon@HP-X360:~$ sudo cp /mnt/EFI/debian/grubx64.efi /mnt/EFI/Microsoft/Boot/bootmgfw.efi
simon@HP-X360:~$ sudo nano /boot/grub/custom.cfg
simon@HP-X360:~$ sudo nano /boot/grub/custom.cfg
simon@HP-X360:~$ sudo nautilus /dev/sda1
** (nautilus:2114): WARNING **: 23:12:49.757: Unable to get contents of the bookmarks file: Error opening file /root/.gtk-bookmarks: No such file or directory
^C
simon@HP-X360:~$ sudo blkid
/dev/sda1: UUID="8CAE-E7EB" TYPE="vfat" PARTLABEL="sda1 - EFI" PARTUUID="041dbf90-92cc-4b19-b0bb-89ccf64084c1"
/dev/sda3: LABEL="Windows 10" UUID="06723A41723A35B1" TYPE="ntfs" PARTLABEL="sda3 - Windows 10" PARTUUID="6a82e000-fded-47cb-8038-d8473743df3f"
/dev/sda4: LABEL="Elementary" UUID="a1f7d01d-91b7-4b08-85e7-69ac72fabb52" TYPE="ext4" PARTLABEL="sda4 - Elementary" PARTUUID="d326b1ba-a74c-4580-af2a-12e7a0f691bf"
/dev/sda6: LABEL="Windows RE tools" UUID="ECF8B1E1F8B1AA6A" TYPE="ntfs" PARTLABEL="sda6 - Windows RE Tools" PARTUUID="ef33b516-2e42-409d-b518-aa467cd03a38"
/dev/sda7: LABEL="RECOVERY" UUID="98D4C6C6D4C6A63A" TYPE="ntfs" PARTLABEL="sda7 - HP Recovery" PARTUUID="70e6d463-2315-43eb-8c1a-c07679ea38d6"
/dev/sda8: LABEL="Debian" UUID="d63f60dc-8071-4bca-8bbc-f6e12a8617f0" TYPE="ext4" PARTLABEL="sda8 - Debian" PARTUUID="036b1a85-f238-4f13-823b-2cbc5c203568"
/dev/sda9: LABEL="Linux-Shared" UUID="722354ff-0b40-48cf-a216-d0234f49a027" TYPE="ext4" PARTLABEL="sda9 - Linux Shared" PARTUUID="12338744-674a-4ae6-a75d-fa79f139095f"
/dev/sda10: UUID="5ce96ea1-da8a-46ed-a3f1-d1d2214732c7" TYPE="swap" PARTUUID="3b21eed8-4332-44d5-a698-1775ab31ca74"
/dev/sda11: LABEL="Linux Mint" UUID="612e050e-f46b-4120-8d1a-869e3f82d0b7" TYPE="ext4" PARTLABEL="sda11 - Linux Mint" PARTUUID="5a3d6491-1be1-4ccc-8eb6-52151f96e529"
/dev/sda2: PARTLABEL="sda2 - Microsoft Reserved" PARTUUID="d5b4e36a-5a0f-432f-8036-ec42aad6d5cc"
simon@HP-X360:~$ sudo nano /boot/grub/custom.cfg
simon@HP-X360:~$ sudo nano /boot/grub/custom.cfg
simon@HP-X360:~$ sudo reboot
After the rebooot, it went straight to debian bootloader.
I can't believe, it is fixed. Thank you so much, this has problem has been bugging me for so long.
Thank you for your time, and have a great day,
Simon
I first tried as you suggested, and performed the bcdedit command, but this time using lowercase for debian. I restarted the computer, but unfortunately, it went to booting windows again.
I then followed through the steps you provided. My bootmfgw.efi was in a different location than you suggested but I was able to figure it out by opening nautilus /dev/sda1
Here is a copy of my entries from terminal.
simon@HP-X360:~$ mount /dev/sda1 /mnt
mount: only root can do that
simon@HP-X360:~$ sudo mount /dev/sda1 /mnt
simon@HP-X360:~$ cp /mnt/EFI/Microsoft/bootmgfw.efi{,.bak}
cp: cannot stat '/mnt/EFI/Microsoft/bootmgfw.efi': No such file or directory
simon@HP-X360:~$ sudo nautilus /dev/sda1
** (nautilus:2029): WARNING **: 23:08:35.702: Unable to get contents of the bookmarks file: Error opening file /root/.gtk-bookmarks: No such file or directory
^C
simon@HP-X360:~$ cp /mnt/EFI/Microsoft/Boot/bootmgfw.efi{,.bak}
cp: cannot create regular file '/mnt/EFI/Microsoft/Boot/bootmgfw.efi.bak': Permission denied
simon@HP-X360:~$ sudo cp /mnt/EFI/Microsoft/Boot/bootmgfw.efi{,.bak}
simon@HP-X360:~$ sudo cp /mnt/EFI/debian/grubx64.efi /mnt/EFI/Microsoft/Boot/bootmgfw.efi
simon@HP-X360:~$ sudo nano /boot/grub/custom.cfg
simon@HP-X360:~$ sudo nano /boot/grub/custom.cfg
simon@HP-X360:~$ sudo nautilus /dev/sda1
** (nautilus:2114): WARNING **: 23:12:49.757: Unable to get contents of the bookmarks file: Error opening file /root/.gtk-bookmarks: No such file or directory
^C
simon@HP-X360:~$ sudo blkid
/dev/sda1: UUID="8CAE-E7EB" TYPE="vfat" PARTLABEL="sda1 - EFI" PARTUUID="041dbf90-92cc-4b19-b0bb-89ccf64084c1"
/dev/sda3: LABEL="Windows 10" UUID="06723A41723A35B1" TYPE="ntfs" PARTLABEL="sda3 - Windows 10" PARTUUID="6a82e000-fded-47cb-8038-d8473743df3f"
/dev/sda4: LABEL="Elementary" UUID="a1f7d01d-91b7-4b08-85e7-69ac72fabb52" TYPE="ext4" PARTLABEL="sda4 - Elementary" PARTUUID="d326b1ba-a74c-4580-af2a-12e7a0f691bf"
/dev/sda6: LABEL="Windows RE tools" UUID="ECF8B1E1F8B1AA6A" TYPE="ntfs" PARTLABEL="sda6 - Windows RE Tools" PARTUUID="ef33b516-2e42-409d-b518-aa467cd03a38"
/dev/sda7: LABEL="RECOVERY" UUID="98D4C6C6D4C6A63A" TYPE="ntfs" PARTLABEL="sda7 - HP Recovery" PARTUUID="70e6d463-2315-43eb-8c1a-c07679ea38d6"
/dev/sda8: LABEL="Debian" UUID="d63f60dc-8071-4bca-8bbc-f6e12a8617f0" TYPE="ext4" PARTLABEL="sda8 - Debian" PARTUUID="036b1a85-f238-4f13-823b-2cbc5c203568"
/dev/sda9: LABEL="Linux-Shared" UUID="722354ff-0b40-48cf-a216-d0234f49a027" TYPE="ext4" PARTLABEL="sda9 - Linux Shared" PARTUUID="12338744-674a-4ae6-a75d-fa79f139095f"
/dev/sda10: UUID="5ce96ea1-da8a-46ed-a3f1-d1d2214732c7" TYPE="swap" PARTUUID="3b21eed8-4332-44d5-a698-1775ab31ca74"
/dev/sda11: LABEL="Linux Mint" UUID="612e050e-f46b-4120-8d1a-869e3f82d0b7" TYPE="ext4" PARTLABEL="sda11 - Linux Mint" PARTUUID="5a3d6491-1be1-4ccc-8eb6-52151f96e529"
/dev/sda2: PARTLABEL="sda2 - Microsoft Reserved" PARTUUID="d5b4e36a-5a0f-432f-8036-ec42aad6d5cc"
simon@HP-X360:~$ sudo nano /boot/grub/custom.cfg
simon@HP-X360:~$ sudo nano /boot/grub/custom.cfg
simon@HP-X360:~$ sudo reboot
After the rebooot, it went straight to debian bootloader.
I can't believe, it is fixed. Thank you so much, this has problem has been bugging me for so long.
Thank you for your time, and have a great day,
Simon
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: Modify Grub EFI file location with Multi-Boot OS
Boot0004 is a Windows boot entry pointing to the Debian boot loader. But it is not in the BootOrder, and other Windows boot entries pointing to Windows boot manager exist.Head_on_a_Stick wrote:The bcdedit command wasn't passed successfully because the Windows boot entries should point to the Debian .efi loader
AFAIK, FAT and EFI are case insensitive.Head_on_a_Stick wrote:That is incorrect, the debian directory does not start with a capital D
OP : note that this workaround is a last-resort hack and may be overwritten after any Windows update.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Modify Grub EFI file location with Multi-Boot OS
Damn, I missed thatp.H wrote:Boot0004 is a Windows boot entry pointing to the Debian boot loader.
@OP: can you add that entry to the boot order?
Code: Select all
# efibootmgr -o 4,6
Yes of course, how silly of me. Thanks for the corrections.p.H wrote:FAT and EFI are case insensitive
+1p.H wrote:OP : note that this workaround is a last-resort hack and may be overwritten after any Windows update.
deadbang