3

I'm trying to set up serial console on CentOS 6.2.

I've been able to get a login console, but if I try to enable grub and the kernel log showing on the serial port, grub keeps being terminated every few seconds.

This is my current config:

/etc/init/serial-ttyS1.conf:

# This service maintains a getty on /dev/ttyS1.

start on stopped rc RUNLEVEL=[2345]
stop on starting runlevel [016]

respawn
exec /sbin/agetty /dev/ttyS1 115200 vt100-nav

/boot/grub/grub.conf:

#boot=/dev/sda
default=0
timeout=5
#splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
serial --unit=1 --speed=19200
terminal --timeout=8 console serial

title CentOS (2.6.32-220.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=jp106 rd_LVM_LV=VolGroup/lv_root quiet rd_NO_DM console=tty0 console=ttyS1,19200n8
        initrd /initramfs-2.6.32-220.el6.x86_64.img

Note the two console flags at the end of the kernel command switches (console=tty0 console=ttyS1,19200n8). If they are removed, the problem doens't manifest itself any more, but I also lose grub and the boot log in the serial console.

Here is a sample from /var/log/messages:

Aug 27 14:14:24 ovesh-centos-62 init: serial-ttyS1 main process ended, respawning
Aug 27 14:14:25 ovesh-centos-62 init: serial (ttyS1) main process (1614) terminated with status 1
Aug 27 14:14:25 ovesh-centos-62 init: serial (ttyS1) main process ended, respawning
Aug 27 14:14:26 ovesh-centos-62 init: serial (ttyS1) main process ended, respawning
Aug 27 14:15:25 ovesh-centos-62 init: serial-ttyS1 main process ended, respawning
Aug 27 14:15:35 ovesh-centos-62 init: serial (ttyS1) main process (1731) terminated with status 1
Aug 27 14:15:35 ovesh-centos-62 init: serial (ttyS1) main process ended, respawning

NOTE: I've seen other people getting "respawning too fast" messages in their log, but this is not the case here.

Ovesh
  • 175
  • 1
  • 3
  • 12

2 Answers2

1

Try to find where the error occures.

Disable serial everywhere, except grub config. Can you see grub menu on serial port while booting?

Boot without any serial console options and try to launch agetty /dev/ttyS0 115200 -a root. Does this command fail? Can you login on serial port when this command is running?

Then try the same test with agetty /dev/ttyS0 115200 vt100-nav

Selivanov Pavel
  • 2,126
  • 3
  • 23
  • 47
  • I haven't had time to debug this yet, but thanks for the answer. I'll report further once I have more data. – Ovesh Sep 06 '12 at 07:01
  • OK, that turned out to be very helpful. Turns out you don't need to add the config for `/etc/init/serial-ttyS1.conf` to get a shell. Passing a `console` argument to the kernel (e.g., `console=ttyS1,19200n8`) is enough. So I'm guessing there were two processes constantly trying to start agetty (maybe killing each other?), which caused it to keep failing. – Ovesh Sep 07 '12 at 05:02
0

As I mentioned in one of the comments:

Turns out you don't need to add the config for /etc/init/serial-ttyS1.conf to get a shell.

Passing a console argument to the kernel (e.g., console=ttyS1,19200n8) is enough.

So I'm guessing there were two processes constantly trying to start agetty (maybe killing each other?), which caused it to keep failing.

Ovesh
  • 175
  • 1
  • 3
  • 12