Serial Console in Linux

Use a Null Modem Cable or Laplink Cable

Connect the cable between the serial ports of 2 systems. Run minicom, miterm or another terminal program and configure the communications port to use 115200 8 n 1 vt100/vt102.

On the other system, set up serial port communications as follows:


Enabling Grub Serial Console Support

In the global section of /boot/grub/grub.conf enter the following:

serial –unit=0 –speed=115200
terminal –timeout=2 serial console


Displaying kernel messages on one or more consoles

On each kernel line you wish, pass the correct console statement to the kernel (https://cpqlinux.b-cdn.net/boot/grub/grub.conf):

kernel /vmlinuz-2.4.20-18.8 ro root=LABEL=/ console=tty1 console=ttyS0,115200

The example above will display the init sequence on both consoles. The last console listed appears as the primary console to initscripts.


Optionally boot to text mode rather than X11 mode

X11 mode uses extra CPU cycles. If the local X11 console will not be used, then boot to text mode. Remember X11 can be started with “startx”. Also remember that this setting will not affect graphical applications that run here but display elsewhere.

In /etc/inittab, find the line that says id:5:initdefault: and change it to:

id:3:initdefault:


Provide a login prompt to the serial console

In /etc/inittab, below the 6 mingetty lines, add the following agetty line:

S0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100


Allow root to login via the serial console

To the end of /etc/securetty add the following line:

ttyS0


Disable Serial Port Probing

Serial port probing can cause problems so disable it. In /etc/sysconfig/kudzu, change the “SAFE=no” to the following:

SAFE=yes


Minicom usage info

Skip modem init with -o:
minicom -o
Exit minicom without reset:
CTRL-a q
Start minicom with logging turned on (and no modem init):
minicom -o -C mylogfile
Start/Stop logging from within minicom:
CTRL-a l

Published
Categorized as How To

By shibaa987

Linux kernel developer and a firmware developer with an experience of 10+ years.

Leave a comment

Your email address will not be published. Required fields are marked *