How to debug Dracut problems

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
m (moved Dracut/Debugging to How to debug Dracut problems: Use plain language for titles, not directory hierarchies)
(Add to How to category)
Line 114: Line 114:
  
 
{{admon/note|debug network scripts in dracut. Output is written to /tmp/}}
 
{{admon/note|debug network scripts in dracut. Output is written to /tmp/}}
[[Category:Debugging]]
+
 
 +
 
 +
[[Category:Debugging]] [[Category:How to]]

Revision as of 11:47, 30 July 2009


Contents

All bug reports

In all cases, the following should be mentioned and attached to your bug report:

The exact kernel command line used!

An copy of /etc/fstab

cp /etc/fstab ~USER/Desktop/fstab.txt

The output of dmsetup ls --tree.

 dmsetup ls --tree > ~USER/Desktop/dmsetup.txt

If using an raid device the output of cat /proc/mdstat.

 cat /proc/mdstat > ~USER/Desktop/mdstat.txt

A copy of /etc/dracut.conf if you have edited it.

 cp /etc/dracut.conf ~USER/home/Desktop/dracut.conf.txt

The output of on an image with debugging enabled.

dmesg|grep dracut 
Note.png
You will need to have created an image with debug enabled and added the rdshell to the kernel command line see below for details on how to do that.

Preparing your system for debugging

To be successful in debugging you will need setup and remotely connect to the serial console.

Add the following lines to you /etc/grub.conf

Note.png
This example uses the first serial port, giving <serial_port> the value 0, which in turn gives kernel parameter console=ttyS0

Beneath timeout=5 put..

serial --unit=0 --speed=9600
terminal --timeout=5 serial console

At the end of the kernel line put..

console=tty0 console=ttyS0,9600

So /etc/grub.conf should look something like this after you've made those changes..

default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
        initrd /dracut-2.6.29.5-191.fc11.x86_64.img

Further information on how to configure the kernel for console output can be found here.

Idea.png
You can redirect all non-interactive output to /dev/kmsg and the kernel will put it out on the console when it reaches the kernel buffer by doing
exec >/dev/kmsg 2>&1 </dev/console

Create the image with debug enabled.

dracut -a debug /boot/debug-$(uname -r) $(uname -r) 
Idea.png
You can overwrite an existing image by using the -f option.
dracut -f -a debug <imagename> <kernel version>

Boot with debug enable.

rdinitdebug rdnetdebug

Using the shell to debug

Add "rdshell" to the kernel command line and remove "rhgb" and "quiet" and boot the image. This will drop you to the shell if the initramfs fails.

Note.png
Sample grub entry with serial enabled and rdshell kernel parameter added
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600 rdshell 
        initrd /dracut-2.6.29.5-191.fc11.x86_64.img

Need commands example #FIXME

Dracut debugging kernel command parameters

rdshell
Note.png
Drop to a shell, if the initramfs fails.
rdinitdebug
Note.png
set -x for the dracut shell
rdbreak=[pre-udev|pre-mount|mount|pre-pivot|]
Note.png
drop the shell on defined breakpoint
rdudevinfo
Note.png
set udev to loglevel info
rdudevdebug
Note.png
set udev to loglevel debug
rdnetdebug
Note.png
debug network scripts in dracut. Output is written to /tmp/