SUSE Support

Here When You Need Us

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 Server 10
SUSE Linux Enterprise Desktop 10

 

Situation

Serial Console
Remote Management

Purpose

Configure access to a system using a serial connection, e.g. in order to manually trigger a kernel crash dump.

 

Resolution

Assumptions
  • 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").
Configuration Steps
  1. 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.
     
  2. 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.
  3. 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
     
  4. 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-gray
    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
     
    Xen setup

    When Xen virtualization is used, both the Xen hypervisor and the Dom0 kernel need to be instructed to use the serial connection:
    1. Add console=vga,com1 com1=115200 to the parameters for the hypervisor.
    2. 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
  5. 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 vt102
     
    To allow single-user mode to work using the serial connection, additionally change the line
    ~~:S:respawn:/sbin/sulogin
    in /etc/inittab to
    ~~:S:respawn:/sbin/sulogin /dev/console
    NOTE: 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.
     
  6. 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 lines
    console
    ttyS0
    xvc0
    to the file /etc/securetty
  7. Ensure the package screen is installed on the server; this will be used later on to send control sequences to it.
Triggering kernel crash dumps using the serial console

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.
  1. Configure the server for kernel crash dump capture. Refer to the appropriate TID for details:
  2. 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 run
    screen -S console /dev/ttyS0 115200

    This sets up a screen session connected to the first serial port. To use this session, do the following:
    1. Login as root to the serial console system from any machine on the network.
    2. Run the following command:
      screen -x -r console
    3. 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.
    4. 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.
    5. 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

Related materials
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

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.