2022-05-11

Serially install Debian (Debian over serial)

 

Installing Debian over serial

Installing Debian using serial is relatively straight forward and still very useful on a multitude of devices that can be installed, and managed, over serial. This include the PC-Engines APU Devices which can be booted on USB and installation performed over serial.

 

“Begin at the beginning," the King said, very gravely, "and go on till you come to the end: then stop.”

-Lewis Carroll, Alice in Wonderland

 

Prerequisites (the beginning)

You will need:
  1. Serial cable for your device.

  2. Serial terminal, such as minicom, picocom, GTKTerm, screen or Putty [3] if you’re on Windows.

  3. Debian 11, code name bullseye, netinst, for 64-bit PC (amd64) [1] or a media with additional non-free firmware, such as [2].

  4. USB Device to transfer the Debian ISO to.

Note: Debian netinst works well for APU devices as they're using AMD CPUs and Intel NICs - both vendors have been good Open Source contributors.

 

Burn ISO, burn to USB

As we will boot the system from USB, we will have to write the ISO to a suitable USB drive.

On Linux you have the option of using dd:

sudo dd if=debian-11.3.0-amd64-netinst.iso of=/dev/sdn bs=4096 status=progress
 
or
sudo dd if=firmware-11.3.0-amd64-DVD-1.iso of=/dev/sdn bs=4096 status=progress

Replace sdn with sdb, sdc, depending on what drives are already installed in your system. Please double-check that you’re not writing to other drives than the USB for this purpose. You will lose data if you’re not careful. (ask me how I know).

There’s also the graphical tool called popsicle on many Linux distros which is quite neat.

On Windows, you can use Rufus [4]

Note: The netinst iso is around 400M, while the "firmware" iso is just shy of 4G.

Aaaand action

Now plug the USB and the serial cable into the system, start your favorite serial terminal and power up the system to be installed.

Just remember.

USB Superposition

 

Hopefully you will now see Debian booting and, after a short while, show the installation menu.

BUT… if you just choose install now, it won't work, as the console is not shoved over serial for the rest of the installation, unless you do this.

Press the <TAB> key instead and replace quiet after the --- with:

console=ttyS0,115200n81

Replace quiet with console=ttyS0,115220n8

Note: Adjust port and its parameters to your specific device. The above works for APU boards (ttyS0 is the first serial port on that - please note uppercase S followed by a zero)

 

Then when the message below shows up, press space to start installation, or wait 30 seconds.

For installation press space or wait 30 seconds



You should now be able to complete the standard Debian installation process. Do remember to remove the desktop options and add SSH Server.



 

You should now be able to connect over SSH to the system.

Serial Killer

The freshly installed Debian may not work over serial after installation, if that is the case, change /etc/default/grub as follows:
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=15200 --unit=0 --word=8 --parity=no --stop=1"
 
Then run
sudo update-grub

Note: I have not had this problem with the latest builds, and have not taken the time to reproduce if it was my mistake or certain builds that caused it.

 

(The end)


References

[1] Debian 11 netinst: https://www.debian.org/distrib/netinst

[2] Unofficial Debian 11 with non-free firmware: https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/11.3.0+nonfree/amd64/iso-dvd/

[3] Putty for Windows: https://www.chiark.greenend.org.uk/~sgtatham/putty/

[4] Rufus: https://rufus.ie/en/




No comments: