61. Loba_Espacial,
Stack Overflow
About
Products
For Teams
Search…
Home
PUBLIC
Questions
Tags
Users
Companies
COLLECTIVES
Explore Collectives
LABS
Discussions
TEAMS
Stack Overflow for Teams – Start collaborating and sharing organizational knowledge.
Windows equivalent to efibootmgr? [closed]
Asked 6 years, 3 months ago
Modified 1 year, 2 months ago
Viewed 18k times
8
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 months ago.
Windows keeps overriding the UEFI boot order even if I change it with efibootmgr from Ubuntu. However BootNext option is not overridden, that is, I can set BootNext to Ubuntu and it boots into Ubuntu upon rebooting. I, therefore wrote the following script to run every time I boot into Ubuntu :
efibootmgr > file.txt
CURR="$(grep "BootCurrent" file.txt | grep -Eo "[0-9]{4}")"
efibootmgr -n $CURR
rm file.txt
exit 0
This ensures that I can boot into grub when I reboot from Ubuntu. Is there a way to do the same from Windows so that I can boot into grub when rebooting from Windows?
EDIT :
Running bcdedit /v gives (No Ubuntu entry):
Windows Boot Manager
identifier {9dea862c-5cdd-4e70-acc1-f32b344d4795}
device partition=\Device\HarddiskVolume1
path \EFI\ubuntu\shimx64.efi
description Windows Boot Manager
locale en-US
inherit {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
default {9b4692db-d6e1-11e6-8040-f733056555ec}
resumeobject {9b4692da-d6e1-11e6-8040-f733056555ec}
displayorder {9b4692db-d6e1-11e6-8040-f733056555ec}
toolsdisplayorder {b2721d73-1db4-4c62-bf78-c548a880142d}
timeout 0
Windows Boot Loader
identifier {9b4692db-d6e1-11e6-8040-f733056555ec}
device partition=C:
path \WINDOWS\system32\winload.efi
description Windows 10
locale en-US
inherit {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
recoverysequence {9b4692dc-d6e1-11e6-8040-f733056555ec}
displaymessageoverride Recovery
recoveryenabled Yes
isolatedcontext Yes
allowedinmemorysettings 0x15000075
osdevice partition=C:
systemroot \WINDOWS
resumeobject {9b4692da-d6e1-11e6-8040-f733056555ec}
nx OptIn
bootmenupolicy Standard
powershellcmdterminalbootuefi
Share
Improve this question
Follow
edited Jul 5, 2017 at 7:34
asked Jul 5, 2017 at 7:06
Naveen Unnikrishnan's user avatar
Naveen Unnikrishnan
14111 gold badge22 silver badges77 bronze badges
I can't seem to be able to find an Ubuntu entry in BCDedit. @wOxxOm please take a look at the EDIT. –
Naveen Unnikrishnan
Jul 5, 2017 at 7:36
I was wrong: Windows boot manager runs after UEFI, of course. –
wOxxOm
Jul 5, 2017 at 7:39
1
EasyUEFI supports one-time boot sequence and CLI. Maybe you can find pure CLI utilities. –
wOxxOm
Jul 5, 2017 at 8:39
Thanks for the input @wOxxOm. However, CLI is only available with the paid version. I'd rather not spend $30 to fix this. –
Naveen Unnikrishnan
Jul 6, 2017 at 11:52
I am looking for this too. –
Mike Wise
Feb 3, 2018 at 22:28
Add a comment
3 Answers
Sorted by:
Highest score (default)
7
On Windows you can use "bcdedit /enum firmware" to list all firmware applications, then "bcdedit /set {fwbootmgr} bootsequence {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" to set BootNext option.
Share
Improve this answer
Follow
edited Sep 10, 2019 at 1:14
shizhen's user avatar
shizhen
12.3k99 gold badges5252 silver badges8989 bronze badges
answered Sep 10, 2019 at 0:38
Douglas S.'s user avatar
Douglas S.
7111 silver badge22 bronze badges
1
bcdedit changes the Windows loader, while efibootmgr in fact modifies UEFI. Windows loader may refuse to load what UEFI will happily do. –
facetus
May 19, 2020 at 7:10
Add a comment
1
Don't you have to create UBuntu loader similar to {9b4692db-d6e1-11e6-8040-f733056555ec}?
Basically the ubuntu node should be changed from boot manager to boot loader app. Then have a boot manager at EFI\Boot\bootx64.efi.
Create a {bootmgr} node for boot manager. Set its displayorder to include both the guids above. Then set the default value for {bootmgr} to ubuntu guid. That should make ubuntu item sticky across reboots.
Share
Improve this answer
Follow
answered Oct 10, 2017 at 2:03
videoguy's user avatar
videoguy
1,75822 gold badges2424 silver badges5050 bronze badges
Add a comment
1
In my answer I will be refering to (U)EFI—the (Unified) Extensible Firmware Interface—simply as EFI.
Also, for all the commands an elevated command prompt should be used, i.e. run cmd.exe (not PowerShell!) with administrator rights!
I was just looking for the same thing. I had the (temporary) problem that Linux couldn't access/change EFI NVRAM, including the boot sequence. (Which I eventually resolved.) During this time I looked into the Windows way of doing this, and found that bcdedit actually does have the same set of functions, including a) creating a new EFI boot menu entry and b) changing the EFI boot sequence.
If a Linux boot loader is already configured, the sequence can be changed with bcdedit /enum firmware should list it. Imporant is only the GUID of the boot loader object listed with the Linux boot loader, i.e. a string looking like {01234567-89AB-CDEF-0123-456789ABCDEF}, and replace {<GUID>} in the following examples with your actual GUID.
Any firmware boot loader can be set as the default EFI boot option with bcdedit /set {fwbootmgr} default {<GUID>}.
To set a EFI boot loader entry as the first boot item in the list, bcdedit /set {fwbootmgr} displayorder {<GUID>} /addfirst can be used.
Problematic is when you don't have a EFI boot loader entry for the Linux boot loader (maybe it got deleted somehow, or it wasn't set during installation). Important is only that the Linux boot loader is already configured, because that is something that has to be done in Linux. The standard nowadays is GRUB (the GRand Unified Bootloader, version 2). On EFI systems it should be installed on the ESP (EFI System Partition) in \EFI\<Distribution>\<bootloader>.efi or similar. E.g. for Ubuntu it would be \EFI\Ubuntu\grubx64.efi. For Arch Linux it could be \EFI\arch\grubx64.efi or \EFI\GRUB\grubx64.efi for x86-64 systems (and \EFI\arch\grub.efi or \EFI\GRUB\grub.efi for x86-32).
To find out which EFI boot loaders there are, the ESP has to be mounted on Windows first, which can be done with diskpart.
DISKPART> select disk 0
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ------ ----- ---------- ------- --------- ------
...
Volume 2 FAT32 Partition 200 MB Healthy System
DISKPART> select volume 2
DISKPART> assign letter=S
DISKPART> exit
The above assumes that a) the ESP, shown as System under the Info column, is volume 2 (replace it with the actual volume #), and that b) drive letter S is still available (unused) up to this moment, otherwise use any other free drive letter (from A to Z).
The ESP is now accessible as the assigned drive, in the example S:. Look at this drive to see if there are any EFI boot loaders under \EFI... This can be done e.g. using the Windows Explorer, or while still in an elevated command prompt:
s:
dir /s /q
Note that this drive letter assignment is not permanent, i.e. after a Windows reboot the ESP will no longer be mounted, which is as it should be.
Now bcdedit can be used to add an EFI boot loader to the EFI boot menu, and set it as the new default, as follows (change paths and GUIDs accordingly):
bcdedit /set {bootmgr} path \efi\grub\grubx64.efi
bcdedit /enum {bootmgr}
bcdedit /set {fwbootmgr} displayorder {<GUID>} /addfirst
bcdedit /set {fwbootmgr} default {<GUID>}
Note that changing the displayorder is entirely optional!
All these commands only work with cmd.exe, as with PowerShell (which would also have to be an elevated shell, i.e. "run as administrator") additional quotes are required:
bcdedit /set '{bootmgr}' path \efi\grub\grubx64.efi
bcdedit /enum '{bootmgr}'
bcdedit /set '{fwbootmgr}' displayorder '{<GUID>}' /addfirst
bcdedit /set '{fwbootmgr}' default '{<GUID>}'
This worked for me, as it set the Linux EFI boot loader as the default from within Windows 10, permanently. IMHO bcdedit is the equivalent of efibootmgr on Windows, only with the additional layer of (in this case absolutely unnecessary) random GUIDs to refer to the individual EFI boot loaders...
Share
Improve this answer
Follow
answered Aug 27, 2022 at 12:53
luttztfz's user avatar
luttztfz
15111 silver badge55 bronze badges
Add a comment
Not the answer you're looking for? Browse other questions tagged powershellcmdterminalbootuefi or ask your own question.
The Overflow Blog
Edge and beyond: How to meet the increasing demand for memory
sponsored post
Featured on Meta
Changes to MSE deployment process may cause intermittent issues on November...
Update: New Colors Launched
Temporary policy: Generative AI (e.g., ChatGPT) is banned
Report this ad
20 people chatting
Related
1
How to start Boot2Docker in PowerShell in Windows?
4
Disabling fast boot (system settings) programmatically
0
Find the volume letter of EFI partition
3
How to run Restart-Computer in PowerShell using C#?
1
Is there a way to determine the current boot phase in Powershell?
0
running EFI shell commands on windows command line
0
Using Powershell to make USB Bootable Drive
1
conversion batch to powerhsell autoreboot
1
How to Check Device Boot Mode (UEFI or Legacy)?
3
How to get storage information of the EFI partition?
Hot Network Questions
Rebuilt chimney still leaking
What's the exact definition of the power spectral density function?
5e Combat economy and darkness
Israeli officials taking responsibility for a miscalculation in predicting a possible Hamas attack
Can the Cyber Resilience Act make it illegal to retire?
Why are Eastern European countries more likely to recognize Palestine as a state than Western European countries?
Seeking story about chess in Soviet Union, probably Playboy c.1980?
Why does the Curiosity rover camera image resolution have "milliradians" as a unit?
I __________ you to see a doctor. "would take" or "am taking"?
If one of your research partners stops working halfway but doesn't withdraw what should you do?
How can I make my Tonkotsu broth less fatty?
License problem in spain
I would like to model this shape, but can't figure out how. I've tried booleans, modeling it and even connecting different shapes
Quaternion get a minus sign after full rotation
How does jet fuel not spill out upon disconnecting from the wing's intake?
What is this symbol in Kicad schematics?
Thrown Arms Master and Returning Weapon Infusion
Catholicism - How to deal with the possibility of being on call on Sundays?
With existing tech and knowledge of meteorology, can aircraft be designed to reliably improve their range or loiter using updrafts to gain altitude?
Merging sorted integer arrays (without duplicates)
Where are the Cheyenne prophesies of Sweet Medicine recorded?
Homeowner's insurance and alleged business misconduct
The security team has noticed suspicious trading activity. Insurance fee is 25%
British vs. American Scones
STACK OVERFLOW
Questions
Help
PRODUCTS
Teams
Advertising
Collectives
Talent
COMPANY
About
Press
Work Here
Legal
Privacy Policy
Terms of Service
Contact Us
Cookie Settings
Cookie Policy
STACK EXCHANGE NETWORK
Technology
Culture & recreation
Life & arts
Science
Professional
Business
API
Data
Blog
Facebook
Twitter
LinkedIn
Instagram
Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. rev 2023.10.31.43698
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Punteggio: +0