ergosteur

ergosteur / Debian Preseed for MCP Control

Last active 1 month ago

Like 0

Debian 13 (trixie) unattended netinst preseed Generic base-OS bootstrap — gets a blank VM to "Debian installed, SSH + sudo reachable" so provision-satellite.sh can take over from there. Not satellite-specific beyond that; hostname/domain are passed as separate boot params (hostname=... domain=...), not hardcoded here, so this file is reusable for any future from-scratch rebuild. Usage: serve this file over HTTP reachable from the VM's network, then at the installer's boot menu (Tab to edit on isolinux/BIOS boot): auto=true priority=critical url=http://<host>:<port>/debian-preseed.cfg hostname=<name> domain=<domain> See ../provision-satellite.sh and ../docs/ for the rest of the setup this hands off to.

debian-preseed.cfg Raw
1#### Debian 13 (trixie) unattended netinst preseed
2#### Generic base-OS bootstrap — gets a blank VM to "Debian installed, SSH +
3#### sudo reachable" so provision-satellite.sh can take over from there.
4#### Not satellite-specific beyond that; hostname/domain are passed as
5#### separate boot params (hostname=... domain=...), not hardcoded here, so
6#### this file is reusable for any future from-scratch rebuild.
7####
8#### Usage: serve this file over HTTP reachable from the VM's network, then
9#### at the installer's boot menu (Tab to edit on isolinux/BIOS boot):
10#### auto=true priority=critical url=http://<host>:<port>/debian-preseed.cfg hostname=<name> domain=<domain>
11
12### Localization
13d-i debian-installer/locale string en_CA.UTF-8
14d-i keyboard-configuration/xkb-keymap select us
15
16### Network
17d-i netcfg/choose_interface select auto
18d-i netcfg/get_hostname string unassigned-hostname
19d-i netcfg/get_domain string unassigned-domain
20d-i netcfg/wireless_wep string
21
22### Mirror
23d-i mirror/country string manual
24d-i mirror/http/hostname string deb.debian.org
25d-i mirror/http/directory string /debian
26d-i mirror/http/proxy string
27
28### Clock and time zone
29d-i clock-setup/utc boolean true
30d-i time/zone string America/Toronto
31d-i clock-setup/ntp boolean true
32
33### Account setup — normal user only, root login disabled (sudo instead).
34### Initial password is a dummy placeholder, overwritten in late_command to preseed-<MAC>.
35d-i passwd/root-login boolean false
36d-i passwd/user-fullname string debian
37d-i passwd/username string debian
38d-i passwd/user-password password bootstrap-temp-pw
39d-i passwd/user-password-again password bootstrap-temp-pw
40d-i user-setup/allow-password-weak boolean true
41d-i passwd/user-default-groups string sudo
42
43### Partitioning — dynamic first disk selection, guided layout, UEFI & BIOS safe
44d-i partman/early_command string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
45d-i partman-auto/method string regular
46d-i partman-auto/choose_recipe select atomic
47d-i partman-partitioning/confirm_write_new_label boolean true
48d-i partman/choose_partition select finish
49d-i partman/confirm boolean true
50d-i partman/confirm_nooverwrite boolean true
51
52### Package selection — minimal + SSH only + ca-certificates for HTTPS key fetch
53tasksel tasksel/first multiselect standard, ssh-server
54d-i pkgsel/include string sudo ca-certificates
55d-i pkgsel/upgrade select safe-upgrade
56popularity-contest popularity-contest/participate boolean false
57
58### Boot loader — dynamic device target for BIOS (MBR) and UEFI
59d-i grub-installer/only_debian boolean true
60d-i grub-installer/with_other_os boolean true
61d-i grub-installer/bootdev string default
62
63### Post-install setup — MAC fallback hostname, MAC password, and SSH key pull
64d-i preseed/late_command string \
65 MAC=$(ip link | awk '/ether/ {print $2; exit}'); \
66 HN=$(cat /target/etc/hostname 2>/dev/null); \
67 if [ "$HN" = "unassigned-hostname" ] || [ -z "$HN" ]; then \
68 SHORT_MAC=$(echo "$MAC" | tr -d ':'); \
69 HN="vm-${SHORT_MAC: -6}"; \
70 echo "$HN" > /target/etc/hostname; \
71 sed -i "s/unassigned-hostname/$HN/g" /target/etc/hosts; \
72 fi; \
73 in-target sh -c "echo debian:preseed-$MAC | chpasswd"; \
74 in-target mkdir -p /home/debian/.ssh; \
75 in-target wget -O /home/debian/.ssh/authorized_keys https://git.ergosteur.com/ergosteur.keys; \
76 in-target chown -R debian:debian /home/debian/.ssh; \
77 in-target chmod 700 /home/debian/.ssh; \
78 in-target chmod 600 /home/debian/.ssh/authorized_keys
79
80### Finish installation
81d-i finish-install/reboot_in_progress note
82d-i cdrom-detect/eject boolean true