Enabling a Serial Port Console: getty systemd

Using the serial port to login is a good way to get access to a device that doesn't have a network connection. This could be a small embedded Linux computer. 

On the device that you wish to log in to:

sudo nano /lib/systemd/system/serial-getty@.service

First we need to edit the serial-getty service to set the correct bard rate.

# Edit this line
ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM

# To This
ExecStart=-/sbin/agetty 115200 %I $TERM

Set this to the bard rate that you wish to use. This should be the same at the computer is using at the other end.

systemctl daemon-reload

# For a USB serial adaptor
systemctl enable serial-getty@ttyUSB0.service

# For a built in serial port /dev/ttyS0
systemctl enable serial-getty@ttyS0.service

You can now log in using the serial console on /dev/ttyUSB0 or /dev/ttyS0

Connect another computer to it using a NULL modem cable you need to open a terminal emulator such as minicom. Make sure you set the baud rate and port correctly.

You should then see a login prompt.