Chapter 5. Configure Linux kernel

Table of Contents
5.1. Configure Linux kernel using LILO
5.2. Configure Linux kernel using GRUB
5.3. Configure Linux kernel using SYSLINUX

The Linux kernel is configured to select the console by passing it the console parameter. The console parameter can be given repeatedly, but the parameter can only be given once for each console technology. So console=tty0 console=lp0 console=ttyS0 is acceptable but console=ttyS0 console=ttyS1 will not work.

When multiple consoles are listed output is sent to all consoles and input is taken from the last listed console. The last console is the one Linux uses as the /dev/console device.

The syntax of the console parameter is given in Figure 5-1.

Figure 5-1. Kernel console syntax, in EBNF

console=ttyS<serial_port>[,<mode>]
console=tty<virtual_terminal>
console=lp<parallel_port>
console=ttyUSB[<usb_port>[,<mode>]

<serial_port> is the number of the serial port. This is defined in Figure 4-2 and discussed in Section 2.2. The examples in this HOWTO use the first serial port, giving <serial_port> the value 0, which in turn gives kernel parameter console=ttyS0.

If you are using the devfs device filesystem with your Linux installation the kernel parameter for the first serial port is still ttyS0, even though the first serial device is no longer known as /dev/ttyS0 but as /dev/ttys/0.

<mode> is defined in Figure 2-7 and is discussed in Section 2.3. The examples in this HOWTO use 9600 bits per second, one start bit, eight data bits, no parity, one stop bit, and no CTS/RTS flow control giving <mode> the value of 9600n8. When the current kernel flow control bugs are corrected this HOWTO will once again recommend the value 9600n8r.

<usb_port> can specify the address of a USB dongle containing a serial port to be used as a serial console.[1] For example, the serial port console=ttyS0,9600n8 when moved to a USB serial dongle would be written as console=ttyUSB0,9600n8. The USB subsystem is started rather late in the boot process, console messages printed during boot before the USB subsystem is loaded will be lost.

With no console parameter the kernel will use the first virtual terminal, which is /dev/tty0. A user at the keyboard uses this virtual terminal by pressing Ctrl-Alt-F1.

If your computer contains a video card then we suggest that you also configure it as a console. This is done with the kernel parameter console=tty0.

For computers with both a video card and a serial console in the port marked "COM1:" this HOWTO suggests the kernel parameters:

Figure 5-2. Recommended kernel parameters, PCs with video card

console=tty0 console=ttyS0,9600n8

Kernel messages will appear on both the first virtual terminal and the serial port. Messages from the init system and the system logger will appear only on the first serial port. This can be slightly confusing when looking at the attached monitor: the machine will appear to boot and then hang. Don't panic, the init system has started but is now printing messages to the serial port but is printing nothing to the screen. If a getty has been configured then a login: prompt will eventually appear on the attached monitor.

For PCs without a video card, this HOWTO suggests the kernel parameters:

Figure 5-3. Recommended kernel parameters, PCs without video card

console=ttyS0,9600n8

These parameters are passed to the booting kernel by the boot loader. Next we will configure the boot loader used by your Linux installation to pass the console parameters to the kernel.

Notes

[1]

A serial console attached to a USB dongle is only available in Linux kernel version 2.5.7 and later. The 2.5 series of kernels are developer's kernels and are not ready for production use.