Cannot boot to Linux because BIOS boot menu and GRUB rescue image console unable to locate external hard disk drive
Ubuntu – BIOS/GRUB is unable to detect external hard disk drive
biosgrub2grubrescue
Related Solutions
Bug Alert!
There is a bug (bug number: 1396379) in the Ubuntu installer that installs the grub bootloader on the first ESP it finds. See https://ubuntuforums.org/showthread.php?t=2182302 for discussions on this.
To workaround this bug you will need to take a few extra steps.
Workaround
- When you boot from the LiveUSB in UEFI mode, use the Try Ubuntu without Installing option.
- Open the Gparted application when the Ubuntu desktop starts.
- Select the Windows (first) drive within Gparted at the top right corner(1):
The NVME drive in this picture does not have Windows. However, it has an EFI System Partition (ESP).
- Highlight the ESP in the bottom list of partitions as shown above (2). Right click on the highlighted partition and select Manage Flags from the context menu. You will see:
You should see two flags, boot
and esp
checked. Uncheck those two flags. Click Close button to exit the Manage Flag window. Click the green "Apply" ✅ button if it is clickable.
You will need to restore those check marks once Ubuntu is installed using the same above process so that Windows can boot from the first drive.
Close Gparted.
This is the end of the workaround.
Original Answer
See How do I install Ubuntu to a USB key? (without using Startup Disk Creator)
Even though it is for USB key, the same principle applies for the USB Hard drive. Pay extra attention to the second answer. The relevant parts are noted below:
During install choose "Something Else"
Partition and format the USB drive
After having chosen Something else the graphical partition manager GParted will guide us through the partitioning process:
- At this point take extra care that the boot loader Grub indeed will be installed to the USB drive (/sda in the picture, but yours will be different) and not to anywhere else
See the bottom of the image above, and make your selection where it says: Device for bootloader installation. The bootloader is another name for the GRUB. It should be installed in the MBR of the external USB hard drive and not in one of its partition.
You will need at least one ext4
partition with a mount point root (/
). In the example above an additional /home
(also ext4
) partition was created. If in the future you need to reinstall Ubuntu, by unticking Format box you can keep the data in /home
partition. You will also want a small swap
partition of 4GB size (not shown in the picture) with no mount point, in its own Linux/Swap format to be used as virtual memory.
hope this helps
This is how I installed grub unto my external hard drive (GPT) which had Ubuntu 17.04 installed. When you do this it allows you to boot your Ubuntu on any PC which supports UEFI by using the grub on the external without relying on the PC grub. It can also serve as backup grub in case the is problem with EFI of Windows.
Installing Grub to an external hard drive that has Ubuntu installed
Boot into an Ubuntu live USB and connect the external hard drive.
List partitions of all devices:
lsblk
From the results of
lsblk
, identify the linux partition and also the efi partition of the external hard drive, i.e./dev/sdXY1
and/dev/sdXY2
respectively. ReplaceXY1
andXY2
with your own partition names.Special mount the linux partition:
sudo mount /dev/sdXY1 /mnt
Mount critical virtual filesystems:
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
chroot
into the Linux partition you mounted:sudo chroot /mnt
You are now in the external hard drive's linux filesystem.
Create the directory where grub would install its files:
mkdir -p /boot/efi
If it already exists, then skip to step 8.
Mount the efi partition from step 3:
mount /dev/sdXY2 /boot/efi
Install grub to the external hard drive:
grub-install /dev/sdX
Update grub:
update-grub
Find the UUID of the efi partition (aka 'vfat') and note it down:
blkid
or
ls -l /dev/disk/by-uuid
Now we need to tell fstab to mount that efi partition on boot:
cp /etc/fstab /etc/fstab.bak sudo nano /etc/fstab
Add the below two lines to fstab replacing xxxx-xxxx with the UUID from step 11:
#my modified fstab to mount external hard drive's esp UUID=xxxx-xxxx /boot/efi vfat umask=0077 0 1
Make sure to comment out the fstab entry of the Windows esp so it doesn't conflict.
Exit the chroot:
exit
Reboot the PC:
sudo reboot
At this point when you reboot and choose your external device from the EFI boot manager, it will boot to grub.
To make Ubuntu automatically boot when you insert the external and Windows to automatically boot when the external is not inserted you would have to create a custom boot entry for Ubuntu to point to the efi on the external drive:
Creating a custom boot entry for Ubuntu to point to efi on the external HD
From Windows EasyUEFI can add or remove boot entries.
From Linux efibootmgr can add or remove boot entries.
Alternative #1 – using EasyUEFI
In Windows download EasyUEFI, install it and run.
Choose the EFI options manager
Choose create 'new entry' with + sign
Choose Linux or other OS and give it a name in the description box
Select the FAT32 EFI partition on the external drive that contains the grub bootloader
Choose browse
Navigate to /efi/ubuntu/shimx64.efi or /efi/ubuntu/grubx64
Save
Move it to the top of the boot entries list
Restart
Alternative #2 – using efibootmgr
List boot menu entries:
efibootmgr
Create a boot entry:
efibootmgr -c [-L label] [-d /dev/sdX]
e.g.:
efibootmgr -c -L myubuntu -d /dev/sdX
This boot entry would automatically be the first entry.
/dev/sdX
is the external hard drive with the grub bootloader.You can now reboot and without your intervention Ubuntu would automatically boot when external hard drive is plugged in. When the external hard drive is not plugged in, the PC would skip our Ubuntu boot entry to the next entry which is probably Windows Boot Manager.
Best Answer
Due to the limitations of some BIOS, external hard drives are unable to be detected. A work around is to use USB drive to load GRUB which then run
configfile
of grub.cfg inside external hard drive. However GRUB uses data from BIOS to get the list of devices, thus external hard drive is still not visible. The solution is to use GRUB native driver to look for the external driver.Using
nativedisk
, all your USB devices will be detected by GRUB using GRUB's own drivers instead of data from BIOS. Once this is done, you can usels
normally inside the grub> console and all of your USB devices will be listed. By listing each device one by one, you then find the root of Linux installation, boot folder, grub folder, and grub.cfg. eg:ls (hd1,msdos2)/boot/grub/
output:grub.cfg
Using the command
configfile
, we will load the grub.cfg inside the external drive to boot to it. eg:configfile (hd1,msdos2)/boot/grub/grub.cfg
The grub.cfg in the USB drive can then be modified to run
nativedisk
andconfigfile (hd1,msdos2)/boot/grub/grub.cfg
automatically without user input.Example grub.cfg to put inside USB Grub Rescue