About Us  |  Blog  |  Hosting Partners  |  Legal  |  Portal Login

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HOWTO: setup remote serial console to display grub menu and boot process
revolution
post Aug 11 2005, 11:44 PM
Post #1


Enlightened
*

Group: Members
Posts: 93
Joined: 1-June 03
Member No.: 7,866



hi,

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

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

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


--------------------
"Don't let your outrage for injustice end where your selfishness begins."
---go vegan --- fight bush---
http://www.commondreams.org/
Go to the top of the page
 
+Quote Post
rgesnot
post Aug 12 2005, 01:51 PM
Post #2


Newbie


Group: Members
Posts: 19
Joined: 12-August 05
Member No.: 17,901



Thanks a lot for your HowTo, It works fine.

IN ENGLISH :
* GRUB Manual
* GRUB homepage
* Grub wiki
* Booting with GRUB

IN FRENCH (en francais) :
GRUB: LES BASES POUR FEDORA
Go to the top of the page
 
+Quote Post
propcgamer
post Aug 12 2005, 09:47 PM
Post #3


Computer Chip
***

Group: Members
Posts: 769
Joined: 12-June 02
Member No.: 2,683



wow awsome job, worked great


--------------------
Go to the top of the page
 
+Quote Post
sandy
post Sep 28 2005, 07:47 AM
Post #4


Celery
*

Group: Members
Posts: 22
Joined: 19-April 05
Member No.: 16,587



Thanks very much for this, im sure it will come in handy!
Go to the top of the page
 
+Quote Post
revolution
post Sep 29 2005, 09:27 PM
Post #5


Enlightened
*

Group: Members
Posts: 93
Joined: 1-June 03
Member No.: 7,866



you're very welcome.


--------------------
"Don't let your outrage for injustice end where your selfishness begins."
---go vegan --- fight bush---
http://www.commondreams.org/
Go to the top of the page
 
+Quote Post
AdamS
post Nov 10 2005, 04:12 PM
Post #6


Fellow
**

Group: Members
Posts: 157
Joined: 18-May 04
Member No.: 13,467



If you want to do this with the LILO boot loader, just do the following:

Do this at your own risk! Tested on my production box, works great!

Backup lilo.conf
CODE
cp /etc/lilo.conf /root/lilo.conf



Edit /etc/lilo.conf

Add this to the global section:
CODE
serial=0,9600n8


Add the following to the append line for each kernel image:
CODE
console=tty0 console=ttyS0,9600n8


Run "lilo" command to update MBR:
CODE
# lilo



Old lilo.conf may look like this:
CODE
prompt

timeout=50

default=2.4.21-15.0.3.E

boot=/dev/hda

map=/boot/map

install=/boot/boot.b

message=/boot/message



image=/boot/vmlinuz-2.4.21-15.0.3.EL

       label=2.4.21-15.0.3.E

       initrd=/boot/initrd-2.4.21-15.0.3.EL.img

       read-only

       append="root=/dev/hda3"


New one looks like this:
CODE
prompt

timeout=50

default=2.4.21-15.0.3.E

boot=/dev/hda

map=/boot/map

install=/boot/boot.b

message=/boot/message

serial=0,9600n8



image=/boot/vmlinuz-2.4.21-15.0.3.EL

       label=2.4.21-15.0.3.E

       initrd=/boot/initrd-2.4.21-15.0.3.EL.img

       read-only

       append="root=/dev/hda3 console=tty0 console=ttyS0,9600n8"
Go to the top of the page
 
+Quote Post
freddo
post Nov 11 2005, 06:27 PM
Post #7


SuperGeek
****

Group: Members
Posts: 1,012
Joined: 7-April 02
Member No.: 1,958



So AdamS,

if I use LILO, I only have to edit lilo.conf to be able to watch reboot over serial port?


--------------------
Michael
Go to the top of the page
 
+Quote Post
REBIS
post Nov 11 2005, 08:28 PM
Post #8


SuperGeek
****

Group: Members
Posts: 2,963
Joined: 9-June 02
Member No.: 2,627



Nice post!


--------------------
Prediction is very difficult, especially about the future. -Niels Bohr
Go to the top of the page
 
+Quote Post
eth00
post Nov 11 2005, 09:05 PM
Post #9


SuperGeek
****

Group: Members
Posts: 4,850
Joined: 23-May 03
Member No.: 7,754



QUOTE (freddo)
So AdamS,

if I use LILO, I only have to edit lilo.conf to be able to watch reboot over serial port?


Yeah that should be all you have to do, aside from a kernel that supports it of course icon_smile.gif


--------------------
John W
My personal website with many free security and linux how-to's!
Tss -- Live Support! Tweaking, Securing, 24x7 Service Monitoring, Monthly Management, Migrations, Restores, Optimization, LoadBalancer Configuration, Mysql Clusters, Custom Configurations, Consulting. English And Spanish Support!
We do it all @ TotalServerSolutions
Go to the top of the page
 
+Quote Post
freddo
post Nov 11 2005, 09:36 PM
Post #10


SuperGeek
****

Group: Members
Posts: 1,012
Joined: 7-April 02
Member No.: 1,958



Would a stock RHEL3 kernel be OK?


--------------------
Michael
Go to the top of the page
 
+Quote Post
eth00
post Nov 11 2005, 10:17 PM
Post #11


SuperGeek
****

Group: Members
Posts: 4,850
Joined: 23-May 03
Member No.: 7,754



QUOTE (freddo)
Would a stock RHEL3 kernel be OK?


Yes it will


--------------------
John W
My personal website with many free security and linux how-to's!
Tss -- Live Support! Tweaking, Securing, 24x7 Service Monitoring, Monthly Management, Migrations, Restores, Optimization, LoadBalancer Configuration, Mysql Clusters, Custom Configurations, Consulting. English And Spanish Support!
We do it all @ TotalServerSolutions
Go to the top of the page
 
+Quote Post
monkeyman
post Jun 30 2006, 03:05 AM
Post #12


Fellow
**

Group: Members
Posts: 174
Joined: 19-June 02
Member No.: 2,780



Thanks revolution,

Great tip and invaluable when I just updated my kernel.

Just 1 question.

Is it ok to leave the settings that have been changed permanantly or is there any reason it should be changed back?

Thanks
Go to the top of the page
 
+Quote Post
revolution
post Jun 30 2006, 07:59 AM
Post #13


Enlightened
*

Group: Members
Posts: 93
Joined: 1-June 03
Member No.: 7,866



QUOTE (monkeyman)
Thanks revolution,

Great tip and invaluable when I just updated my kernel.

Just 1 question.

Is it ok to leave the settings that have been changed permanantly or is there any reason it should be changed back?

Thanks

you're welcome. as far as i know, it's okay to leave them changed permanently. if anyone feels or knows otherwise, i'd be curious to know why.

a big advantage of leaving them changed permanently is that it will come in handy during unplanned reboots.


--------------------
"Don't let your outrage for injustice end where your selfishness begins."
---go vegan --- fight bush---
http://www.commondreams.org/
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 22nd November 2009 - 01:44 AM
 

Dedicated Servers

Managed Hosting

Colocation

Business Solutions

Why The Planet?

Contact Us