You are hereMoving the Linux Console to the Serial Port

Moving the Linux Console to the Serial Port


By steve - Posted on 21 April 2005

These are the steps I used to convert a fedora core 3 dedicated-use server to be able to run headless (use a serial port console instead of mouse, keyboard, video).

It was taken from this Linux Journal article and skinnied down to what I needed (what applied to me).

The steps are:

  1. Tell GRUB about the serial terminal in /etc/grub.conf
  2. Tell inittab about the serial terminal in /etc/inittab
  3. Tell the system root can log in on the serial terminal in /etc/securetty file
  4. On Redhat/Fedora, stop the color status messages from messing up the serial terminal in /etc/sysconfig/init

I use GRUB, so the first thing was to change the /etc/grub.conf file:

# start: Options added for serial console (so you get the boot menu)
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console
# end: Options added for serial console
default=0
timeout=10
# note reference to console=ttyS0 here or you won't get boot messages:
title Red Hat Linux
root (hd0,1)
kernel /vmlinuz-2.4.20-8 ro root=LABEL=/ console=ttyS0,9600n8
initrd /initrd-2.4.20-8.img

Modify /etc/inittab to spawn console on serial interface using agetty. Set the run level to 3 and append a line for agetty:

id:3:initdefault:

co:2345:respawn:/sbin/agetty ttyS0 9600 vt100

Add ttyS0, to /etc/securetty so that root can login there.

Red Hat-based systems' newer bootup scripts use escape sequences so that the OK, PASS and FAIL messages show up in color. This can confuse serial consoles, so it is best to disable it. Modify /etc/sysconfig/init, and change the BOOTUP= line to say BOOTUP=serial.

Use a null cable and connect it from your laptop (the system running terminal emulation) to the server. Use any terminal emulation program to connect from your system's serial port (COM1: or whatever in Windows) to the serial port on the server (ttyS0).

Reboot the server to get these changes to take effect and you should get something like this in your terminal window:

Booting Fedora Core (2.6.11-1.14_FC3) in 0 seconds...
Booting 'Fedora Core (2.6.11-1.14_FC3)'
root (hd0,0)
Filesystem type is ext2fs, parti
kernel /vmlinuz-2.6.11-1.14_FC3 ro root=/dev/VolGroup00/LogVol00
console=ttyS0,9600n8
[Linux-bzImage, setup=0x1600, size=0x1937e5]
initrd /initrd-2.6.11-1.14_FC3.img
[Linux-initrd @ 0x7e76000, 0xf0dbf bytes]

Linux version 2.6.11-1.14_FC3 (bhcompile@bugs.build.redhat.com)
(gcc version 3.4.3 20050227 (Red Hat 3.4.3-22))
#1 Thu Apr 7 19:23:49 EDT 2005
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 00000000000a0000 (usable)
BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 0000000007f77000 (usable)
BIOS-e820: 0000000007f77000 - 0000000007f79000 (ACPI NVS)
BIOS-e820: 0000000007f79000 - 0000000008000000 (reserved)
BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
BIOS-e820: 00000000fee00000 - 00000000fee10000 (reserved)
BIOS-e820: 00000000ffb00000 - 0000000100000000 (reserved)
0MB HIGHMEM available.
127MB LOWMEM available.
Using x86 segment limits to approximate NX protection
DMI 2.3 present.
ACPI: PM-Timer IO Port: 0x808
Allocating PCI resources starting at 08000000 (gap: 08000000:f6c00000)
Built 1 zonelists
Kernel command line: ro root=/dev/VolGroup00/LogVol00
console=ttyS0,9600n8
Initializing CPU#0
CPU 0 irqstacks, hard=c0447000 soft=c0446000
PID hash table entries: 1024 (order: 10, 16384 bytes)
Detected 1594.786 MHz processor.
Using pmtmr for high-res timesource
Console: colour VGA+ 80x25

..etc..

Starting system logger: [ OK ]
Starting kernel logger: [ OK ]
Starting irqbalance: [ OK ]
Starting portmap: [ OK ]
Starting NFS statd: [ OK ]
Starting RPC idmapd: [ OK ]
Mounting other filesystems: [ OK ]
Starting lm_sensors: [ OK ]
Starting automount: No Mountpoints Defined[ OK ]
Starting nifd...
Starting vsftpd for vsftpd: [ OK ]
Starting postgresql service: [ OK ]
Starting console mouse services: [ OK ]
Starting crond: [ OK ]
Starting xfs: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
Starting anacron: [ OK ]
Starting atd: [ OK ]
Starting system message bus: [ OK ]
Starting cups-config-daemon: [ OK ]
Starting HAL daemon: [ OK ]
Starting webmin: [ OK ]

Fedora Core release 3 (Heidelberg)
Kernel 2.6.11-1.14_FC3 on an i686

server.domain.com login:
Password:

Tags

Did this help you? You can help me!


Did you find this information helpful? You can help me back by linking to this page, purchasing from my sponsors, or posting a comment!


+One me on Google:


Follow me on twitter: http://twitter.com/mojocode









Affiliation Badges