Configuring a Remote Serial Console for SLES
This document (3456486) is provided subject to the disclaimer at the end of this document.
Environment
SUSE Linux Enterprise Desktop 10
Situation
Remote Management
Purpose
Configure access to a system using a serial connection, e.g. in order to manually trigger a kernel crash dump.
Resolution
- Another Linux system is to be configured to act as the serial console for a server, rather than, say, a data terminal or a Microsoft Windows system.
- On both systems, the null modem cable is attached to the first serial port ("COM1" in DOS-terminology).
- The server is booted using GRUB.
- The connection will use a baud rate of 115200, 8 data bits, 1 stop bit and odd parity ("115200 8N1").
- Connect a null modem cable between the system that will act as the console and the server. Refer to the Wikipedia article Null modem for details, including pin mapping.
- If the server's BIOS supports serial console, configure the BIOS for it. The details of this procedure are dependent on the BIOS vendor - refer to vendor documentation.
- Configure GRUB on the server to use the first serial port. In the file /boot/grub/menu.lst, comment out the color and gfxmenu lines and add the following lines:
serial --unit=0 --speed=115200
terminal --timeout=15 serial console
- Configure the kernel (and hypervisor) on the server to use the serial port. This configuration differs between Xen setups and non-Xen setups.
Non-Xen setup
In the file /boot/grub/menu.lst, add the following options to the kernel command line:console=tty0 console=ttyS0,115200
Kernel messages will be written to both tty0 and ttyS0, but OS messages will only be written to ttyS0. OS messages go to the last console defined on the boot options line.
A sample /boot/grub/menu.lst file illustrating these changes:#color white/blue black/light-grayXen setup
default 0
timeout 8
#gfxmenu (hd0,1)/boot/message
serial --unit=0 --speed=115200
terminal --timeout=15 serial console
title Linux ! SERIAL CONSOLE !
kernel (hd0,1)/boot/vmlinuz root=/dev/sda3 selinux=0 splash=0 resume=/dev/sda1 showopts elevator=cfq vga=791 console=tty0 console=ttyS0,115200
initrd (hd0,1)/boot/initrd
When Xen virtualization is used, both the Xen hypervisor and the Dom0 kernel need to be instructed to use the serial connection:- Add console=vga,com1 com1=115200 to the parameters for the hypervisor.
- Add console=tty0 console=xvc0,115200 to the parameters for the Dom0 kernel.
A sample /boot/grub/menu.lst file illustrating these changes:#color white/blue black/light-gray
default 0
timeout 8
#gfxmenu (hd1,0)/boot/message
serial --unit=0 --speed=115200
terminal --timeout=15 serial console
title Linux - Xen ! SERIAL CONSOLE !
kernel (hd0,1)/boot/xen.gz console=vga,com1 com1=115200
module (hd0,1)/boot/vmlinuz root=/dev/sda3 console=tty0 console=xvc0,115200
module (hd0,1)/boot/initrd - Configure the server to allow logins over the serial connection. In the file /etc/inittab, add the following line.
S0:12345:respawn:/sbin/agetty -L 115200 console vt102To allow single-user mode to work using the serial connection, additionally change the line
~~:S:respawn:/sbin/suloginin /etc/inittab to~~:S:respawn:/sbin/sulogin /dev/consoleNOTE: Single-user mode will only work on the serial console with this option. You will need to change it back, to run on the local console.
- Configure the serial port on the server as a secure port, so a login as root is possible on it without the need to log in as a regular user first.
Add linesconsoleto the file /etc/securetty
ttyS0
xvc0 - Ensure the package screen is installed on the server; this will be used later on to send control sequences to it.
The serial console connection can be used to perform "magic SysRq" control of the server, including triggering a kernel crash dump. This is particularly useful when analysing system hangs where "magic SysRq" via the system's keyboard is not working.
- Configure the server for kernel crash dump capture. Refer to the appropriate TID for details:
- TID 3374462, Configure kernel core dump capture, documents the Kdump method for SLE 10.
- TID 3044267, Configure lkcd to capture a kernel core dump, documents the lkcdutils method, primarily used with SLES9 and related products.
- Use a serial program like minicom on the serial console system to connect to the server over the serial port.
Login to the system as root to the serial console system and runscreen -S console /dev/ttyS0 115200
This sets up a screen session connected to the first serial port. To use this session, do the following:- Login as root to the serial console system from any machine on the network.
- Run the following command:
screen -x -r console
- On a reboot of the SUSE host, GRUB will prompt "Press any key to continue." If a key is pressed, then the GRUB menu will be displayed on the device used. If no key is pressed, the GRUB menu will be displayed on the serial console screen as defined by the terminal option in the/boot/grub/menu.lst file.
- The screen command allows for multiple users to attach and control the screen simultaneously. This allows for multiple people to participate in the troubleshooting process if necessary.
- To trigger a kernel crash dump:
Non-Xen setup
Send a break to the serial port and then the magic sysrq key. For example: Ctrl-A, Ctrl-B, d. Refer to the screen man page for more commands.
Xen setup
With the Xen hypervisor, the magic sysrq key is Ctrl-O; send Ctrl-O, d to trigger a crash dump.
Additional Information
- Glen Turner and Mark F. Komarinski,Remote Serial Console HOWTO
- Brian Jones, SysAdmin to SysAdmin: The beauty of screen
- Phil Hollenback, Using screen for remote interaction
TID History
Formerly known as TID# 10098503
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:3456486
- Creation Date: 31-Jan-2007
- Modified Date:04-Mar-2021
-
- SUSE Linux Enterprise Desktop
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com