Windows 10 will, for the most part, be added to grub boot menu by the os-prober automajically.
For my specific setup I wanted to completely hide grub menu and automatically boot windows unless a hotkey was pressed to boot Ubuntu. So in my specific case os-prober isn’t an option because the most important step in hiding the grub menu, which most answers I found neglect to mention, is to set the disable os-prober flag or the menu WILL be shown until os-prober completes.
It took considerably longer than I had anticipated to get right because there are so many partial answers out there but most are version dependant and can lead you astray. I spent a lot of time trying write my own grub menu entry trying use grub commands that didn’t exist like ntdlr. Another caveat is that the chainloader functions on my grub try to boot bios not efi and will not work.(Im sure I was doing something wrong?)
In the end the solution was actually simple as the scripts that make your /boot/grub/grub.cfg do most of the work for you in finding UUIDS for your boot partitions. So you can skip the fdisk and blkid steps most people mention.
So step 1 is to make sure /boot/grub/grub.cfg is current using update-grub to make .cfg file. In terminal
sudo update-grub
Step 2 is to add custom menu entries in /etc/grub.d/40_custom. Don’t waste time trying to write your own simply open /boot/grub/grub.cfg search «menuentry» and copy the automatically generated entries.
The first in the list will be ubuntu mine looks like
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-9e66eed6-e672-49ff-a07c-afdc00809148' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 9e66eed6-e672-49ff-a07c-afdc00809148
else
search --no-floppy --fs-uuid --set=root 9e66eed6-e672-49ff-a07c-afdc00809148
fi
linux /boot/vmlinuz-5.4.0-39-generic root=UUID=9e66eed6-e672-49ff-a07c-afdc00809148 ro quiet splash $vt_handoff
initrd /boot/initrd.img-5.4.0-39-generic
}
Windows will be similar. Copy both to /etc/grub.d/40_custom. The only change I made for Ubuntu is to add the —hotkey=key flag which will make grub boot the os associated with that hotkey.
menuentry 'Ubuntu2' --class ubuntu --class gnu-linux --class gnu --class os --hotkey=u $menuentry_id_option 'gnulinux-simple-9e66eed6-e672-49ff-a07c-afdc00809148' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 9e66eed6-e672-49ff-a07c-afdc00809148
else
search --no-floppy --fs-uuid --set=root 9e66eed6-e672-49ff-a07c-afdc00809148
fi
linux /boot/vmlinuz-5.4.0-39-generic root=UUID=9e66eed6-e672-49ff-a07c-afdc00809148 ro quiet splash $vt_handoff
initrd /boot/initrd.img-5.4.0-39-generic
}
I use —hotkey=u here to set Ubuntu boot hotkey to u.
Then I tweaked the Windows entry, replacing $menuentry_id_option withe the grub —id flag.
menuentry "Windows 10" --class windows --class os --id windows-custom {
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 0EAE-C882
else
search --no-floppy --fs-uuid --set=root 0EAE-C882
fi
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
I used —id windows-custom. Save chages to /etc/grub.d/40_custom.
Finally open /etc/default/grub and add
GRUB_DISABLE_OS_PROBER=true
change GRUB_DEFAULT=0
to GRUB_DEFAULT=windows-custom
and change GRUB_TIMEOUT=10
to your choice of timings I use 0.5 just to give myself a little extra time to hit u to boot Ubuntu after POST.
Hopefully this saves someone a bit of headache, cheers!
It looks like you’ve followed an old guide that expects Windows to use MBR partitioning.
The «invalid signature» error suggests Secure Boot is enabled. When Secure Boot is enabled, all bootloaders must be signed with a private key, and a matching public key must be included in the Secure Boot variables in the firmware NVRAM. GRUB is dutifully reading the first sector of the partition you’ve specified, but since it does not contain the appropriate Secure Boot signature, the firmware refuses to execute it.
Secure Boot requires native UEFI-style boot as a prerequisite. You may be able to disable Secure Boot on your system, but since GRUB already starts for you, there is probably no need to do that.
Your insmod part_gpt
suggest you expect the disk to have a GPT-style partitioning which usually goes together with UEFI boot style, but on the other hand, set root=(hd0,msdos2)
expects a MBR partition.
On my Debian system with GPT partitioning, the set root
line reads: set root='hd0,gpt1'
. If your system uses GPT partitioning, use the gptN
partition identifiers instead of msdosN
.
Also chainloader +1
tells GRUB to read the boot block from the first block of the partition; in UEFI native boot, there is no such thing. To boot Windows in UEFI mode, the set root
line should point to the EFI System Partition that contains the Windows bootloader, and the chainloader line should be chainloader /EFI/Microsoft/Boot/bootmgfw.efi
.
It looks like you’ve followed an old guide that expects Windows to use MBR partitioning.
The «invalid signature» error suggests Secure Boot is enabled. When Secure Boot is enabled, all bootloaders must be signed with a private key, and a matching public key must be included in the Secure Boot variables in the firmware NVRAM. GRUB is dutifully reading the first sector of the partition you’ve specified, but since it does not contain the appropriate Secure Boot signature, the firmware refuses to execute it.
Secure Boot requires native UEFI-style boot as a prerequisite. You may be able to disable Secure Boot on your system, but since GRUB already starts for you, there is probably no need to do that.
Your insmod part_gpt
suggest you expect the disk to have a GPT-style partitioning which usually goes together with UEFI boot style, but on the other hand, set root=(hd0,msdos2)
expects a MBR partition.
On my Debian system with GPT partitioning, the set root
line reads: set root='hd0,gpt1'
. If your system uses GPT partitioning, use the gptN
partition identifiers instead of msdosN
.
Also chainloader +1
tells GRUB to read the boot block from the first block of the partition; in UEFI native boot, there is no such thing. To boot Windows in UEFI mode, the set root
line should point to the EFI System Partition that contains the Windows bootloader, and the chainloader line should be chainloader /EFI/Microsoft/Boot/bootmgfw.efi
.
- I have installed Windows 10
- I have installed Linux Mint Silvia and I have chosen a device for boot loader installation — sda.
- There is not Windows 10 in grub menu when the system starts
- I have booted via Linux Mint live USB.
- I Do step by step https://howtoubuntu.org/how-to-repair-restore-reinstall-grub-2-with-a-ubuntu-live-cd
- But it still no Windows 10 in grub menu
- I have booted via live windows 10 USB.
- With restoration tools, I have chosen the command line
- I have fixed Mbr by console command bootrec /FixMbr
- Ok, windows 10 is loading by there is no Grub.
- I have repeated steps 4 and 5
- There is no result
Also, I have tried to change grub config with this answer
https://askubuntu.com/questions/661947/add-windows-10-to-grub-os-list#answer-977251 — But in this case, There is Windows 10 — but when I chose — I will recursively going to grub
And with this answer
https://askubuntu.com/questions/661947/add-windows-10-to-grub-os-list#answer-890562
I have an error message when chose Windows 10 — There is no bootmgr directory
Thanks @Kinnectus for help
Also, I have tried
sudo os-prober
And getting
/dev/sda1:FreeDOS:FreeDOS:chain
/dev/sda2:FreeDOS:FreeDOS1:chain
And then I have tried
sudo update-grub
And getting
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.10.0-38-generic
Found initrd image: /boot/initrd.img-4.10.0-38-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found FreeDOS on /dev/sda1
Found FreeDOS on /dev/sda2
done
Unfortunately — there is not Windows 10 in grub menu
Also, I have fdisk output.
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 16779263 16777216 8G c W95 FAT32 (LBA)
/dev/sda2 * 16779264 33556479 16777216 8G c W95 FAT32 (LBA)
/dev/sda3 33556480 770219115 736662636 351,3G 7 HPFS/NTFS/exFAT
/dev/sda4 770220030 976771071 206551042 98,5G 5 Extended
/dev/sda5 770220032 976771071 206551040 98,5G 83 Linux
Partition 4 does not start on physical sector boundary.
There is an issue.
Maybe the problem is with this issue?
Please, help me, I am stucking with this a whole day.
I completely have no idea, what am I doing wrong.
I have Windows 10 HOME installed on my system. After I installed Windows 10 HOME, I installed Ubuntu 14.04 LTS on a separate partition so that I could dual boot.
I removed Ubuntu 14.04 LTS by deleting the partition it was installed on. Now I am unable to start my system. At boot, my system stops at the Grub command line.
I want to boot to my Windows 10 installation which I haven’t removed from my system.
This is displayed at startup:
GNU GRUB version 2.02 beta2-9ubuntu1.3 <br>
minimal BASH-like editing is supported.for the first word, TAB lists
possible commands completions.anywhere else TAB lists the possible device or file completion.
grub>
How can I boot my Windows partition from this grub command?
roaima
98.9k14 gold badges125 silver badges239 bronze badges
asked Feb 1, 2016 at 13:01
The following worked for me with a GPT partitioned disk.
insmod part_gpt
insmod chain
set root=(hd0,gpt1)
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
boot
Note that you can enter a command line from the grub boot menu and just type commands as above to test out different combinations.
You need to enter the id of the EFI boot partition (not the windows partition) for the set root=
command.
In the command line grub mode ls
will list the hard drive partitions, help
lists available commands.
Once you have set the root correctly you can ls /
to view files and directories to find the correct path to the windows boot manager if it is not in the default location.
answered Mar 9, 2018 at 21:46
79E0979679E09796
6405 silver badges4 bronze badges
4
Just enter the command exit
. It should take you to another menu that makes you select the Windows bootloader.
Worked on Lenovo Y50
AdminBee
20.8k17 gold badges47 silver badges69 bronze badges
answered Nov 7, 2017 at 18:44
adonayresomadonayresom
6395 silver badges6 bronze badges
7
Guesing you have an UEFI device, the windows bootloader is still installed. You can select it back in UEFI setup menu under boot, where you will prbably have two options (GRUB and the old default as the second), delete the first one or switch the order.
answered Feb 5, 2016 at 9:00
AlkoAlko
9121 gold badge7 silver badges17 bronze badges
1
This answer is for those with UEFI who have deleted the Ubuntu partitions before removing grub
You will be doing this from Windows 10. No bootable media required.
Where
bootrec /fixmbr
,bootsect /nt60
and the Ubuntu live with theboot-repair
suggestions have failed, this has worked for me:(This answer borrowed verbatim from here)
- Run a
cmd.exe
process with administrator privileges- Run
diskpart
- Type:
list disk
thensel disk X
where X is the drive your boot files reside on- Type
list vol
to see all partitions (volumes) on the disk- Select the EFI volume by typing:
sel vol Y
where Y is theSYSTEM
volume (this is almost always the EFI partition)- For convenience, assign a drive letter by typing:
assign letter=Z:
where Z is a free (unused) drive letter- Type
exit
to leave disk part- While still in the
cmd
prompt, type:Z:
and hit enter, where Z was the drive letter you just created.- Type
dir
to list directories on this mounted EFI partition- If you are in the right place, you should see a directory called
EFI
- Type
cd EFI
and thendir
to list the child directories insideEFI
- Type
rmdir /S ubuntu
to delete the ubuntu boot directoryAssuming you only ever had two operating systems (Win 10 & Ubuntu) you should now be able to boot directly to Windows without hitting the black grub screen.
Copied from https://askubuntu.com/questions/429610/uninstall-grub-and-use-windows-bootloader
answered Sep 4, 2018 at 22:58
sa mysa my
711 silver badge1 bronze badge
1
Just exit the grub
by typing exit
and go to bios setup and restore to default settings and restart the computer.
AdminBee
20.8k17 gold badges47 silver badges69 bronze badges
answered Dec 8, 2018 at 7:01
0
I recently bumped into the same problem. (i.e. originally have a a separate partition with Ubuntu installed, dual bootable from a grub menu. I then deleted that Ubuntu partition from Windows disk management, and when I rebooted, just the grub command menu).
What I did to get back to my Windows 10:
- Do a
Ctrl
+Alt
+Delete
to reboot. While rebooting, hold down theshift
button. - My PC then give me to option to press
F12
for boot option. I clickedF12
, and it gives me back a menu with Windows boot manager on it. - I selected the Windows boot manager and click enter. I’m now back to Windows 10.
answered May 29, 2017 at 16:35
Atlas7Atlas7
1113 bronze badges
This worked for me, now I have to find a way to permanently fix the mbr.
I recently bumped into the same problem. (i.e. originally have a a separate partition with Ubuntu installed, dual bootable from a grub menu. I then deleted that Ubuntu partition from Windows disk management, and when I rebooted, just the grub command menu).
What I did to get back to my Windows 10:
Do a Ctrl+Alt+Delete to reboot. While rebooting, hold down the shift button.
My PC then give me to option to press F12 for boot option. I clicked F12, and it gives me back a menu with Windows boot manager on it.
I selected the Windows boot manager and click enter. I’m now back to Windows 10.
answered Aug 26, 2017 at 19:18
Try this, its worked in my case:
grub> exit
You will get a list of operating systems installed. Select one.
answered Feb 21, 2020 at 4:37
2
Try this:
rootnoverify (hd0,0)
chainloader +1
makeactive
boot
techraf
5,64710 gold badges33 silver badges50 bronze badges
answered Nov 23, 2016 at 1:10