GRUB installation failed when installing Zorin OS 16

When I try to install Zorin OS 16 this error occurs:

Ran into this problem once, too. I ended up saving the procedure in a text file, which I will summarize with the Arrow Below.
It is wordy for depth- don't let that scare you. It's explanitory but not really complicated.

Summary

Create an ESP on the Zorin HDD

A hard drive is not bootable with UEFI unless it has an ESP (EFI System Partition). An ESP is simply a FAT32 partition with a special flag that tells the EFI BIOS to look inside it for boot information. We have to create one on your hard drive.
Plug in your external HDD and the Zorin Linux bootable USB stick.
Boot with the Zorin Linux bootable USB stick using the option to try Zorin before installing.
Open a Terminal (Ctrl+Alt+T)
Run sudo fdisk -l to get a list of partitions.
Identify from them the drive that has the Linux partitions, in my case /dev/sdb. I'll call it /dev/sdX from now on.
Also identify the partition that contains the root filesystem. I will call it /dev/sdXY from now on.

Launch GParted from the Terminal:

sudo gparted /dev/sdX

Why not just click on GParted on your desktop? Well, I kept receiving errors about the Zorin Linux bootable USB stick because it was already in use. Of course it is, I am using it to run the computer off it...
Resize the first partition on disk to have another 200 Mb of free space after it.
Create a new partition on the free space, changing the file system to fat32.
Apply operations. You need to do that now for the next step to be possible.
Right click the new partition.
Click on Manage Flags.
Set the boot and esp flags. This is what makes the partition "special" to the EFI BIOS.
One more thing! Note down the the partition that contains the ESP filesystem. I will call it /dev/sdXZ from now on.

Make sure the Zorin installation on the external HDD can see the ESP

The new ESP on the external drive must be visible by the Zorin installation in the HDD. Otherwise GRUB2, the Linux bootloader, won't be able to update itself, making your system unbootable after the next kernel update at the latest.
Launch GParted from the Terminal, as we saw above:

sudo gparted /dev/sdX

Double-click the partition with your Linux root (/) filesystem on the external HDD
Note down the UUID, e.g. 01234567-89ab-cdef-0123-4567890abcde
Double-click the new FAT32 partition and note down the UUID, e.g. 0123-ABCD
Close GParted
Open a Terminal

The process is different depending on the format of your root partition on the external hard disk.

If you DID NOT use btrfs (e.g. you used ext4) (replace with YOUR UUID)

sudo umount /media/Zorin/01234567-89ab-cdef-0123-4567890abcde

sudo mount /dev/sdXY /mnt

If you DID use btrfs

If you DID use btrfs, you made your life complicated. We need to mount the btrfs subvolume containing the root partition instead of the entire partition. Otherwise you'll never be able to install GRUB and you'll probably lose an entire day, like me.

btrfs subvolume list /media/Zorin/01234567-89ab-cdef-0123-4567890abcde

This will give you a line with a numeric ID. Let's say 123. Note it down.

umount /media/Zorin/01234567-89ab-cdef-0123-4567890abcde

mount /dev/sdXY -o subvolid=123 /mnt

The rest of the instructions are common, no matter if used btrfs, ext4 or something else

sudo nano /mnt/etc/fstab

There is a line with /boot/efi already in this file. Comment it by placing a # in front of it.

Add the following line: UUID=0123-ABCD /boot/efi vfat defaults 0 1

Install GRUB2 on the external drive's EFI System Partition

Right now our external drive has an empty ESP. We need to put a bootloader in it to make it actually, well, bootable.

First caveat: all the instructions you find on-line assume you are using a dual boot system with Windows or macOS. When you have an external drive it is critical that you use the --removable option in the last step. This installs the EFI bootloader under the special "fallback path" EFI\Boot\bootx64.efi in the ESP. Normally this not supposed to be used for permanently installed Operating Systems. It's the mechanism used by EFI BIOS to boot arbitrary external media. Technically, that's exactly what our external hard drive is: arbitrary external media!

Second caveat: installing the bootloader is only possible from inside the Linux installation we want to boot. However, we need the bootloader to boot that installation, leading to a Catch-22 issue. The solution is to run the bootloader installation through a chroot jail. The actual caveat that got me stumped for a day comes from the fact that I am using btrfs (because it's so much better for SSDs!). btrfs has subvolumes. If you mount the entire partition instead of a subvolume the grub-install script can't figure out the mapping between paths and devices, therefore failing to install itself on the ESP, returning the cryptic error: /usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).

The error is misleading! /dev is mounted if you follow my instructions below. The actual problem, as I understand it, is that there is a discrepancy between the mounted device and the path to the chroot root. That's why I had you mount only the subvolume containing the root filesystem in the steps above. If you were not paying attention, you are not following the instructions step-by-step, you rebooted before this step or just came here directly looking for a solution to your problem about GRUB not installing look above for instructions on mounting the correct btrfs subvolume.

We need to prepare the chroot environment. The ESP must be mounted in the correct place and we have to bind system mount point for some special trees (most notably /dev). Moreover, we will copy the resolv.conf file to let the chroot environment have network access should it need it.

mount /dev/sdXZ /mnt/boot/efi

for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/$i; done

cp /etc/resolv.conf /mnt/etc/

modprobe efivars

Finally we enter the chroot environment and install Grub in a way suitable for a removable device (see the first caveat above).

Alternatively, you can try enabling or disabling UEFI in BIOS (use or do not use Legacy) and then try installing.

2 Likes

My old laptop did that too. In the end I had to disable uefi.

2 Likes

Hi glad issue solved, but can i just add that for the last 2 hours i was stopped in my tracks with the same issue and message. In my case i was doing a fresh install of zorin 16 beta. i tried grub repair, several fresh downloads and installs, and then i remembering a few years ago having the same problem on another linux distro install, how i got passed the problem was to turn off the internet connection whilst installing O/S from usb, thus preventing the upgrades and retrieving of files on the run during installation. Zorin 16 loaded correctly, and then i went on line and did the upgrades.
Hope this helps someone.

4 Likes

A post was split to a new topic: Grub install failed Zorin OS 16