Skip to content

Serial Consoles in RHEL6

I’m starting to get my server room set up again, so I can start experimenting with VAXes and VMS and things of that nature.

Several years ago, I build a terminal server. It’s a little Mini-ITX machines with a JetWay JNC92-230-LF motherboard with proprietary daughter board, the AD4COMC1, that adds four serial ports for a total of six. The idea was to use this as a terminal server for all my older hardware. Never really got around to it, because I didn’t seem to have the time. So it became a “core infrastructure” box, that hosts things like DNS, DHCP, VPN, et cetera.

I now have a some time to set up my VAXes again, so the project begins anew. I have two goals here. First, is to attach a permanent serial console to my machine, and second is to ensure that all the serial ports are working and can be attached to other machines.

First, I had to get all the IRQs set up right in the BIOS. This took some tinkering:

[root@sam ~]# cat /proc/tty/driver/serial 
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:0 rx:0 RTS|DTR
1: uart:16550A port:000002F8 irq:3 tx:0 rx:0 RTS|DTR
2: uart:16550A port:000003E8 irq:4 tx:0 rx:0 RTS|DTR
3: uart:16550A port:000002E8 irq:3 tx:0 rx:0 RTS|DTR
4: uart:16550A port:000004E0 irq:4 tx:0 rx:0 RTS|DTR
5: uart:16550A port:000004E8 irq:3 tx:0 rx:0 RTS|DTR

By default, the Linux Kernel only configures four serial ports. To enable the additional two, I had to add 8250.nr_uarts=6 to my kernel parameters.

So, I figure now the serial console is just as easy as adding another getty to inittab…but, boy-howdy, am I out of date. Apparently, RHEL6 uses part or all of Upstart as it’s init system, so no more inittab. Luckily, it’s fairly easy to add a new getty with Upstart. Just add a .conf file to /etc/init with the name of the terminal, and some other pertinant details. I have a VT420 that I’m running at 9600 8N1, so my configuration reflects this.

stop on runlevel [S016]
start on runlevel [23]

respawn
exec agetty -h -L -w /dev/ttyS0 9600 vt420

The getty will be named whatever the file is named. So, if it’s /etc/init/ttyS0.conf, then it will be called ttyS0. The initctl command can be used to reload the configuration and check the status of all the ttys:

[root@sam init]# initctl reload-configuration
[root@sam init]# initctl list
rc stop/waiting
tty (/dev/tty3) start/running, process 1262
tty (/dev/tty2) start/running, process 1260
tty (/dev/tty1) start/running, process 1258
tty (/dev/tty6) start/running, process 1268
tty (/dev/tty5) start/running, process 1266
tty (/dev/tty4) start/running, process 1264
plymouth-shutdown stop/waiting
control-alt-delete stop/waiting
rcS-emergency stop/waiting
kexec-disable stop/waiting
quit-plymouth stop/waiting
rcS stop/waiting
prefdm stop/waiting
init-system-dbus stop/waiting
splash-manager stop/waiting
start-ttys stop/waiting
ttyS0 start/running, process 731
rcS-sulogin stop/waiting
serial stop/waiting

As you can see ttyS0 is started. If it’s not, initctl start ttyS0 will start it.

Lastly, add a line for ttyS0 to /etc/securetty, so that root can log into the terminal directly

The next step is configuring GRUB to use the serial port as a boot console, but that will be for another day