Ubuntu add windows to grub

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!

  1. I have installed Windows 10
  2. I have installed Linux Mint Silvia and I have chosen a device for boot loader installation — sda.
  3. There is not Windows 10 in grub menu when the system starts
  4. I have booted via Linux Mint live USB.
  5. I Do step by step https://howtoubuntu.org/how-to-repair-restore-reinstall-grub-2-with-a-ubuntu-live-cd
  6. But it still no Windows 10 in grub menu
  7. I have booted via live windows 10 USB.
  8. With restoration tools, I have chosen the command line
  9. I have fixed Mbr by console command bootrec /FixMbr
  10. Ok, windows 10 is loading by there is no Grub.
  11. I have repeated steps 4 and 5
  12. 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.

Skip to content

After a recent malware attack in my Windows 10 PC, I was unable to use it for many days. So this time I decided to install both Windows 10 and Ubuntu 16.04.3 in the dual boot configuration, so that if Windows fails to boot, I can still access all my files using the Ubuntu. And of course, you can always use the powerful Ubuntu Linux on the same PC any time you want. But after installing Ubuntu 16.04.3 on the Windows 10 PC, I found no way to use Windows 10 as the Ubuntu setup somehow failed to add the Windows entry to the Grub menu.

If you are also experiencing a similar problem then you can quickly fix this problem using just two commands. Here is how:

  1. Boot into Ubuntu (well, there is no other option at the moment but to boot into Ubuntu).
  2. Press Ctrl + Alt + T to open the terminal window.
  3. In the terminal window type the following command: sudo os-prober and press Enter.Add Windows to Grub Menu
  4. If you see it detect Windows 10 then all you have to do is type the command sudo update-grub and press Enter. It will add new entries to the grub menu and update it. Now you can reboot your PC and you will see options to boot into Windows.

However, if you do not see the Windows 10 detected after issuing the sudo os-prober command, then you will have to use some extra steps. We have already posted about boot-repair utility that can be used from within Linux to fix most of the boot problems. You can read more about the boot-repair utility from how to restore Ubuntu Linux after re-installing Windows. This tool should be enough to fix the problems and you will never need any of the commands to be used manually or to edit the grub menu by yourself.

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.

Ubuntu 6

In this article, we will guide you through the process of adding Windows 11 to the GRUB menu. This can be a handy tool if you’re running a dual-boot setup with Linux and Windows 11.

To add Windows 11 to the GRUB menu, you can either enable the OS prober in GRUB or manually add an entry for Windows 11 in the GRUB configuration. The OS prober method automatically detects other operating systems, while the manual method requires you to add the entry yourself.

  1. Understanding GRUB
  2. Enabling OS Prober in GRUB
  3. Manually Adding Windows 11 to the GRUB Menu

Understanding GRUB

GRUB, or the Grand Unified Bootloader, is a program that allows your computer to load and manage multiple operating systems. It’s the default bootloader for many Linux distributions.

Enabling OS Prober in GRUB

The first method we will discuss involves enabling the OS prober in GRUB. This is a tool that automatically detects other operating systems and adds them to the GRUB menu.

  1. Opening the Terminal: Open the terminal in your Linux distribution. This can usually be done by searching for ‘terminal’ in the application menu or by using a keyboard shortcut.
  2. Editing the GRUB Configuration File: In the terminal, type the following command to open the GRUB configuration file in a text editor:
sudo nano /etc/default/grub

This command uses sudo to run the command as the root user, nano to open the file in the nano text editor, and /etc/default/grub is the path to the GRUB configuration file.

  1. Changing the OS Prober Setting: In the configuration file, look for the line that says GRUB_DISABLE_OS_PROBER=true and change it to GRUB_DISABLE_OS_PROBER=false. This will enable the OS prober.
  2. Saving and Exiting: Press Ctrl+O to save the file and Ctrl+X to exit the nano text editor.
  3. Updating GRUB: Finally, update GRUB with the following command:
sudo update-grub

This command updates GRUB with the new configuration.

  1. Rebooting: Reboot your computer. When it starts up again, you should see an entry for Windows 11 in the GRUB menu.

Manually Adding Windows 11 to the GRUB Menu

If the OS prober method doesn’t work, you can manually add an entry for Windows 11 in the GRUB configuration.

  1. Opening the Terminal and the Custom File: Open the terminal and type the following command to open the 40_custom file in a text editor:
sudo nano /etc/grub.d/40_custom
  1. Adding the Windows 11 Entry: At the end of the file, add the following lines:
menuentry 'Windows 11' {
 search --fs-uuid --no-floppy --set=root <YOUR "File system UUID">
 chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}

Replace <YOUR "File system UUID"> with the UUID of your EFI partition. You can find this by running sudo blkid /dev/nvme0n1p1 in the terminal.

  1. Saving, Exiting, and Updating GRUB: Save the file and exit the editor, then update GRUB with sudo update-grub.
  2. Rebooting: Reboot your computer. You should now see an entry for Windows 11 in the GRUB menu.

We hope this guide has been helpful in adding Windows 11 to your GRUB menu. For more information on GRUB, you can visit the official GNU GRUB Manual.

GRUB, or the Grand Unified Bootloader, is a program that allows your computer to load and manage multiple operating systems. It is the default bootloader for many Linux distributions.

Adding Windows 11 to the GRUB menu is useful if you have a dual-boot setup with Linux and Windows 11. It allows you to easily switch between the two operating systems during startup.

To enable the OS prober in GRUB, you need to edit the GRUB configuration file. Open the terminal, type sudo nano /etc/default/grub to open the file, change GRUB_DISABLE_OS_PROBER=true to GRUB_DISABLE_OS_PROBER=false, save the file, and update GRUB with sudo update-grub.

If the OS prober method doesn’t work, you can manually add an entry for Windows 11 in the GRUB configuration. Open the terminal, type sudo nano /etc/grub.d/40_custom to open the file, add the necessary lines for the Windows 11 entry, save the file, update GRUB with sudo update-grub, and then reboot your computer.

To find the UUID of your EFI partition, open the terminal and run the command sudo blkid /dev/nvme0n1p1. Replace /dev/nvme0n1p1 with the correct partition identifier for your system. The UUID will be displayed in the output.

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.

  • Ubuntu not booting after installing windows
  • Ubuntu как запускать приложения windows
  • Ubisoft game launcher windows 7
  • Ubuntu on windows 10 gui
  • Ubox приложение для камеры windows