Quick and dirty way to configure serial consoles on UNIX-like Systems
/etc/init/ttyS0.conf
with the following contents for a console on 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 stopped rc or RUNLEVEL=[2345] stop on runlevel [!2345] respawn exec /sbin/getty -L 9600 ttyS0 vt102
sudo start ttyS0
/etc/default/grub
and add/edit the following lines:GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0,9600n8" GRUB_TERMINAL=serial GRUB_SERIAL_COMMAND="serial --speed=9600 --unit=0 --word=8 --parity=no --stop=1"
sudo update-grub
ttyS0
to /etc/securetty
to allow direct root login on the serial console.
console="comconsole"
to the /boot/loader.conf
file.echo 'console="comconsole"' >> /boot/loader.conf
/etc/ttys
and find the ttyu0
entry.# Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. ttyu0 "/usr/libexec/getty std.9600" dialup off secure
# Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. ttyu0 "/usr/libexec/getty std.9600" vt100 on secure
CentOS 6.5 and later Fedora based systems are really easy. The init scripts see if a serial console was configured in grub, and if so then they start one up when the OS boots.
/etc/grub.conf
serial --unit=0 --speed=38400 terminal --timeout=10 console serial
console=hvc0 hvc0=38400,8n1
in each kernel
line somewhere after the kernel directive# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You do not have a /boot partition. This means that # all kernel and initrd paths are relative to /, eg. # root (hd0,0) # kernel /boot/vmlinuz-version ro root=/dev/xvda1 # initrd /boot/initrd-[generic-]version.img serial --unit=0 --speed=38400 terminal --timeout=10 console serial default=0 timeout=5 splashimage=(hd0,0)/boot/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.32-431.3.1.el6.x86_64) root (hd0,0) kernel /boot/vmlinuz-2.6.32-431.3.1.el6.x86_64 ro console=hvc0 hvc0=38400,8n1 root=UUID=a07c785e-c423-4146-b434-42c191ad0419 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet initrd /boot/initramfs-2.6.32-431.3.1.el6.x86_64.img title CentOS (2.6.32-431.1.2.0.1.el6.x86_64) root (hd0,0) kernel /boot/vmlinuz-2.6.32-431.1.2.0.1.el6.x86_64 ro console=hvc0 hvc0=38400,8n1 root=UUID=a07c785e-c423-4146-b434-42c191ad0419 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet initrd /boot/initramfs-2.6.32-431.1.2.0.1.el6.x86_64.img