2

I have a 2017 iMac and am trying to install Ubuntu on an external USB3 drive. The external drive has a GPT partition table (no hybrid MBR) and is partitioned like so:

/dev/sda1: EFI partition
/dev/sda2: Windows-To-Go partition
/dev/sda3: ext4 Linux boot partition
/dev/sda4: LUKS / LVM partition
/dev/sda5: extra partition, not currently being used

The LVM group that's available once the LUKS partition is decrypted contains an ext4 partition intended to be the main partition for my linux system, and a swap partition.

I'm using refind on my mac to facilitate booting these different operating systems.

When I installed Ubuntu, I made sure all of my partitions were already decrypted and mounted, I picked manual disk setup in the installer (as I didn't want it to blow away my whole external disk including the Windows installation) and manually specified the following:

  1. /boot as the mount point for /dev/sda3
  2. / as the mount point for the main ext4 partition in my LVM group
  3. grub should be installed to /dev/sda3

The installer finished without errors. When I reboot, however, I have two options for how to boot this Ubuntu installation, and neither one works.

I can boot from a grub bootloader installed in the EFI partition of my internal hard drive. Note that I did not want Linux or any other operating system adding their bootloader to this drive. I just want it to remain a normal macOS drive with the addition of refind. Nonetheless, if I boot from it using refind, it shows the Ubuntu logo before dropping me to an (initramfs) prompt with no error messages at all.

If I pick the bootloader I specified should be installed to /dev/sda3, it starts loading, fails with the following errors:

mount: can't find /root in /etc/fstab
...
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting /run on /root/run failed: No such file or directory
run-init: current directory on the same filesystem as the root: error 0
Target file system doesn't have requested /sbin/init
run-init: current directory on the same filesystem as the root: error 0
(repeats four more times)
No init found. Try passing init= bootarg.

...and then drops me to a (initramfs) prompt.

I have no idea how to fix this! I tried using Boot-Repair but it made no difference at all. Help!

2

I finally got it working! Thanks largely to this answer for another encryption related question. I didn't end up encrypting my boot partition as I didn't think it was necessary, but there were a few key things I did differently from above. It seems the major issue was that the Ubuntu installer couldn't figure out exactly how my partitions were set up, so it was necessary to chroot into the new linux install, make some changes that indicate what's going on, and then reinstall grub. Here's what I did:

  1. I formatted /dev/sda3 as ext2. (Not sure if that was important.)
  2. When installing, I specified that the bootloader should be installed to /dev/sda not /dev/sda3
  3. I specified /dev/sda1 as EFI Boot Partition
  4. After installation finished successfully, I told it not to reboot, and I did the following in a terminal:

    sudo mount /dev/mapper/my_linux_lvm_partition /target sudo mount /dev/sda3 /target/boot sudo mount /dev/sda1 /target/boot/efi sudo mount --bind /dev /target/dev sudo mount --bind /proc /target/proc sudo mount --bind /sys /target/sys sudo chroot /target

  5. Now that I chroot'ed into my installation, I edited /etc/default/grub and added the line: GRUB_ENABLE_CRYPTODISK=y

  6. Got the UUID of my various partitions using blkid

  7. Added a line to /etc/crypttab: my_luks_partition_name UUID=<UUID of /dev/sda4> none luks,discard

  8. sudo grub-install --target=x86_64-efi --efi-directory /boot/efi --bootloader=ubuntu --boot-directory=/boot/efi/EFI/ubuntu --recheck

  9. sudo grub-mkconfig -o /boot/efi/EFI/ubuntu/grub.cfg

  10. sudo update-initramfs -c -k all

I noticed it was important to get the name of the LUKS partition correct, otherwise there would be errors when running update-initramfs.

This took me two whole days of hair pulling frustration to figure out. I only hope that this information will help someone else do it too without nearly so much agony.

| improve this answer | |

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.