for anyone interested, this is by far the easiest method i figured out to get Ubuntu Server booting from your Raspberry Pi 4 SSD (if you don’t have a USB-to-SATA adaptor to flash Ubuntu Server directly to the physical SSD 🧵
Discussion
what’s the problem? well, Ubuntu Server is a “headless” os, so it doesn’t actually have a UI, this means when running this os your only option is to SSH into your device (or physical keyboard + mouse but i didn’t have that option)
so, it’s easy enough to use the Raspberry Pi Imager program to flash an sd card (or thumb drive) with the Ubuntu Server .img, and the program gives some handy UI to also preconfigure your os install with your wifi SSID + password, and also setup and SSH hostname + username + password too (and set the timezone)
however, if you don’t have the ability to plug a physical SSD into your computer / laptop (i.e. a USB-to-SATA adaptor) then you lose the ability to actually install a headless os (like Ubuntu Server) directly to the SSD
or so i thought
but, Ubuntu Server seems to run this “program” on boot called “cloud-init” which can preconfigure your os install with the correct parameters which enables you to SSH into the device on your home network after first boot
you need three (3) main files to be present on your boot drive (/boot/firmware):
- user-data
- meta-data
- network-config
and the best part is, provided you want to use the exact same config that you used when flashing the os to your sd card, then those files ALREADY EXIST on the sd card boot drive!!
so if you have flashed Ubuntu Server to an sd card, booted from it on your rpi 4, but now you want to install Ubuntu Server onto your SSD that’s attached over USB storage, here’s what you do:
- wget “url.to.ubuntu.server.img”
- extract that file using “xz -d”
- use “sudo dd if= of= …” to flash the .img to your SSD (/dev/sda)
- mount the boot drive (probably /dev/sda1)
- then use “sudo cp” to copy the “meta-data”, “user-data” and “network-config” files FROM your sd card boot drive TO your currently mounted SSD boot drive
- then “sudo umount -l /dev/sda1” to unmount the SSD boot drive
- “sudo shutdown -h now” to shutdown the rpi 4
- unplug power from rpi4, remove sd card, and then power it on
- it should then boot directly from the SSD and then automatically use those files you copied over to preconfigure (i.e. “seed”) your os with the same wifi / SSD details that you used when you flashed the os to your sd card
so now you should be able to “ssh user@hostname”, then provide your password, and you should be running your fresh install of Ubuntu Server from your SSD!!
(“lsblk” to confirm)
it took me many days of fucking around as a noobie to figure this all out, but i finally did, and learned a bunch in the process!!
onto installing bitcoin core and all the other fun stuff now 😎