Serial Login

From YobiWiki
Jump to navigation Jump to search

Inspired by http://www.rajeevnet.com/linux/grub_serial_console.html but the Debian way.

Support in BIOS

I use 57600 as this is the speed set in my BIOS (yes, even BIOS management via serial!)

Support in Grub

Add to /boot/grub/menu.lst

# Setup serial (COM1) here with baudrate 57600
# use --unit=1 (for COM2) and so on
serial --unit=0 --speed=57600
#
# Now setup terminal as both Serial Line(/dev/ttyS0) and
# Monitor Console(/dev/tty0) depending upon where you press key
# with in timeout (15 sec) period. Otherwise first entry
# (console(Monitor)=>tty0) is selected here.
terminal --timeout=15  console serial

Then

update-grub

Support in Kernel

To get messages on both consoles, use "console=ttyS0,57600" and "console=tty0", modify these lines (but let them commented!) in /boot/grub/menu.lst to change kernel options

# defoptions=console=ttyS0,57600 console=tty0
# altoptions=(recovery mode) console=ttyS0,57600 console=tty0 single
# altoptions=(recovery mode via serial) console=tty0 console=ttyS0,57600 single

Then

update-grub

Support in console

Uncomment in /etc/inittab and change speed

T0:23:respawn:/sbin/getty -L ttyS0 57600 vt100

check if ttyS0 is well present in /etc/securetty to be able to login directly as root

Usage

You can use

  • minicom
  • socat (man pages of stty and termios can help understanding the tweaks of terminals
socat -,icanon=0,echo=0 /dev/ttyUSB2,raw,echo=0,b9600

With that socat command:

  • echo is ok, colors are supported, arrows also, ctrl-d
  • ctrl-c is local -> exit socat
  • To get ctrl-c working remotely instead of locally
    But then socat must be killed externally to quit:
socat -,icanon=0,echo=0,isig=0 /dev/ttyUSB2,raw,echo=0,b9600
  • If F1..F10 don't work in mc or other problems, this is probably because of a mismatch of terminfo.
    • You can use instead esc-1..esc-9, esc-0 (for F10) in mc
    • You can also simply fix the TERM variable according to your local terminal, which means sth like:
    • TERM=xterm;export TERM # if you are in an xterm
    • TERM=linux;export TERM # if you are in a text console