2

I'm fairly new to Linux and English is not my native language, so forgive me if I can't formulate my question correctly, but I'll try my best.

I have a Windows 10 laptop and decided to install Ubuntu on an USB Flash Drive. The installation created a folder named Ubuntu inside the EFI Partition on the HD.

In that folder there is a grub.cfg with the code

search.fs_uuid 69e684a2-b6e2-4701-9a56-5f83829026ed root hd3,msdos1 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

If the USB Flash Drive with Ubuntu is plugged, the Grub launches the Debian Menu with the option to boot from Ubuntu, Advanced Options, Windows, etc. If the USB Flash Drive is not present, the Grub enters command line.

I want to know if there is any code I can write that if the Grub doesn't detect the USB Flash Drive with Ubuntu installation, it automatically boots to Windows 10.

I understand that this line on the grub.cfg

search.fs_uuid 69e684a2-b6e2-4701-9a56-5f83829026ed root hd3,msdos1

Is for detecting the USB Flash Drive, so I wonder if I can do something like this (it is just an example):

If {USB Flash Drive = Detected}
    <BOOT UBUNTU>
else
    <BOOT WINDOWS 10>
  • 1
  • 2
    The correct way is to have an ESP on your external drive with the /EFI/ubuntu & /EFI/Boot folder. External drives boot from /EFI/Boot/bootx64.efi, but the version Ubuntu installs needs the ubuntu folder. In UEFI set flash drive as first in boot order & Windows second. If not flash UEFI should then boot Windows. Once you know you can boot external drive, remove UEFI entry for ubuntu & ubuntu folder in ESP.https://askubuntu.com/questions/1167910/unable-to-properly-boot-linux-from-external-ssd/1167940#1167940 & http://askubuntu.com/questions/63610/how-do-i-remove-ubuntu-in-the-bios-boot-menu – oldfred Dec 13 '19 at 00:37

0 Answers0