To set a serial console in Debian Linux, you’ll need to make a few configuration changes to your system. Here’s an overview of the steps involved:
- Connect a serial cable between the Debian system and a serial terminal or another computer.
- Determine the name of the serial port. In Debian, serial ports are usually named
/dev/ttyS0
,/dev/ttyS1
, etc. You can use thedmesg
command to see the names of all serial ports detected by the system:
dmesg | grep tty
- Edit the
/etc/default/grub
file to configure the GRUB boot loader to use the serial port for console output. Add the following line to the file, replacing/dev/ttyS0
with the name of the serial port you determined in step 2:
GRUB_CMDLINE_LINUX="console=ttyS0,38400n8"
- Regenerate the GRUB configuration file by running the following command:
$ sudo update-grub
- Configure the serial port settings in the
/etc/inittab
file. Add the following lines to the file, replacing/dev/ttyS0
with the name of the serial port you determined in step 2:
T0:23:respawn:/sbin/getty -L ttyS0 38400 vt100
- Restart the system to apply the changes:
$ sudo shutdown -r now
After restarting the system, you should be able to use a serial terminal connected to the specified serial port to access the system console. If you’re using a serial terminal connected to another computer, make sure that the terminal settings match the settings specified in the /etc/inittab
file (38400 baud, 8 data bits, no parity, 1 stop bit).