Original address: Http://2stech.ca/index.php/linux/linuxtutotials/tutorials/207-ubuntu-serial-console-login
If you have a server (regardless of size), it is usually a good thing to keep a serial terminal that you can use to log into the system. This short article will show how to configure the serial port on the server or PC so that it can be used as a landing terminal.
Premise
- You have enabled the serial port in the BIOS;
- The first serial port on the machine (called/DEV/TTYS0 in the Linux system) uses a connection mode of "115200 8n1", which is: Model rate 115200, 8 data bits, 1 stop bits, no parity. If the serial port does not support this way of communication, generally use "9600 8n1" mode;
- You have sufficient ability and confidence to edit and modify critical system files (such as/etc/inittab,/BOOT/GRUB/MENU.LST, etc.);
- You are using a serial (null modem) cable. It is also possible to use a USB to Serial adaptor, but the tty* must being changed to reflect your hardware.
Configuring the terminal login process
Newer versions of Ubuntu systems use upstart to boot. That's the first thing we're going to change.
If you look at the files in the/etc/init directory, you will find some existing Terminal Services configuration files, such as tty1.conf. Very simply, we can copy one of the files:
CP /etc/init/tty1.conf/etc/init/ttys0.conf
Then we modify the new ttys0.conf:
Will:
# Tty1-getty
Switch
# Ttys0-getty
Will:
# This service maintains a Getty in tty1 from the point of the system is
Switch
# This service maintains a Getty in ttyS0 from the point of the system is
Will:
Exec/sbin/getty-8 38400 Tty1
Switch
Exec/sbin/getty-l 115200 ttyS0 vt102
In theory, the comment portion of the file is not to be modified. But for readability and later maintenance, we still modify it.
When you have completed the above changes, the ttys0.conf file should look something like this:
# Ttys0-getty
#
# This service maintains a Getty in ttyS0 from the point of the system is
# started until it is shut down again.
Start on stopped RC runlevel=[2345]
Stop on RunLevel [!2345]
Respawn
Exec/sbin/getty-l 115200 ttyS0 vt1022
At this point, you can start the service:
sudo start ttyS0
Get! Now you can try to login with the serial port ~
Ubuntu Setup RS-232 serial login terminal (translation, excerpt)