3

I have a brand new 2020 Mac mini (Intel i3 quad core chip). My install (dedicated Ubuntu NO dual boot) fails with the famous;

Executing 'grub-install /dev/nvme0n1' failed. This is a fatal error.

I have bypassed the T2 chip by booting into recovery mode and selecting "No Security" and "Allow booting from external drive". So when I turn on the Mac mini and hit the Alt key it shows me the two icons to select boot, the hard drive and the flash drive. My flash drive has the ubuntu-20.04-desktop-amd64.iso that has been made into a bootable USB by the startup disk creator on my working Ubuntu 14.04 LTS laptop.

No matter what I do the install fails and the Mac mini subsequently boots into an old Grub 2.04 with limited capabilities.

I am unable to follow this good advice Install ubuntu 18.04 on mac mini 2018 as I cannot install rEFInd in that manner.

I have tried several of the Matt Gadient (legend) bootable iso versions.

I have reformatted the entire drive as gpt using gparted and basically started from scratch but cannot find any partition combination that will let the installer complete (other than forcing it to install when there is no EFI partition in which case the installer does NOT fail but obviously the Mac mini fails to boot to anything).

I have tried several manual grub-install options from these pages but the most common error then is /cow is busy and it cannot be unmounted.

When I boot up with boot-repair the program runs but it does not detect anything. From that program if I terminal and lsblk it does not even show the nvme0n1 drive.

So, any ideas how I can get the installer to work or how I can manually install a grub?

3 Answers3

4

OK so this is what worked for me.
From the 20.04 iso on a USB let the installer do it's thing.
It will create a small partition with /boot/efi and take up the rest of the drive with /
as you know there is no need for a swap partition as Ubuntu now uses a swap file.
The installer will appear to fail as per my question above.
Executing 'grub-install /dev/nvme0n1' failed. This is a fatal error.
When you reboot you will get a limited grub terminal.
Full notes are here but below are the basics from rohiths answer;
At the grub console;

grub> ls

(memdisk) (hd0) (hd0,msdos) (hd1) (hd2) (hd2,gpt3) (hd2,gpt2) (hd2,gpt1)

You may not get exactly the same results as this, but you’ll have some similar options.

Now, find the partition which contains your user's home directory.

grub> ls (hd2,gpt2)/home

rohith/

Keep trying until you find it.

The result from the last step has two parts: (hdX,gptY). You need to keep the hdX part, but go through all the gptY options looking for a /boot/grub directory.

grub> ls (hd2,gpt2)/boot/grub

unicode.pf2 [...] grub.cfg

Now you want to set this as your root for further commands.

grub> set root=(hd2,gpt2)

The only way to boot properly was to use the UUID of the drive. To get it -

grub> ls -l (hd2,gpt2)

Note down the UUID. You'll have to type it manually in the next step.

grub> linux /boot/vmlinuz〈...tab here!...〉.efi.signed root=UUID=〈the UUID from above〉

The GRUB console can do tab completion, so if you just type out the vmlinuz part and hit tab, then hit . and tab again, you won't have to type the whole file name. make sure that the efi.signed part is present.

Now, set the initial RAM disk

grub> initrd /boot/initrd〈...tab here!...〉

You should be able to boot with the command

grub> boot

This will reboot and get you to the login screen as if you had a perfect install and rebooted. If you have an internet connection you can get the system up-to-date at this point but do NOT reboot untill you fix grub. NOTE the boot partition is incorrect, the boot loader actually needs to be reformatted as FAT32 with mount point /boot/efi with flags (boot,esp) which is done simply using gparted.
According to rohiths answer, The system was initially unbootable because the Mac bootloader expects the EFI partition to be formatted as HFS+, the typical Mac filesystem, while the Ubuntu installer actually formats it as VFAT. But this is NOT correct on my machine.
So now you can mount the new partition with boot/efi and re-install grub, check your config and update-grub then you can reboot.

  • there are multiple files possible after hitting tab. Which one should go into the <>? – Cassie Dec 03 '20 at 05:41
  • Do you mean the vmlinuz or the initrd? Can you list them? – darth_epoxy Dec 03 '20 at 07:29
  • There is a /boot/vmlinuz-5.8.0-43-generic file. No vmlinuz*.efi.signed file. I am installing ubuntu 20.04 along with macos on macbook pro 16 inch 2019 (intel i9 processor). Please provide solution, I am struggling for last few days, to dual boot ubuntu along with mac. :-( – rashok May 08 '21 at 18:41
  • Go with the /boot/vmlinuz-5.8.0-43-generic file as the installer may not have created the efi.signed version and I don't think that's a problem. Essentially by adding the UUID at this step you are telling grub what to boot when you choose Ubuntu. Also remember my scenario was not dual boot it was replacing the mac OS. – darth_epoxy May 09 '21 at 22:40
  • Ya this boots ubuntu without any issues, but everytime when I start this grub terminal is coming. And I am doing the above grub commands for every boot. Can you tell me how to save the above grub configurations ? – rashok May 10 '21 at 20:12
  • When you are logged in to the Ubuntu desktop session, open a terminal and type sudo update-grub (which is in the last line of my answer) :) – darth_epoxy May 10 '21 at 23:14
  • I don't have network connection in the "Try Linux" part, so whatever code needs to download any needed file doesn't work for me – lordvidex Feb 15 '22 at 13:51
2

I have the same problem when i install Ubuntu 20.04/10 on my Mac min. To solve this problem i boot to the Ubuntu live from my USB and in the terminal, i use this commands to repair grub. First eject any external drive.

sudo mkdir -p /mnt/drive

sudo mount /dev/nvme0n1p2 /mnt/drive sudo mount /dev/nvme0n1p1 /mnt/drive/boot/efi

sudo mount --bind /dev /mnt/drive/dev sudo mount --bind /dev/pts /mnt/drive/dev/pts sudo mount --bind /proc /mnt/drive/proc sudo mount --bind /sys /mnt/drive/sys

sudo cp /etc/resolv.conf /mnt/drive/etc/resolv.conf sudo chroot /mnt/drive su - <your username> sudo update-grub

0

There was an easier solution to this error for me. Use at your own risk. Be careful with the partitioning! Backup all your data.

I installed using encrypted luks ext4. dual boot

  • create a partition for ubuntu (using macos for example)
  • boot into ubuntu live 22.04 from usb
  • "try ubuntu"
  • install Ubuntu without a boot loader using ubiquity -b
  • click "something else"
  • delete the partition you created in macos so it says "free space
  • create a 1GB ext4 partition and map it to /boot
  • create an encrypted partition for the rest of the free space and map to /
  • hit install
  • reboot into live mode from usb again
  • install GRUB manually

Here is how I installed it manually (make sure the partition names match yours of course!):

sudo cryptsetup luksOpen /dev/nvme0n1p4 my_encrypted_volume
sudo mount /dev/mapper/my_encrypted_volume /mnt

sudo mount --bind /dev /mnt/dev && sudo mount --bind /dev/pts /mnt/dev/pts && sudo mount --bind /proc /mnt/proc && sudo mount --bind /sys /mnt/sys

sudo mount /dev/nvme0n1p3 /mnt/boot sudo mount /dev/nvme0n1p1 /mnt/boot/efi

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

sudo chroot /mnt

apt-get install grub-efi

grub-install --uefi-secure-boot --target=x86_64-efi --efi-directory=/boot/efi boot-directory=/boot --bootloader-id=GRUB --no-nvram --removable

sudo update-grub