Installing Debian over a serial console

Some systems require an the OS installation over a serial interface. Examples for this are some embedded systems or virtual machines where a video output is not available for one reason or another.

This article is based on the description of the following pages, but updates the commands for a modern Debian distribution.

Start with downloading the installation disk from the Debian website, e.g. a netinstall ISO file and extract it to a local directory:

sudo mount -o loop,ro /dev/cdrom /mnt
sudo cp -r /mnt tmp-iso
sudo umount /mnt

Then modify the following files in your tmp-iso directory:

Edit the file isolinux/isolinux.cfg and add the serial 0 115200 and console 0 options:

serial 0 115200
console 0
path
include menu.cfg
default vesamenu.c32

Next, edit the file isolinux/txt.cfg and add the serial 0 115200 to every line with the append option:

kernel /install.amd/vmlinuz
#append vga=788 initrd=/install.amd/initrd.gz --- quiet
append priority=low vga=788 console=ttyS0,115200n8 initrd=/install.amd/initrd.gz --- console=ttyS0,115200n8

Finally, edit the file isolinux/adtxt.cfg and add the console=ttyS0,115200n8 to every line with the append option:

kernel /install.amd/vmlinuz
#append priority=low vga=788 initrd=/install.amd/initrd.gz ---
append priority=low vga=788 console=ttyS0,115200n8 initrd=/install.amd/initrd.gz --- console=ttyS0,115200n8

Use this command to create the new installation disk:

xorriso -as mkisofs -r -J -joliet-long -l -cache-inodes -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -partition_offset 16 -A "Debian 10.3" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /path/to/debian-10.3-serial-install.iso .

After the installation, edit /etc/default/grub and change the variable GRUB_TERMINAL like this:

GRUB_TERMINAL='serial console'

Activate the changes with update-grub.