| Article Index |
|---|
| Cluster Administration |
| Page 2 |
| Page 3 |
| Page 4 |
| All Pages |
Serial Consoles and the Boot Loader and Linux Kernel
When the BIOS has finished its tasks, it transfers control of the cluster node to the boot loader.� The purpose of the boot loader is to load a kernel.� You generally see a message from the boot loader (e.g., �lilo:�) that you can use to select the kernel to use.� You need to be able to view these messages (and provide input) via the serial port.� The boot loader can be configured to do this.
Once you select a kernel (or the default kernel is loaded), the kernel will print out a lot of information as it probes and initializes your system.� The Linux kernel allows you to redirect these messages to a serial port.� This is done by passing command line arguments to the kernel.� You can do this by instructing the boot loader to do so.
As a result, to allow interaction with the boot loader and kernel over a serial port, we need to make changes to the boot loader�s configuration file.� We present the changes needed for two popular boot loaders: LILO and GRUB.
LILO
To redirect LILO�s output to a serial port, you will make changes in the global section of /etc/lilo.conf.� We will also add (or modify) an append statement for the kernel in the global section of /etc/lilo.conf.� If for some reason you do not want all kernels to redirect their output, add an append statement for the appropriate image section(s) instead of in the global section of /etc/lilo.conf.
To interact with LILO via the serial console, you will need to make the following changes to the global section of /etc/lilo.conf:
# Comment out message=/boot/message if /boot/message is not a text file
# message=/boot/message
# Add the line that tells LILO to send its output to / get its input
# ��� The first parameter is the serial port used,
#���� e.g. for ttyS0, enter 0; for ttyS1, enter 1
#���� The second parameter is the speed to use (see the lilo.conf(5)
#���� man page for other possible parameters).� Use the highest
#���� speed supported by your components for best results.
serial=0,9600
To instruct the kernel to send its output to the serial console, add the following line to the global section of /etc/lilo.conf:
# The kernel sends its output to all consoles defined below.
#� However, the last one defined is the one the kernel sets
#� as the default console for stdout (where user programs send
#� their output by default).� So you will want to list the serial
#� console as the last console.� Substitute the correct serial console
#� below (if you use ttyS1, replace all ttyS0 below).
append=�console=tty0 console=ttyS0,9600�
Your changes will not be effective until you run the following command to install the new boot record:
/sbin/lilo
At this point, if you reboot your system and monitor the serial console, you will see the BIOS output (as configured in the last section) followed by the lilo: prompt.� You should be able to press the shift key and select a kernel.� If you can do this, the boot loader is successfully using the serial console.� Once a kernel is selected, you will see the message indicating that the kernel is being loaded.� After this one line is finished, the kernel takes over and all of the kernel�s probe/initialization messages should be displayed on the serial console.� If you see the line stating that the kernel is loading, but then nothing else happens, you have configured the boot loader correctly but there is a problem with the configuration of the kernel�s serial port redirection.� As mentioned earlier, it would be good to have a monitor/keyboard attached during this process.� In this case, you can at least see that the system is still booting (if the messages are appearing on the monitor) even if you do not see anything on the serial console.� In addition, you will need the keyboard/monitor to log onto the system (unless you log in over the network) until you configure your system for login over the serial console (discussed in a following section).�
If you have successfully redirected the output from your kernel, you will see all of its messages over the serial console.� After the kernel finishes all of its tasks, it starts the first user-space process, init.� The init process is responsible for, among other things, starting the processes that provide you with a login prompt.� However, we have not yet taken the steps necessary to provide a login prompt to users connecting via a serial port.� This will be covered in a later section.� Even though you will not be able to log in over the serial console yet, you will be able to see, over the serial console, all of the output from init and all of the other startup processes since the kernel has set the default console to the serial port we specified in the boot loaders configuration file.
GRUB
To get GRUB to use a serial console, add the following lines to the GRUB configuration file:
# The serial line gives GRUB information about the serial port
# ��� unit=0 corresponds to ttyS0 and unit=1 to ttyS1
serial �unit=0 �speed=9600
# The terminal line tells GRUB which consoles are available
#���� serial is the default (since it is listed first)
#���� and console indicates the keyboard/monitor
#���� The timeout is how long to wait for input from one of the
#���� listed consoles before using the default
terminal �timeout=10 serial console
# Comment out the splashimage line (the graphical interface to GRUB)
# splashimage=
To configure your kernel to use a serial console, modify your kernel lines in the GRUB configuration file as follows:
# The kernel sends its output to all consoles defined below.
#� However, the last one defined is the one the kernel sets
#� as the default console for stdout (where user programs send
#� their output by default).� So you will want to list the serial
#� console as the last console.� Substitute the correct serial console
#� below (if you use ttyS1, replace all ttyS0 below).
kernel console=tty0 console=ttyS0,9600
At this point, if you reboot your system and monitor the serial console, you will see the output from your BIOS (as configured in the last section) and you will receive the prompt from GRUB to select a kernel.� If you are able to do this, you have configured the boot loader correctly.� After GRUB has loaded the kernel, control of the system is handed over to the kernel.� Thus you should start to see all of the probe/initialization messages from the kernel over the serial console.� If you can use the GRUB menu to select a kernel over the serial console, but you do not see the kernel probe/initialization messages over the serial console, you have configured the boot loader correctly but there is a problem with the configuration of the kernel�s serial port redirection.� As mentioned earlier, it would be good to have a monitor/keyboard attached during this process.� In this case, you can at least see that the system is still booting (if the messages are appearing on the monitor) even if you do not see anything on the serial console.� In addition, you will need the keyboard/monitor to log onto the system (unless you log in over the network) until you configure your system for login over the serial console (discussed in a following section).
If you have successfully redirected the output from your kernel, you will see all of its messages over the serial console.� After the kernel finishes all of its tasks, it starts the first user-space process, init.� The init process is responsible for, among other things, starting the processes that provide you with a login prompt.� However, we have not yet taken the steps necessary to provide a login prompt to users connecting via a serial port.� This will be covered in a later section.� Even though you will not be able to log in over the serial console yet, you will be able to see, over the serial console, all of the output from init and all of the other startup processes since the kernel has set the default console to the serial port we specified in the boot loaders configuration file.




