[CentOS] Clean serial console setup when using an USB to serial converter

David Knecht david.knecht at anyweb.ch
Wed Nov 19 15:55:41 UTC 2008


Hello all,

I'd like to connect to a CentOS 5.2 system's console through a 
null-modem cable. An USB to serial converter is connected to that 
system's USB port.

When using this configuration statement in "/etc/inittab"...

...
# Run gettys on serial line (that is, a serial line connected to USB0)
usb0:12345:respawn:/sbin/agetty -L ttyUSB0 9600 vt100
...

...I get these messages if (and only if) the converter is *not* 
connected to the system (thus, if no ttyUSB0 device has been dynamically 
created):

Nov 18 15:58:41 anyvizor init: Id "usb0" respawning too fast: disabled 
for 5 minutes
Nov 18 16:05:22 anyvizor init: Id "usb0" respawning too fast: disabled 
for 5 minutes
Nov 18 16:12:03 anyvizor init: Id "usb0" respawning too fast: disabled 
for 5 minutes

Apart from that, connectivity to the serially attached console works 
fine of the serial line is connected.

Obviously, I would like to have a clean setup without any errors where 
this kind of console setup works like a charm.

As a workaround (since I did not get any further on an inittab-based 
solution), I tried to configure udev to spawn "/sbin/agetty -L ttyUSB0 
9600 vt100" once the converter gets connected. This is my udev 
configuration:

[root at anyvizor rules.d]# pwd
/etc/udev/rules.d

[root at anyvizor rules.d]# cat 10-custom.rules
BUS=="usb", KERNEL=="ttyUSB*" SYMLINK+="usb_attached_console"
SUBSYSTEM=="usb_device", ACTION=="add", 
RUN+="/etc/udev/scripts/respawn_usb_attached_console.sh"
[root at anyvizor rules.d]#

[root at anyvizor scripts]# pwd
/etc/udev/scripts

[root at anyvizor scripts]# cat respawn_usb_attached_console.sh
#!/bin/env sh

getty_command_line="/sbin/agetty -L usb_attached_console 9600 vt100"

while [[ -e /dev/usb_attached_console && $(/usr/bin/pgrep -xf 
"${getty_command_line}" | /usr/bin/wc --lines) -eq 0 ]]
do
         eval "${getty_command_line}"
done
[root at anyvizor scripts]#

Again, connectivity to the serially attached console works fine once the 
system is up and running. However, the system does not pass the

Starting udev...

message displayed on the console (here, I mean the normal console 
screen, not the serially attached console) if (and only if) the USB to 
serial converter is connected when booting. The boot process continues 
fine once the converter gets disconnected.

Any hints for an inittab-based as well as an udev-based solution (or 
another concept to achieve the same result) is very welcome!

Thanks, David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3303 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.centos.org/pipermail/centos/attachments/20081119/144a8ee1/smime.bin


More information about the CentOS mailing list