[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Serial console inittab



Can someone help me out, I'm trying to fix the initial inittab for a serial
console install but my knowledge of 'sed' is lacking.

Somewhere between boot-floppies-2.1.2 and 2.1.5 changes have been made to
the sed expressions that modify the inittab file used for the first boot of
an installed system that uses a serial console ttyS or cua instead of a tty.

The original expressions:

  -e 's/^#\(T%d:.\+\)root\(.*\)/\1root TERM=%s\2/'
  -e 's/^\([1-6]\):/#\1:/'

modified the following section of the inittab:

------------------------------------------------------------
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
#  <id>:<runlevels>:<action>:<process>
# This line is special for the Debian installation system.
# This file will be replaced when installation completes.
1:2345:respawn:/bin/login root </dev/tty1 >/dev/tty1 2>&1
# 1:23:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6

# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/bin/login root </dev/ttyS0 >/dev/ttyS0 2>&1
#T1:23:respawn:/bin/login root </dev/ttyS1 >/dev/ttyS1 2>&1
# T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
# T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

------------------------------------------------------------

To produce the following for a serial console, commenting out all the ttys,
uncommenting the appropriate ttyS and adding TERM=xyz.

-------------------------------------------------------------
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
#  <id>:<runlevels>:<action>:<process>
# This line is special for the Debian installation system.
# This file will be replaced when installation completes.
#1:2345:respawn:/bin/login root </dev/tty1 >/dev/tty1 2>&1
# 1:23:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6

# Example how to put a getty on a serial line (for a terminal)
#
T0:23:respawn:/bin/login root TERM=xyz </dev/ttyS0 >/dev/ttyS0 2>&1
#T1:23:respawn:/bin/login root </dev/ttyS1 >/dev/ttyS1 2>&1
# T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
# T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

------------------------------------------------------------

Now the new expressions:

  -e 's/^#\(T%d:.\+\)root\(.*\)/\1root TERM=xyz\2/'
  -e 't x' -e b -e ':x' -e 's,/dev/[[:alnum:]]*,%s,g'  -- (%s = tyname(0))

don't comment out all the tty lines as I require, and I'm not sure if that
was deliberate or a bug.


Anybody got any ideas?

TIA
Nick


Reply to: