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:
- Log in to the installer system using ssh.
- 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
- Mount the filesystems (mnt/, mnt/boot, and mnt/boot/efi)
- Install the base system:
sudo debootstrap mantic mnt http://ca.archive.ubuntu.com/ubuntu/ - Generate fstab:
sudo su - root -s /bin/bash -c 'genfstab -U /home/installer/mnt >> /home/installer/mnt/etc/fstab'
- Set up mnt/etc/crypttab:
crypt_root UUID=... none luks
- 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
- chroot into the new system:
sudo arch-chroot mnt - Install ubuntu-server and some other packages, start ssh, add a sudo user, set up networking.
- Set up EFI:
update-initramfs -u
bootctl install
cp --dereference /boot/vmlinuz /boot/initrd.img boot/efi/
- Clone the EFI partitions:
dd if=/dev/sda1 of=/dev/sdb1 status=progress
dd if=/dev/sda1 of=/dev/sdc1 status=progress
- Use efibootmgr to remove the installer system (flash drive) and add sdb1 and sdc1
- 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?