I have a desktop with UEFI enabled. My main OS is Windows, but sometime I also want to test my code in Linux, so I installed grub to dual boot Windows and Linux. In order to have Linux work properly I have to disable fast-boot in Windows, but that brings some annoyance to me. Is there any way I can boot Windows by default (by mbr) and only show the grub menu when I insert the particular USB device?
Asked
Active
Viewed 555 times
0
-
If Windows is UEFI and Ubuntu UEFI, then you can just set Windows as default boot in UEFI and use f10 or f12 or whatever key is UEFI one time boot. If not both in UEFI you have to use UEFI boot menu. You still will need fast start up off for Linux NTFS driver to see any NTFS formatted partitions. – oldfred Mar 10 '17 at 16:49
1 Answers
2
If you have a USB drive formatted in the Grub-compatible file system, you can install GRUB there, or even move whole /boot partition. You should create GPT table on USB drive and then a ext4 partition. Then mount it and install GRUB there. You will have to rename it to a specific name so that it can work without registering it in the motherboard.
grub-install --target=x86_64-efi --efi-directory=/usb_mount --bootloader-id=grub
mkdir /usb_mount/EFI/boot
cp /usb_mount/EFI/grub_uefi/grubx64.efi /usb_mount/EFI/boot/bootx64.efi
After that set your motherboard options to try to boot from USB drive first, and from Windows boot partition second. This way, it will boot Windows if USB stick not present.
However, you did not explain why you need this instead of making Windows the default boot entry in Grub that Ubuntu already installed, so that Window boots unless action taken to choose another entry. This is how to do it.

Barafu Albino
- 6,541