Friday, November 07, 2008

Serial Console on Newer Ubuntu Systems

This is another one of those boring reference blog posts on things you don't do very often so you forget how to do them.

Starting with Edgy, Ubuntu uses upstart instead of good old init so you no longer use /etc/inittab to enable serial consoles.

See SerialConsoleHowto for details, but basically what basically what you do is create a file in /etc/event.d for all the devices you want to spawn a getty on.

root@cm1208:/etc/event.d# ls
control-alt-delete rc1 rc4 rc-default sulogin tty3 tty6
logd rc2 rc5 rcS tty1 tty4 ttyS0
rc0 rc3 rc6 rcS-sulogin tty2 tty5

Looking inside ttyS0

# ttyS0 - getty
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.

start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5

stop on runlevel 0
stop on runlevel 1
stop on runlevel 6

exec /sbin/getty 115200 ttyS0

and you can see the process running

root@cm1208:~# ps aux | grep ttyS0
root 547 0.0 0.0 3004 756 pts/2 R+ 09:40 0:00 grep ttyS0
root 4239 0.0 0.0 1716 512 ttyS0 Ss+ Oct23 0:00 /sbin/getty 115200 ttyS0

No comments: