Difference between revisions of "Serial Console With Boot and Kernel Messages"
From Free Knowledge Base- The DUCK Project: information for everyone
(New page: <nowiki>-------------------------------------------------------------------------------</nowiki> <nowiki>-- HOW DO I: CONFIGURE SERIAL CONSOLE WITH KERNEL MESSAGES --</...) |
m (Protected "Serial Console With Boot and Kernel Messages" [edit=sysop:move=sysop]) |
(No difference)
|
Latest revision as of 14:58, 26 June 2007
------------------------------------------------------------------------------- -- HOW DO I: CONFIGURE SERIAL CONSOLE WITH KERNEL MESSAGES -- ------------------------------------------------------------------------------- [CONFIGURE SERIAL CONSOLE WITH KERNEL MESSAGES] This applies to kernel versions 2.2 - 2.4 and specifically to distributions with serial support already in the kernel. Examples are Mandrake, Redhat, and Debian. For the GRUB boot loader: 1.) edit /boot/grub/grub.conf and add support for grub to display the boot menu to a serial console after the timeout or splashimage line. serial --unit=0 --speed=19200 --word=8 --parity=no --stop=1 terminal --timeout=10 serial console 2.) continue to edit /boot/grub/grub.conf and a kernel parameter to utilize kernel support for the serial console. This is not necessary, however, it is useful in that it displays kernel boot messages on the serial console. Otherwise boot and service start-up messages will not be displayed. This should be appended to the kernel line after root=LABEL=/ console=ttyS0,19200n8 3.) steps 1 & 2 applied to boot. now the serial console must be configured for use. first edit /etc/inittab and after 6:2345:respawn:/sbin/mingetty tty6 add the following line: S0:2345:respawn:/sbin/mgetty ttyS0 4.) edit /etc/mgetty+sendfax/mgetty.config and add to the configuration end: port ttyS0 direct y speed 19200 toggle-dtr n Use a Null Modem cable between your serial console and the pc serial port. IMPORTANT NOTES: *Determine which serial port number is assigned to the port to which your cable is connected. *The example provided here for serial 1, there are (4) places which require modification to use serial 2. 1. in grub.conf change --unit=0 to --unit=1 (0 is for serial 1 and 1 is for serial 2) 2. in grub.conf kernel line change to console=ttyS1,19200n8 3. in mgetty.config don't forget to change the port number at the BEGINNING 4. and END of the line as follows: S1:2345:respawn:/sbin/mgetty ttyS1 example serial boot configuration: /boot/grub/grub.conf default=0 timeout=8 #splashimage=(hd0,0)/grub/splash.xpm.gz serial --unit=0 --speed=19200 --word=8 --parity=no --stop=1 terminal --timeout=10 serial console title Linux Boot (2.4 custom) root (hd0,0) kernel /vmlinuz-2.4.cust ro root=LABEL=/ console=ttyS0,19200n8 initrd /initrd-2.4.cust.img * the splashimage line should be omitted since the graphic will not display on either console after these modifications. * 19200 is a good serial speed. 9600 lags yet can be used for compatibility TROUBLESHOOTING: Q: System displays to serial during boot up until init V then nothing happens, appears to freeze. A: Check mgetty.config, there is likely a mismatch, see IMPORTANT NOTES items #3 and #4. Also, disable KUDZU, it may cause issues during serial boot if it detects a hardware change. Q: Not sure which serial port assigned to the physical port, or if the port is working. A: Grab an old serial mouse, great for testing! Connect serial mouse to Linux and start 'minicom -s' set to ttyS0 2400 and move mouse, then try ttyS1. Funny characters indicate serial port receiving information from mouse and you have located the active working serial port. For Lilo boot loader: 1.) edit /etc/lilo.conf and add support for grub to display the boot menu to a serial console after the timeout or splashimage line. 2.) And a kernel parameter to utilize kernel support for the serial console. Exit the editor and execute the 'lilo' command. ( steps 3 & 4 same as above for grub ) example serial boot configuration: /etc/lilo.conf prompt timeout=10 default=LINUX boot=/dev/hda map=/boot/map install=/boot/boot.b # message=/boot/message # linear serial=0,19200n8 image=/boot/vmlinuz-2.4.cust label=LINUX initrd=/boot/initrd-2.4.cust.img read-only append="root=LABEL=/ console=ttyS0,19200n8" SOFTWARE: minicom is useful for serial connection to the machine. Microsoft Windows users may want to avoid Microsoft HyperTerm, the emmulation is poor. Use Tera Term to connect to the Linux machine from a Windows host. home page: http://hp.vector.co.jp/authors/VA002416/teraterm.html local ftp: ftp://ftp.robotz.com/pub/modem/TeraTerm/ttermp23.zip To connect from MSDOS use KERMIT local ftp: ftp://ftp.robotz.com/pub/modem/KERMIT/KERMIT.EXE ------------------------------------------------------------------------------- Additional Configuration and Information: FOR GRUB BOOTLOADER ------------------------------------------------------------------------------- Define Serial port as (COM1), for COM2 specify --unit=1 and so on. After this define terminal for throwing display serial --unit=0 --speed=9600 15 seconds timeout and both console(Monitor or tty0) and serial port (ttyS0 or COM1) as display. For 15 seconds it will allow to select either Monitor or Serial port selection depending upon where you press key. Otherwise after 15 seconds it will select first entry ('console'). terminal --timeout=15 console serial Pass kernel option in 'kernel' line directing kernel messages to selected devices. You can select both Monitor and Serial port to get kernel messages kernel /boot/vmlinuz-2.4.17 ro root=/dev/sda3 console=ttyS0 console=tty0 EXAMPLE: Single user mode for Monitor kernel /boot/vmlinuz-2.4.17 ro root=/dev/sda3 console=ttyS0 console=tty0 EXAMPLE: Single user mode for Serial Port kernel /boot/vmlinuz-2.4.17 ro root=/dev/sda3 console=tty0 console=ttyS0 In order to login as single user mode, at Grub boot selection menu, select kernel image by arrow (UP, DOWN keys) and then hit 'e' key to edit, which will show grub entry for image, select kernel line and append word 'single' and <Enter>, kernel /boot/vmlinuz-2.4.17 ro root=/dev/sda3 console=tty0 console=ttyS0 single Press 'b' to boot this image now. This edit is only temporary and won't overwrite /etc/grub.conf. By this way you can always edit grub entries for boot time temporarily. ------------------------------------------------------------------------------- Additional Configuration and Information: FOR MULTI USER MODE ------------------------------------------------------------------------------- Use mgetty to attach login process to Serial line, modify /etc/inittab and it will run mgetty in as direct line (-r) (i.e no modem chat initiated), in block mode (-b), with speed as 9600 baud (-s 9600), login prompt as specified by -p option and device is ttyS0 (Serial port device /dev/ttyS0). S0:2345:respawn:/sbin/mgetty -b -r -s 9600 -p "Serial Console Login: " ttyS0 TIP: You can type 'init q' to reread inittab as opposed to rebooting the system. TIP: Add Serial device entry (ttyS0) in your /etc/securetty file to allow root login from the serial console. If you setup mgetty(8) process as above, even if you select Monitor as your display console (which allows single user and OS messages on Monitor) still you will get Serial port login: on serial line. This is because after OS boot, mgetty will run irrespective of any selection and wait for login.