You are here: Home Personal My Blog Debugging dracut on your live EFI System with qemu

Debugging dracut on your live EFI System with qemu

by Harald Hoyer last modified Feb 08, 2012 12:54 PM
This article shows how to boot an EFI disk with qemu and how to debug dracut with qemu and the serial line.

Turn on cttyhack in dracut.conf (as of dracut >= 015):

# echo 'cttyhack="yes"' > /etc/dracut.conf.d/cttyhack.conf

Recreate the initramfs:

# dracut -f

Download the qemu EFI BIOS:

# mkdir ~/efiboot
# cd ~/efiboot/
# wget 'http://downloads.sourceforge.net/project/edk2/OVMF/OVMF-X64-r11337-alpha.zip'
# unzip OVMF-X64-r11337-alpha.zip
# mv OVMF.fd bios.bin
# mv CirrusLogic5446.rom vgabios-cirrus.bin

Sync the live system:

# umount /boot/efi
# umount /boot
# sync; echo 3 > /proc/sys/vm/drop_caches; umount /

Start qemu (you can omit "-L ~/efiboot" on a non EFI system):

# qemu-kvm -L ~/efiboot -m 512 -snapshot -hda /dev/sda -serial stdio

Enter the qemu window (you can use <tab> in the second line):

Shell> blk0:
blk0:\> EFI\redhat\grub.efi

Append to the grub kernel command line:

rd.shell rd.break console=ttyS0 rd.ctty=ttyS0

Boot the kernel

Now, you should see the dracut prompt in the terminal, where you started qemu.


dracut Warning: Break before switch_root

Dropping to debug shell.

switch_root:/# 

Warning: Any CTRL-C goes to qemu instead of the dracut shell.

If you don't want this, you can specify "-serial telnet:localhost:55555,server" and "telnet localhost 55555" for the terminal.

After the debugging, remount the boot partitions:

# mount /boot
# mount /boot/efi
Filed under: , , , ,
Add comment

You can add a comment by filling out the form below. Plain text formatting.

(Required)
Please enter your name.
(Required)
(Required)
(Required)
Enter the word