this HOWTO will show you how to setup your redhat linux server (and probably a few others) to do the following:
* send the grub menu to the remote serial console (so you can select the kernel to boot from)
* send boot process info to the remote serial console (like what you see on your monitor when you boot up at home... you use linux at home, right?)
why does this matter? for me, this all equates to less stress during kernel upgrades (being able to see any problems, choose different kernels, change kernel boot parameters from the grub menu), and less stress when things go awry somewhere on a box and i have to use the master reboot switch and sit around twiddling my thumbs wondering if the system really is rebooting.
WARNING: if you aren't 100% sure of what you're doing, DO NOT do any of the following on a live/production server. in other words, if you are new to this stuff, only try this on your brand new box you just ordered just in case you mess it up so bad you have to get it re-imaged.
if you aren't sure what the remote console is or how to use it, please see this HOWTO: http://forum.ev1servers.net/showthread.php?t=52961
a thread discussing some uses for the remote console (and the people there probably could have made use of this tutorial) can be found here: http://forum.ev1servers.net/showthread.php?t=51199
using this tutorial requires grub to be installed as your server's bootloader (some basic instructions below). it's probably very possible to get the boot process info sent to the serial console even if you're using lilo, but i don't know how to do it with lilo and have no desire to google that info as i don't like or use lilo (maybe someone else will post info on how to do this with lilo).
this tutorial also makes a few extra assumptions, like that the serial port to use is ttyS0, but i doubt that won't be the case for anyone.
enjoy and let me know if you have any comments/additions/complaints.
on to the tutorial:
MAKE SURE GRUB IS YOUR BOOTLOADER
please note that what i have here does not replace outside knowledge of grub/bootloaders. again, if you aren't sure what you are doing, don't try any of this on a production server. i am far from a guru. don't put to much trust in my geek advice (my political views, however, should be taken very seriously =).
if you aren't sure if grub is your bootloader (default ev1 images at the time of writing have both grub and lilo installed [that is, the programs are present] but lilo is the bootloader installed on the MBR and so is the one in action). if you aren't sure which is on the MBR and you have grub installed, you can use this command (the # denotes the shell. don't type the #):
CODE
# grubby --bootloader-probe
that will output either "lilo" or "grub", telling you which is on the MBR.
so, this isn't a tutorial for installing grub, but i have found with fresh ev1 RHEL servers you can just run:
CODE
# grub-install /dev/device_name_of_first_disk
where device_name_of_first_disk is likely either hda or sda, depending on the type of drives you have. this will (hopefully) install grub on the MBR (and so lilo won't be there anymore). if you have just installed grub on the MBR and haven't rebooted yet, you should do that now just so you know that is working before you proceed with other changes (that is, so if there are problems you know at what point things got messed up).
SETUP GRUB AND THE BOOT PROCESS TO GO TO THE SERIAL CONSOLE
now, assuming you have grub installed, it's time to proceed with setting up the grub menu and the boot process to be sent to the serial console (i believe it will also still allow someone at the terminal to view the grub menu).
1) edit /etc/sysconfig/kudzu and make sure the value for SAFE is yes (change it if needed):
CODE
SAFE=yes
if you do not do this then the serial connection will be reset by kudzu during the boot process.
2) backup /boot/grub/grub.conf
3) edit /boot/grub/grub.conf and add the following two lines to the general config (not to any specific kernel):
CODE
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal --timeout=5 console serial
terminal --timeout=5 console serial
now append this to any kernel lines who you want to see the output of in the console when you boot with those kernels:
CODE
console=ttyS0,9600n8 console=tty0
your resulting grub.conf might look something like this:
CODE
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/hda3
# initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=10
fallback=2
splashimage=(hd0,0)/grub/splash.xpm.gz
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal --timeout=5 console serial
title Red Hat Enterprise Linux ES (2.4.21-32.0.1.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.4.21-32.0.1.ELsmp ro root=LABEL=/ console=ttyS0,9600n8 console=tty0
initrd /initrd-2.4.21-32.0.1.ELsmp.img
title Red Hat Enterprise Linux ES (2.4.21-32.0.1.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-32.0.1.EL ro root=LABEL=/
initrd /initrd-2.4.21-32.0.1.EL.img
title Red Hat Enterprise Linux ES (2.4.21-27.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.4.21-27.ELsmp ro root=LABEL=/
initrd /initrd-2.4.21-27.ELsmp.img
title Red Hat Enterprise Linux ES-up (2.4.21-27.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-27.EL ro root=LABEL=/
initrd /initrd-2.4.21-27.EL.img
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/hda3
# initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=10
fallback=2
splashimage=(hd0,0)/grub/splash.xpm.gz
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal --timeout=5 console serial
title Red Hat Enterprise Linux ES (2.4.21-32.0.1.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.4.21-32.0.1.ELsmp ro root=LABEL=/ console=ttyS0,9600n8 console=tty0
initrd /initrd-2.4.21-32.0.1.ELsmp.img
title Red Hat Enterprise Linux ES (2.4.21-32.0.1.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-32.0.1.EL ro root=LABEL=/
initrd /initrd-2.4.21-32.0.1.EL.img
title Red Hat Enterprise Linux ES (2.4.21-27.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.4.21-27.ELsmp ro root=LABEL=/
initrd /initrd-2.4.21-27.ELsmp.img
title Red Hat Enterprise Linux ES-up (2.4.21-27.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-27.EL ro root=LABEL=/
initrd /initrd-2.4.21-27.EL.img
if you aren't sure about editing the grub.conf file, just note that if your system already booted fine from grub and you are just trying to get the serial console to show boot info, then you don't want to make any changes whatsoever to any of the vmlinuz or initrd filenames that are referenced. the only change you'll make to any of those kernels lines is to append the string i mentioned above to the end of the kernel line, as you can see in the above example.
note that in my example i've only changed one kernel to send boot info to the console. there's no reason for that other than a) i was lazy, b) i wanted to leave some untouched in case i messed things up adding this bit to the kernel line, and c) i don't boot from the other kernels. also, as you should be able to see the grub boot menu from the console now, you could likely boot your system fine even if you messed up the individual kernel configurations in grub.conf by using grub's handy ability to let you declare kernel boot parameters from the grub menu (for info on how to do that, seek out some grub tutorials).
that's it. now save your grub.conf, open a connection to the serial console (in a new window, if you want) and reboot. if all is goes well, you shouldn't be disconnected even because of a reboot. when the box starts back up you will see "press any key to continue" a few times. if you press a key right then you will get the grub menu. if you don't, a few seconds later (possibly after grub has shown the menu to the terminal?) your server will boot from the default kernel and you will start to see the boot info.
CREDITS
http://www.tldp.org/HOWTO/Remote-Serial-Co...ernel-grub.html
http://joyfire.net/HOWTO/Remote-Serial-Con...figure-rhl.html
http://publib.boulder.ibm.com/infocenter/p...m7il110219.html