1

I'm trying to work out a process for remote installation of Ubuntu Server. I want to have someone at the other end insert a flash drive and boot up, then I will ssh in and install.

Here's the process I have worked out so far, based mostly on this blog post:

  1. Log in to the installer system using ssh.
  2. Partition the hard drives:
  • sda, sdb, and sdc - Three identical hard drives each with
    • a 500M vfat partition for EFI, and
    • the rest partitioned for RAID1 (md127).
  • md127 - two partitions,
    • /boot formatted as ext4, and
    • crypt_root encrypted using luksFormat
  • crypt_root
    • / - A single logical volume (LVM) formatted as ext4 (/dev/mapper/vgroot-vroot)

sda 8:0 0 1.8T 0 disk

├─sda1 8:1 0 476M 0 part

└─sda2 8:2 0 1.8T 0 part

└─md127 9:127 0 1.8T 0 raid1

├─md127p1 259:0 0 9.3G 0 part

└─md127p2 259:1 0 1.8T 0 part

└─crypt_root 252:0 0 1.8T 0 crypt

└─vgroot-vroot 252:1 0 1.8T 0 lvm

  1. Mount the filesystems (mnt/, mnt/boot, and mnt/boot/efi)
  2. Install the base system: sudo debootstrap mantic mnt http://ca.archive.ubuntu.com/ubuntu/
  3. Generate fstab:

sudo su - root -s /bin/bash -c 'genfstab -U /home/installer/mnt >> /home/installer/mnt/etc/fstab'

  1. Set up mnt/etc/crypttab:

crypt_root UUID=... none luks

  1. Set up mnt/etc/apt/sources.list:

deb http://ca.archive.ubuntu.com/ubuntu mantic main universe

deb http://ca.archive.ubuntu.com/ubuntu mantic-security main universe

deb http://ca.archive.ubuntu.com/ubuntu mantic-updates main universe

  1. chroot into the new system: sudo arch-chroot mnt
  2. Install ubuntu-server and some other packages, start ssh, add a sudo user, set up networking.
  3. Set up EFI:

update-initramfs -u

bootctl install

cp --dereference /boot/vmlinuz /boot/initrd.img boot/efi/

  1. Clone the EFI partitions:

dd if=/dev/sda1 of=/dev/sdb1 status=progress

dd if=/dev/sda1 of=/dev/sdc1 status=progress

  1. Use efibootmgr to remove the installer system (flash drive) and add sdb1 and sdc1
  2. Exit chroot, shut down, remove the flash drive, and start up.

On boot, I get a prompt for the encrypted drive's passphrase, which works, then when the system tries to load the root partition, it fails with the message 'UUID=... does not exist.' The UUID in the error message matches the root partition of the flash drive. I checked /etc/fstab and it has the correct UUID. How can I apply the correct configuration to the bootloader?

Jon Hulka
  • 121

1 Answers1

1

My solution was to change the EFI setup (step 11):

update-initramfs -u
bootctl install

Then edit the configuration file at /boot/efi/loader/entries/....conf and change the root UUID in the boot options (the correct UUID can be found in /etc/fstab)

I didn't need to copy vmlinuz or initrd.img

Jon Hulka
  • 121