User Tools

Site Tools


howtos:serial_console

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

howtos:serial_console [d/m/Y H:i] (current)
Line 1: Line 1:
 +====== Serial Console ======
 +This guide is for Ubuntu Hardy Heron or other systems using upstart instead of sysvinit. If you're unsure about what type of system you're using just look for /​etc/​inittab. If it's there (and you didn't put it there) then it's a sysvinit system. If not then proceed.
 +
 +===== getty =====
 +Usually getty is installed default (getty is the daemon we're going to use for connecting through the serial console) but just to be sure run:
 +<​code>​
 +domingo@domingo-desktop:​~$ getty
 +Usage: getty [-8hiLmUw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,​... line [termtype]
 +or [-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,​... [termtype]
 +</​code>​
 +
 +===== Spawning getty =====
 +To get getty running on the system we need the file /​etc/​event.d/​ttyS0 :
 +
 +<​file>​
 +# 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
 +
 +respawn
 +exec /sbin/getty -L 9600 ttyS0 vt102
 +</​file>​
 +
 +This file setup a console server on the serial interface ttyS0 with the baud speed 9600 and terminal type vt102. You can select an other I just seem to able to remember this one better (I usually only use it when something is terribly wrong and thing need to be fixed fast) and the speed is fine for me.
 +
 +To invoke the settings without reboot run:
 +
 +<​code>​
 +sudo initctl start ttyS0
 +</​code>​
 +
 +If no errors occur just run a ps to check if the daemon has started correctly (or just attach a cable):
 +
 +<​code>​
 +root@server:​~#​ ps aux|grep 9600
 +root      8567  0.0  0.0   ​1716 ​  520 ttyS0    Ss+  18:40   0:00 /sbin/getty -L 9600 ttyS0 vt102
 +root      9035  0.0  0.0   ​3004 ​  768 pts/2    R+   ​19:​09 ​  0:00 grep 9600
 +</​code>​
 +
 +
 +===== Quick Setting Up Console =====
 +If you just need to put up a quick serial console server (ex. to test the communication ports) you can run the following command:
 +
 +<​code>​
 +sudo getty -L 9600 ttyUSB0 vt102
 +</​code>​
 +
 +This will make getty listen on the "​serial"​ device called ttyUSB0. In my case this is a usb-to-serial converter as my machine doesn'​t have a native serial interface.
 +Just change ttyUSB0 to ttyS0 if you have a real serial interface in your machine.
  
howtos/serial_console.txt · Last modified: d/m/Y H:i (external edit)