Skip to content

Instantly share code, notes, and snippets.

@jo-makar
Created May 8, 2020 03:40
Show Gist options
  • Save jo-makar/fdaff13ffd830c84b5e130f77a7632b2 to your computer and use it in GitHub Desktop.
Save jo-makar/fdaff13ffd830c84b5e130f77a7632b2 to your computer and use it in GitHub Desktop.
Install Debian over SSH

Create the modified ISO

mount -o loop debian-10.0.0-amd64-netinst.iso /mnt/loop
mkdir debian-10.0.0-amd64-netinst
shopt -s dotglob; cp -rv /mnt/loop/* debian-10.0.0-amd64-netinst/
umount /mnt/loop

dd if=debian-10.0.0-amd64-netinst.iso of=isohdpfx.bin bs=1 count=432

cp debian-10.0.0-amd64-netinst/.disk/mkisofs .
# modify the mkisofs:
# - remove options that begin with -jigdo and the -checksum_algorithm_iso and -md5-list options
# - change the -o option to the path of the to-be-created iso
# - change the -isohybrid-mbr to the isohdpfx.bin file created
# - change the final directories to be debian-10.0.0-amd64-netinst/

# an example of a modified mkisofs command:
xorriso -as mkisofs -r -V 'Debian 10.0.0 amd64 n' -o debian-10.0.0-amd64-netinst-1.iso -J -joliet-long -cache-inodes -isohybrid-mbr isohdpfx.bin -b isolinux/isolinux.bin -c isolinux/boot.cat -boot-load-size 4 -boot-info-table -no-emul-boot -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus debian-10.0.0-amd64-netinst.iso/

#
# replace the isolinux boot menu with a single preseed-based installation
#

cd debian-10.0.0-amd64-netinst/isolinux
cp isolinux.cfg isolinux.cfg.orig
# modify isolinux.cfg such that (replacing the ip of course):
diff isolinux.cfg.orig isolinux.cfg
4,5c4,7
< include menu.cfg
< default vesamenu.c32
---   
> default installssh 
> label installssh
>     kernel /install.amd/vmlinuz
>     append vga=788 initrd=/install.amd/initrd.gz --- quiet auto=true priority=critical interface=auto hw-detect/load_firmware=false url=http://10.0.0.117:8000/preseed.cfg
# the installssh portion is based on the contents of txt.cfg with the "auto=true ..." added
cd ../..

# run the mkisofs (xorriso) command generated above to build the iso
# and copy the new iso to a usb stick normally with dd

Create and host the preseed file

cat <<EOF >preseed.cfg
d-i debian-installer/locale string en_US
d-i keyboard-configuration/xkb-keymap select us

# the ssh username is installer
d-i preseed/early_command string anna-install network-console
d-i network-console/password password installer
d-i network-console/password-again password installer
EOF

# host the file on http://0.0.0.0:8000/preseed.cfg
# look for the ip of the connecting system in the output log
python3 -m http.server

# can workaround problematic network hardware by using a usb ethernet adapter

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment