How to debug the early boot process (was 'Red Hat nash')
deron.meranda at gmail.com
Sun Jan 30 02:30:08 UTC 2005
> Matthew Miller wrote:
> >It's really not doing much. But if you want to see what's going on, edit
> >your /etc/grub.conf and remove the keyword "quiet" from your kernel boot
But there's still more to see! Here's how I do it...
If you really want to see the little details (especially important if your boot
sequence is hanging), then try this hackery (only works in FC3--or
presumably later). Everything's as root (obviously).
If necessary, you can also do most of this booted from the rescue CD.
Just prefix pathnames with "/mnt/sysimage" as needed (you'll also have
to use the "vi" editor as nothing else is available).
** To increase debugging levels in early "initrd" boot **
What we are going to do is to edit the "initrd" file (normally located
at /boot/initrd-2.6.10-1.741_FC3.img or similar). We will turn on
even more debugging than is available by commenting out the
"quiet" option of the kernel boot options. Since this file is not a
simple text file, editing it involves many steps...
gunzip -c ../initrd-2.6.9-1.724_FC3.img | cpio -idmv
# or whatever initrd version file you have
At this point edit the "init" file, which is a nash script (this is NOT
a normal shell script, so don't go adding lots bash-isms), changing:
1. Comment out the line "setquiet" (prefix with "#" character)
2. Change the "lvm vgscan" to "lvm vgscan -v"
If you want more LVM debugging, also edit the etc/lvm/lvm.conf
file and change
both inside the log() function (around line number 80). There are
other LVM debugging options you can set if you want even more.
Repackage up a new image. First rename the original one out of
the way to save it so you can restore it later.
find . | cpio --quiet -c -o >../newinitrd
cd .. # You are now in /boot
gzip -9 < newinitrd > initrd-2.6.9-1.724_FC3.img
(If you're really paranoid be sure you have another bootable entry
in your grub configuration---perhaps one that points to the same
kernel but the original initrd file).
*** To add debugging to hardware detection during boot ***
You know that one line at the begging of the boot where it says
"Initializing hardware...", and it goes through storage, audio, etc.
Well, you can get more details, especially useful when you have
a bad device or driver hanging...
Edit /etc/rc.d/rc.sysinit (save a backup of the file first using
cp -p /etc/rc.d/rc.sysinit /etc/rc.d/rc.sysinit.fc3
In the function load_module(), add at the top, add an "echo" line
This is a bash script, so you can be more creative in how you add
debugging...just be aware that you're still in single-user mode (or
There are plenty of other places in that file that you may want to
add some debugging output (by adding "echo" commands). Some
of them might be anyplace a "modprobe" or "insmod" is run.
If you have problems with loading keymap, then find the "loadkeys"
command and add a -v option.
Even if you have no problems, doing all this will help you really
learn how Linux boots.
More information about the users