From: admin Date: Sun, 11 Sep 2011 19:03:32 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://www.opopop.net/cgi-bin/gitweb.cgi?p=reminder;a=commitdiff_plain;h=6bdd4cf413707b3f61c5fe1f93308308467b630e --- diff --git a/getting_boot_messages_through_a_serial_line.mdwn b/getting_boot_messages_through_a_serial_line.mdwn new file mode 100644 index 0000000..4b4b134 --- /dev/null +++ b/getting_boot_messages_through_a_serial_line.mdwn @@ -0,0 +1,105 @@ +This is a howto about booting Linux without a +traditional screen and through a serial line. + +It is often the only method for servers. But it can be generally +useful for debugging, by allowing logging of the boot messages, which +scroll too fast on a VGA screen and are not fully kept in +/var/log/messages. + +The method is unlikely to be useful for out of the box modern +desktops/laptops/notebooks, as there have no more a serial +port. Emulation of a serial port through USB can't work here, as we +are too early in the boot process. In that case, and if your hardware +allows, you will have to plug in some serial port extension card. + +I will in the following limit the scope to what I use: the IA-32 +and derived architectures, but any information about other ones +welcome. + +# Controlling boot through the serial line + +## Serial line configuration at the booting computer side + +To have a complete boot experience through the serial line, you have to: + +1. manage to get the BIOS I/O go through the serial line +1. configure a bootloader like GRUB to use the serial line +1. configure the kernel to output boot messages to the serial line +1. get a login prompt on the serial line + +### Manage to get the BIOS I/O go through the serial line + +On servers it may be the only method, but it is unlikely to exist on a +desktop BIOS. In that case, you will miss the BIOS messages on the +serial line. + +### Configure a bootloader like GRUB to use the serial line + +On GRUB 1 or GRUB 2 you simply have to add these lines in the +GRUB configuration file: + + # insmod is GRUB 2 specific, comment out for GRUB 1 + insmod serial + serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1 + terminal serial + +### Configure the kernel to output boot messages to the serial line + +To get kernel messages on the serial line, you have to add a +new option to the kernel command line, like: + + console=ttyS0,9600n8 + +which means 9600 bauds, no parity and 8 bits, to fit the previous +section 4 lines. This will also involve editing GRUB configuration +file. It may be unnecessary to do that if you use a server without a +VGA card, Linux is clever enough to try a serial port in that case. + +If you are using Debian, you can configure items 2 and 3 the Debian +way, see for instance: +[[http://linux.xvx.cz/2009/08/debian-with-grub2-and-serial-connection/]] + +Notice that you can't use arrows to navigate the GRUB menus when on +serial line, other standard keys are offered to that effect on the +greeting page. + +### Get a login prompt on the serial line + +It is covered in that page: [[recovering_when_locked_out_from_your_computer]]. + +## The other end of the serial line: hardware terminal or emulation + +In any case, you will need a [emergency null modem] to link the +booting host and the terminal (real dumb serial terminal or computer +running an emulator). + +Even if your computer emulating a terminal has no serial port, you can +use an USB port with a hardware adapter and a Linux driver, look +here: [[recovering_when_locked_out_from_your_computer]]. + +# Recording the boot messages + +At that point, you should be able to get boot messages through the +serial line and then a login prompt. + +When you boot through a traditional VGA screen, you can only study +back at most aroung 50 lines, depending on screen definition. While +through an emulated serial terminal, you are free to record the full +booting process. + +Minicom (see: +[[recovering_when_locked_out_from_your_computer]]) can record what is sent/received on the serial line, see +option "Capture on/off" in the menu, it has hotkey L. + +But other tools are more convenient. I suggest you use ttyrec. To +register in file ttyrecord what happens during a minicom session, run: + + ttyrec -e minicom + +When you are done with minicom, you can replay the session with: + + ttyplay ttyrecord + +To stop replay at some point, hit Ctrl-S; to resume hit Ctrl-Q. See +ttyrec man page for how to tune the general speed of the replay. +