# Tersler disk image

`build-image.sh` builds a ready-to-boot Ubuntu 24.04 server image for the SSD.
After `dd`, the rig boots straight into SSH; no installer, no desktop, no
Xorg/Wayland, no snapd.

## Build (on any Linux PC with KVM, no root needed)

```bash
image/build-image.sh
```

- Customizes Ubuntu's official cloud image (`noble-server-cloudimg-amd64.img`,
  checksum verified) in a QEMU/KVM VM, then test-boots the result with UEFI on a
  40 GB virtual disk and logs in over SSH.
- Output: `image/out/tersler.img.zst` (+ `.sha256`) and
  `image/out/console-password.txt`. Both are git-ignored.
- Peak disk usage ~7 GB; the script checks first. Elsewhere: `OUT=/other/disk image/build-image.sh`.
- Settings via environment: `RIG_HOSTNAME` (tersler), `RIG_USER` (you),
  `RIG_SSH_KEY` (`~/.ssh/id_ed25519.pub`), `RIG_TZ` (Europe/Berlin),
  `RIG_KEYMAP` (de), `IMG_SIZE` (6G).

## What's in the image

- Ubuntu 24.04 server (cloud image base) with `linux-generic`, which includes
  `linux-modules-extra`, the hardware drivers the cloud kernel leaves out.
- User `$RIG_USER`: SSH key login only, passwordless sudo. The password in
  `console-password.txt` works on the local console only.
- DHCP on every wired port (`en*`), IPv4 + IPv6; mDNS via avahi.
- This project in `~/tersler`.
- Boot console on the VGA (`tty1`) and on `ttyS0`; a 3 s GRUB menu.
- GPT with an EFI partition and a BIOS boot partition: boots in UEFI and legacy mode.
- First boot on the rig: cloud-init (local seed only, no network
  datasource, network config untouched) grows the root partition to the whole
  SSD and generates new SSH host keys. Nothing else.

## Write it to the SSD

Connect the SSD to a PC (USB-SATA adapter or a spare SATA port). **Check the
device name twice**; `dd` overwrites whatever you point it at:

```bash
lsblk -o NAME,SIZE,MODEL,TRAN
```

```bash
zstdcat image/out/tersler.img.zst | sudo dd of=/dev/sdX bs=4M conv=fsync status=progress
```

Writes ~6 GB. Don't mount it afterwards; just put the SSD into the rig.

## First boot

1. BIOS: boot from the SSD (UEFI). Above 4G Decoding as in
   [hardware-notes.md](../docs/hardware-notes.md#bios-settings-set-before-installing-the-gpus).
2. Network cable into one of the Intel ports (not the management port).
3. After ~1 min:

   ```bash
   ssh tersler.local
   ```

   If mDNS doesn't resolve, look up the DHCP lease in your router.
4. Then follow [TODO.md](../TODO.md#install): `cd ~/tersler && sudo ./install/install.sh`.

Don't leave a second disk with the same image plugged in: both carry the
filesystem label `cloudimg-rootfs`.
