2

I have linux mint 19 installed on /dev/sda5. Recently I connected an external drive and installed Ubuntu 18.04 LTS on that (/dev/sdb2). After that, I could no longer boot my original Mint installation (except the external drive was present). It just went into the black grub screen with prompt.

My assumption was, that grub was newly installed on the external drive (which is expected, as I want that to be bootable on its own), and somehow the old grub installation then was forgotten. So I repaired grub, through use of a live cd and chroot method.

But now if I reconnect the external drive, I cannot choose to boot from that in BIOS boot selection.

It seems my two grub installations are somehow incompatible, but why and how can that be fixed?

Additional Info: Both disks have grub2 installed, both use EFI and gpt. I have one EFI partition on sda and have another one on sdb, as without EFI partition grub wouldn't install (and I did not want to reference the EFI partition on sda, as I want the Ubuntu to be able to boot on its own at other machines).

Update: I have found /boot/efi/EFI/ubuntu present in my (repaired) Mint 19 installation (without external drive attached). There are no other folders in /boot/efi and /boot/efi/EFI I don't know if that means anything, as Mint 19 is based on Ubuntu, and there is no /boot/efi/EFI/mint or similar directory there. The EFI partition on the external drive is completely empty as is the /boot/efi folder on my ubuntu installation. I guess I will have to put some research into how to enforce the usage of the right EFI partition.

Just now I got an update of grub2, that gave an error when it tried to run grub-install:

Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.

But the system does boot normally. There is no EFI partition mounted.

Update 2 Ok, it seems there are general problems with installing EFI on anything else than the first partition (usually /dev/sda), see eg here. The fstab on my external Ubuntu install has this line:

# /boot/efi was on /dev/sda1 during installation
UUID=8A3D-B724  /boot/efi       vfat    umask=0077      0       1

That proves, that the installation ignored the option for EFI partition that I chose.

  • Once booted into your Mint, have you checked the contents of /boot/efi/EFI? Did you end up with mint and ubuntu side by side, or does mint (cheekily) install its bootloader to /boot/efi/EFI/ubuntu? – Philip Couling Apr 5 at 23:10
  • @PhilipCouling I checked, and yes, I found /boot/efi/EFI/ubuntu, will update the question accordingly – Paul Apr 6 at 9:06
1

When you install Ubuntu (and probably Mint too) in UEFI mode, the bootloader goes into the first drive (typically the internal one), /dev/sda, into the EFI system partition on that drive. This happens even if you tell the system to install it into another drive.

If you want the second drive to be portable and the booting to work, when the second drive is removed, you should disconnect (or unplug) the first drive before you start installing.

The following link may help,

How do I install Ubuntu to a USB key? (without using Startup Disk Creator)


In order to repair the boot system in the first drive (typically the internal one), you should disconnect the second drive before you start the repair actions.


Edit:

If you cannot disconnect/remove an internal drive there are workarounds:

  • Disable the internal drive in an UEFI/BIOS menu

  • The flag method

    a. Make a note on paper of the flags of the EFI partition in the internal drive

    b. Remove the flags from the EFI partition in the internal drive (for example with gparted, when booted from a live drive)

    c. Perform the installation

    d. Restore the flags to the EFI partition in the internal drive (with gparted booted from a live drive).

I have disconnected/removed the drive, and I know people who have disabled it in an UEFI/BIOS menu, and I have read about modifying the flags, but have no own experience of the flag method.

  • 1
    Removing all other drives ought to work of course, but not for all machines it is possible to just remove one, or all drives. – Paul Apr 7 at 10:22
1

If one already has run into the situation, and does not want to install everything anew, with all other disks disconected as sudodus suggests in his answer, I found a way:

First, if the main system cannot boot on its own, disconnect the external drive and boot from a live cd, or live usb flash drive. If not present in the live session, install the tool "boot-repair" (details for advanced use and install here, by typing in the terminal

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

the very last part of that && boot-repair will immediately start it, if the install was successful. It is has a GUI that is quite self-explanatory. Repair the boot of the main system, then restart.

Second, when the main system boots again, boot into that, connect the external drive. Copy the entire content of EFI/ubuntu on internal drive's EFI partition (/dev/sda1 in this case) to the external drive's EFI partition twice. Once to EFI/ubuntu there and once to EFI/Boot. And then in EFI/Boot rename shimx64.efi to bootx64.efi.

Now on the external ubuntu root partition edit the file etc/fstab and find a line like this:

# /boot/efi was on /dev/sda1 during installation
UUID=8A3D-B724  /boot/efi       vfat    umask=0077      0       1

replace the UUID 8A3D-B724, which should belong to your main system's EFI partition with the UUID of the external EFI partition. One can find that with the command blkid or if one prefers a GUI application, one can use Disks, or Gparted.

After that is done, the external drive is bootable.


Also see:

Full install to USB flash drive, UEFI Boot

  • +1 Thanks for sharing your solution :-) – sudodus Apr 8 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.