Linux Remote Serial Console Howto - notes
LDP: Remote Serial Console Howto
Env:
OS -- Red Hat Linux 9, Fedora Core 2
boot loader -- GRUB
Modify steps:
1. GRUB parameter:
bash# vi /etc/grub.confAdd below 2 lines to set the serial console as 9600/8/n/1, and 10 secs timeout.
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1Add a single user mode option to GRUB menu
terminal --timeout=10 -dumb serial console
title Red Hat Linux (2.4.9-21) single user mode2. Kernel parameter in GRUB
lock
root (hd0,0)
kernel /vmlinuz-2.4.9-21 ro root=/dev/hda6 s
initrd /initrd-2.4.9-21.img
Add the kernel parameter for serial console
title Red Hat Linux (2.4.9-21)3. Install mgetty
root (hd0,0)
kernel /vmlinuz-2.4.9-21 ro root=/dev/hda6 console=tty0 console=ttyS0,9600n8
initrd /initrd-2.4.9-21.img
The mingetty which was installed can not use for serial console.
Please get mgetty and install it.
4. Add mgetty as ttyS in /etc/inittab
co:2345:respawn:/sbin/mgetty ttyS5. Configure /etc/mgetty+sendfax/mgetty.config for ttyS0
port ttyS06. Remove mingetty entry from /etc/inittab
speed 9600
direct yes
data-only yes
toggle-dtr yes
need-dsr yes
port-owner root
port-group root
port-mode 600
login-prompt @ \P login:\040
login-time 60
term vt102
1:2345:respawn:/sbin/mingetty tty1Then restart init
# Additional virtual terminals are not used
2:2345:off:/sbin/mingetty tty2
3:2345:off:/sbin/mingetty tty3
4:2345:off:/sbin/mingetty tty4
5:2345:off:/sbin/mingetty tty5
6:2345:off:/sbin/mingetty tty6
bash# telinit q7. Edit /etc/securetty to allow root login from serial console
add 'ttyS0' in /etc/securetty
8. Change init level to textual ( run level 3)
bash# vi /etc/inittabfind
id:5:initdefault:edit as
id:3:initdefault:9. Remove saved console setting
bash# rm -f /etc/ioctl.save10. Alter target of /dev/systty
bash# cd /etc/makedev.dfind
bash# fgrep systty *
linux-2.4.x:l systty tty0
bash# vi linux-2.4.x
l systty tty0edit as
l systty ttyS0save it, then re-create /dev/systty
bash# cd /dev11. PAM configure
bash# rm systty
bash# ./MAKEDEV systty
bash# vi /etc/security/console.permsAdd sconsole =ttyS0
Then modify the remaining entries from console to sconsole
12. Configure Red Hat Linux
bash# vi /etc/sysconfig/init
set it as:
BOOTUP=serial
PROMPT=no
bash# vi /etc/sysconfig/kudzu
set it as:
SAFE=yes
Then you can reboot and test it.
1 意見:
補充 LILO 的修改:
LILO boot loader sample configuration:
serial=0,9600n8
timeout=100
restricted
password=PASSWORD
The password should be good, as it can be used to gain root access.
The LILO password is stored in plain text in the configuration file, so it should never be the same as any other password. The permissions on the configuration file should be set so that only root can read /etc/lilo.conf.
bash# chmod u=rw,go= /etc/lilo.conf
LILO has an option to display a boot message. This does not work with serial consoles. Remove any lines like:
message=/boot/message
LILO is now configured to use the serial console.
For each image entry in /etc/lilo.conf add the line:
append="console=tty0 console=ttyS0,9600n8"
Sometimes the append line will already exist. For example
append="mem=1024M"
In this case, the existing append line is modified to pass all the parameters. The result is:
append="mem=1024M console=tty0 console=ttyS0,9600n8"
Now that we have finished configuring LILO, use the lilo command to install the new boot record onto the disk:
bash# chown root:root /etc/lilo.conf
bash# chmod u=rw,g=,o= /etc/lilo.conf
bash# lilo
Added linux *
Post a Comment