With a preseed file, we can skip installation steps and even fully automate the installation. We started with creating a preseed file.
You can find the example preseed file for current Debian stable here. The preseed file below will skip the user creation step in setup and set the root password to 123456.
d-i passwd/root-login boolean true d-i passwd/make-user boolean false d-i passwd/root-password password 123456 d-i passwd/root-password-again password 123456
Debian installer supports both netboot installation and CD installation.
If you are using netboot installation, you only need to uncompress initrd.gz, then prepend the preseed file, and recompress it.
gunzip initrd.gz echo /path/to/the/preseed/file | cpio -H newc -o -A -F initrd gzip initrd
If you are using CD installation, you will need to install utility tools first.
apt install genisoimage libarchive-tools
Next, we want to extract the initrd from ISO.
mkdir isofiles bsdtar -C isofiles -xf /path/to/the/iso/file.iso # If you are using amd64 architecture: chmod +w -R isofiles/install.amd/ && cd isofiles/install.amd/ # If you are using i386 architecture: chmod +w -R isofiles/install.386/ && cd isofiles/install.386/
Then we want to add the preseed file to the initrd.
gunzip initrd.gz echo /path/to/the/preseed/file | cpio -H newc -o -A -F initrd gzip initrd && chmod -w -R ./ && cd ..
Last, we need to regenerate md5sum.txt and create a new ISO.
chmod +w md5sum.txt find -follow -type f ! -name md5sum.txt -print0 | xargs -0 md5sum > md5sum.txt chmod -w md5sum.txt cd .. genisoimage -r -J -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /path/to/the/output/file.iso isofiles