Re: [Libguestfs] hang after seabios
[Let's keep this on the mailing list] On Thu, Jul 31, 2014 at 02:48:25PM -0700, Zetan Drableg wrote:
Hi Richard, I created qemu-wrapper: #!/bin/bash -x
exec gdbserver :1234 /usr/libexec/qemu-kvm "$@"
gdbserver will end up debugging the qemu process, not the guest inside. This is not useful. You need to do something like: exec /usr/libexec/qemu-kvm -s -S "$@" Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Ok - By the way, I looked into updating out KVM versions. Since we already have so many KVM servers of this version in production, I can't easily forklift update everything without much testing. exec /usr/libexec/qemu-kvm -s -S "$@" export LIBGUESTFS_HV=/root/work/qemu-wrapper export LIBGUESTFS_BACKEND=direct How do I simulate the setup of devices the test tool perform? Just copy/pasting the qemu-kvm argument list doesn't work. I was hoping that LIBGUESTFS_HV would replace usage of /usr/libexec/qemu-kvm with /root/work/qemu-wrapper, but does not appear to [root@us7-sec-vm-02 work]# ./test.sh + /root/work/qemu-wrapper -global virtio-blk-pci.scsi=off -nodefconfig -nodefaults -nographic -machine accel=kvm:tcg -cpu host,+kvmclock -m 500 -no-reboot -kernel /var/tmp/.guestfs-0/kernel.20700 -initrd /var/tmp/.guestfs-0/initrd.20700 -device virtio-scsi-pci,id=scsi -drive file=/tmp/libguestfs-test-tool-sda-uGZyEt,cache=none,format=raw,id=hd0,if=none -device scsi-hd,drive=hd0 -drive file=/var/tmp/.guestfs-0/root.20700,snapshot=on,id=appliance,if=none,cache=unsafe -device scsi-hd,drive=appliance -device virtio-serial -serial stdio -device sga -chardev socket,path=/tmp/libguestfsG73eA4/guestfsd.sock,id=channel0 -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 -append 'panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=xterm' qemu-kvm: -chardev socket,path=/tmp/libguestfsG73eA4/guestfsd.sock,id=channel0: socket connect failed: Connection refused qemu-kvm: -chardev socket,path=/tmp/libguestfsG73eA4/guestfsd.sock,id=channel0: chardev: opening backend "socket" failed [root@work]# libguestfs-test-tool ************************************************************ * IMPORTANT NOTICE * * When reporting bugs, include the COMPLETE, UNEDITED * output below in your bug report. * ************************************************************ LIBGUESTFS_HV=/root/work/qemu-wrapper LIBGUESTFS_BACKEND=direct PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin SELinux: Enforcing library version: 1.20.11rhel=6,release=2.el6 guestfs_get_append: (null) guestfs_get_attach_method: appliance guestfs_get_autosync: 1 guestfs_get_cachedir: /var/tmp guestfs_get_direct: 0 guestfs_get_memsize: 500 guestfs_get_network: 0 guestfs_get_path: /usr/lib64/guestfs guestfs_get_pgroup: 0 guestfs_get_qemu: /usr/libexec/qemu-kvm guestfs_get_recovery_proc: 1 guestfs_get_selinux: 0 guestfs_get_smp: 1 guestfs_get_tmpdir: /tmp guestfs_get_trace: 0 guestfs_get_verbose: 1 host_cpu: x86_64 Launching appliance, timeout set to 600 seconds. libguestfs: launch: attach-method=appliance libguestfs: launch: tmpdir=/tmp/libguestfsG73eA4 libguestfs: launch: umask=0077 libguestfs: launch: euid=0 libguestfs: command: run: febootstrap-supermin-helper libguestfs: command: run: \ --verbose libguestfs: command: run: \ -f checksum libguestfs: command: run: \ /usr/lib64/guestfs/supermin.d libguestfs: command: run: \ x86_64 supermin helper [00000ms] whitelist = (not specified), host_cpu = x86_64, kernel = (null), initrd = (null), appliance = (null) supermin helper [00000ms] inputs[0] = /usr/lib64/guestfs/supermin.d checking modpath /lib/modules/2.6.39-400.215.6.el6uek.x86_64 is a directory picked vmlinuz-2.6.39-400.215.6.el6uek.x86_64 because modpath /lib/modules/2.6.39-400.215.6.el6uek.x86_64 exists checking modpath /lib/modules/2.6.39-400.215.4.el6uek.x86_64 is a directory picked vmlinuz-2.6.39-400.215.4.el6uek.x86_64 because modpath /lib/modules/2.6.39-400.215.4.el6uek.x86_64 exists checking modpath /lib/modules/2.6.32-431.23.3.el6.x86_64 is a directory picked vmlinuz-2.6.32-431.23.3.el6.x86_64 because modpath /lib/modules/2.6.32-431.23.3.el6.x86_64 exists checking modpath /lib/modules/2.6.32-279.el6.x86_64 is a directory picked vmlinuz-2.6.32-279.el6.x86_64 because modpath /lib/modules/2.6.32-279.el6.x86_64 exists checking modpath /lib/modules/2.6.32-431.20.5.el6.x86_64 is a directory picked vmlinuz-2.6.32-431.20.5.el6.x86_64 because modpath /lib/modules/2.6.32-431.20.5.el6.x86_64 exists checking modpath /lib/modules/2.6.39-200.24.1.el6uek.x86_64 is a directory picked vmlinuz-2.6.39-200.24.1.el6uek.x86_64 because modpath /lib/modules/2.6.39-200.24.1.el6uek.x86_64 exists supermin helper [00000ms] finished creating kernel supermin helper [00000ms] visiting /usr/lib64/guestfs/supermin.d supermin helper [00000ms] visiting /usr/lib64/guestfs/supermin.d/base.img supermin helper [00000ms] visiting /usr/lib64/guestfs/supermin.d/daemon.img supermin helper [00000ms] visiting /usr/lib64/guestfs/supermin.d/hostfiles supermin helper [00025ms] visiting /usr/lib64/guestfs/supermin.d/init.img supermin helper [00025ms] visiting /usr/lib64/guestfs/supermin.d/udev-rules.img supermin helper [00025ms] adding kernel modules supermin helper [00057ms] finished creating appliance libguestfs: checksum of existing appliance: 2886a8f3710fce98f495863d78188571ec8d400168688aea3f253d8cf67304b4 libguestfs: [00060ms] begin testing qemu features libguestfs: command: run: /usr/libexec/qemu-kvm libguestfs: command: run: \ -nographic libguestfs: command: run: \ -help libguestfs: command: run: /usr/libexec/qemu-kvm libguestfs: command: run: \ -nographic libguestfs: command: run: \ -version libguestfs: qemu version 0.12 libguestfs: command: run: /usr/libexec/qemu-kvm libguestfs: command: run: \ -nographic libguestfs: command: run: \ -machine accel=kvm:tcg libguestfs: command: run: \ -device ? libguestfs: [00229ms] finished testing qemu features libguestfs: accept_from_daemon: 0x182fe00 g->state = 1 [00230ms] /usr/libexec/qemu-kvm \ -global virtio-blk-pci.scsi=off \ -nodefconfig \ -nodefaults \ -nographic \ -machine accel=kvm:tcg \ -cpu host,+kvmclock \ -m 500 \ -no-reboot \ -kernel /var/tmp/.guestfs-0/kernel.20700 \ -initrd /var/tmp/.guestfs-0/initrd.20700 \ -device virtio-scsi-pci,id=scsi \ -drive file=/tmp/libguestfs-test-tool-sda-uGZyEt,cache=none,format=raw,id=hd0,if=none \ -device scsi-hd,drive=hd0 \ -drive file=/var/tmp/.guestfs-0/root.20700,snapshot=on,id=appliance,if=none,cache=unsafe \ -device scsi-hd,drive=appliance \ -device virtio-serial \ -serial stdio \ -device sga \ -chardev socket,path=/tmp/libguestfsG73eA4/guestfsd.sock,id=channel0 \ -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \ -append 'panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=xterm' \x1b[1;256r\x1b[256;256H\x1b[6n Google, Inc. Serial Graphics Adapter 10/14/11 SGABIOS $Id: sgabios.S 8 2010-04-22 00:03:40Z nlaredo $ (mockbuild@ca-build44.us.oracle.com) Fri Oct 14 20:04:36 UTC 2011 Term: 80x24 4 0 SeaBIOS (version seabios-0.6.1.2-28.el6) Probing EDD (edd=off to disable)... ok \x1b[2J On Thu, Jul 31, 2014 at 3:00 PM, Richard W.M. Jones <rjones@redhat.com> wrote:
[Let's keep this on the mailing list]
On Thu, Jul 31, 2014 at 02:48:25PM -0700, Zetan Drableg wrote:
Hi Richard, I created qemu-wrapper: #!/bin/bash -x
exec gdbserver :1234 /usr/libexec/qemu-kvm "$@"
gdbserver will end up debugging the qemu process, not the guest inside. This is not useful.
You need to do something like:
exec /usr/libexec/qemu-kvm -s -S "$@"
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
On Thu, Jul 31, 2014 at 03:32:18PM -0700, Zetan Drableg wrote:
Ok - By the way, I looked into updating out KVM versions. Since we already have so many KVM servers of this version in production, I can't easily forklift update everything without much testing.
exec /usr/libexec/qemu-kvm -s -S "$@"
export LIBGUESTFS_HV=/root/work/qemu-wrapper export LIBGUESTFS_BACKEND=direct
How do I simulate the setup of devices the test tool perform? Just copy/pasting the qemu-kvm argument list doesn't work.
I was hoping that LIBGUESTFS_HV would replace usage of /usr/libexec/qemu-kvm with /root/work/qemu-wrapper, but does not appear to
OK I think the problem is that it's libguestfs 1.20, where the environment variable names are different (check guestfs(3) in your local copy). This should work: export LIBGUESTFS_ATTACH_METHOD=appliance export LIBGUESTFS_QEMU=/root/work/qemu-wrapper There's an additional problem which is you need the wrapper to distinguish between -help and -version tests and the final command. Use a wrapper like this: ---------------------------------------------------------------------- #!/bin/bash - qemu=/usr/libexec/qemu-kvm if ! echo "$@" | grep -sqE -- '-help|-version'; then echo QEMU debugging enabled. debug="-s -S" fi exec $qemu $debug "$@" ---------------------------------------------------------------------- The wrapper must be executable. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Ok now we are getting somewhere! Those old vars did the trick. libguestfs-test-tool launched with qemu-wrapper as expected with the debug port open. Now on to the fun part! (gdb) set architecture i8086 The target architecture is assumed to be i8086 (gdb) break *0x7c00 Breakpoint 1 at 0x7c00 (gdb) target remote :1234 Remote debugging using :1234 0x0000fff0 in ?? () (gdb) cont Continuing. The breakpoint you documented as when the boot sector has been loaded into memory by the BIOS and control is passed to the boot sector. Never hits the breakpoint..... Next steps? Do I need to load a symbol table? Where might I find it? On Fri, Aug 1, 2014 at 12:24 AM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Thu, Jul 31, 2014 at 03:32:18PM -0700, Zetan Drableg wrote:
Ok - By the way, I looked into updating out KVM versions. Since we already have so many KVM servers of this version in production, I can't easily forklift update everything without much testing.
exec /usr/libexec/qemu-kvm -s -S "$@"
export LIBGUESTFS_HV=/root/work/qemu-wrapper export LIBGUESTFS_BACKEND=direct
How do I simulate the setup of devices the test tool perform? Just copy/pasting the qemu-kvm argument list doesn't work.
I was hoping that LIBGUESTFS_HV would replace usage of /usr/libexec/qemu-kvm with /root/work/qemu-wrapper, but does not appear to
OK I think the problem is that it's libguestfs 1.20, where the environment variable names are different (check guestfs(3) in your local copy). This should work:
export LIBGUESTFS_ATTACH_METHOD=appliance export LIBGUESTFS_QEMU=/root/work/qemu-wrapper
There's an additional problem which is you need the wrapper to distinguish between -help and -version tests and the final command. Use a wrapper like this:
---------------------------------------------------------------------- #!/bin/bash -
qemu=/usr/libexec/qemu-kvm
if ! echo "$@" | grep -sqE -- '-help|-version'; then echo QEMU debugging enabled. debug="-s -S" fi
exec $qemu $debug "$@" ----------------------------------------------------------------------
The wrapper must be executable.
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
On Fri, Aug 01, 2014 at 07:43:08AM -0700, Zetan Drableg wrote:
Ok now we are getting somewhere! Those old vars did the trick. libguestfs-test-tool launched with qemu-wrapper as expected with the debug port open. Now on to the fun part!
(gdb) set architecture i8086 The target architecture is assumed to be i8086 (gdb) break *0x7c00 Breakpoint 1 at 0x7c00 (gdb) target remote :1234 Remote debugging using :1234 0x0000fff0 in ?? () (gdb) cont Continuing.
The breakpoint you documented as when the boot sector has been loaded into memory by the BIOS and control is passed to the boot sector. Never hits the breakpoint.....
Next steps?
Do I need to load a symbol table? Where might I find it?
This is getting very much to the edge of my experience, but yes, you probably do need to load the symbol table, and I know how. First install the kernel-debuginfo package that exactly corresponds to the kernel which is being run inside the guest. You can usually tell which kernel that is by looking at the output of supermin (it's usually the one which has the highest version number out of all of those "picked"). Then in the kernel-debuginfo package, find the 'vmlinux' file, eg: $ rpm -ql kernel-debuginfo | grep vmlinux /usr/lib/debug/lib/modules/3.14.4-200.fc20.x86_64/vmlinux Then you can get gdb to take the symbols from that file using the gdb command: (gdb) symbol-file /path/to/vmlinux Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Setup debuginfo repo /etc/yum.repos.d/debuginfo. repo [ol6_debuginfo] name=Oracle Linux 6 debuginfo baseurl=http://oss.oracle.com/ol6/debuginfo gpgkey=https://oss.oracle.com/ol6/RPM-GPG-KEY-oracle gpgcheck=1 enabled=1 yum update yum install kernel-debuginfo (gdb) set architecture i8086 The target architecture is assumed to be i8086 (gdb) symbol-file /usr/lib/debug/lib/modules/2.6.32-431.20.3.el6.x86_64/vmlinux Reading symbols from /usr/lib/debug/lib/modules/2.6.32-431.20.3.el6.x86_64/vmlinux...done. (gdb) target remote :1234 Remote debugging using :1234 0x0000fff0 in ?? () (gdb) break *0x7c00 Breakpoint 1 at 0x7c00 (gdb) cont Continuing. .... Didn't hit the breakpoint SeaBIOS (version seabios-0.6.1.2-28.el6) Probing EDD (edd=off to disable)... ok \x1b[2J QEMU: Terminated via GDBstub On Fri, Aug 1, 2014 at 7:59 AM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Fri, Aug 01, 2014 at 07:43:08AM -0700, Zetan Drableg wrote:
Ok now we are getting somewhere! Those old vars did the trick. libguestfs-test-tool launched with qemu-wrapper as expected with the debug port open. Now on to the fun part!
(gdb) set architecture i8086 The target architecture is assumed to be i8086 (gdb) break *0x7c00 Breakpoint 1 at 0x7c00 (gdb) target remote :1234 Remote debugging using :1234 0x0000fff0 in ?? () (gdb) cont Continuing.
The breakpoint you documented as when the boot sector has been loaded into memory by the BIOS and control is passed to the boot sector. Never hits the breakpoint.....
Next steps?
Do I need to load a symbol table? Where might I find it?
This is getting very much to the edge of my experience, but yes, you probably do need to load the symbol table, and I know how.
First install the kernel-debuginfo package that exactly corresponds to the kernel which is being run inside the guest. You can usually tell which kernel that is by looking at the output of supermin (it's usually the one which has the highest version number out of all of those "picked").
Then in the kernel-debuginfo package, find the 'vmlinux' file, eg:
$ rpm -ql kernel-debuginfo | grep vmlinux /usr/lib/debug/lib/modules/3.14.4-200.fc20.x86_64/vmlinux
Then you can get gdb to take the symbols from that file using the gdb command:
(gdb) symbol-file /path/to/vmlinux
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
On Fri, Aug 01, 2014 at 03:14:17PM -0700, Zetan Drableg wrote:
Setup debuginfo repo /etc/yum.repos.d/debuginfo. repo [ol6_debuginfo] name=Oracle Linux 6 debuginfo baseurl=http://oss.oracle.com/ol6/debuginfo gpgkey=https://oss.oracle.com/ol6/RPM-GPG-KEY-oracle gpgcheck=1 enabled=1
yum update yum install kernel-debuginfo
(gdb) set architecture i8086 The target architecture is assumed to be i8086 (gdb) symbol-file /usr/lib/debug/lib/modules/2.6.32-431.20.3.el6.x86_64/vmlinux Reading symbols from /usr/lib/debug/lib/modules/2.6.32-431.20.3.el6.x86_64/vmlinux...done. (gdb) target remote :1234 Remote debugging using :1234 0x0000fff0 in ?? () (gdb) break *0x7c00 Breakpoint 1 at 0x7c00
This might be the wrong breakpoint ...
(gdb) cont Continuing. .... Didn't hit the breakpoint
... but in any case you can hit ^C at some point to pause the guest and find out where the guest is stuck. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
I discovered another tip today. Force TCG by changing the qemu command line to: -machine pc,accel=tcg and add the following on the command line: -d in_asm,exec,int That will cause each instruction emulated by TCG to be dumped out, along with registers and other information. It should tell you what the VM is doing. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Sometimes the most complex problems have the simplest answers. I switched from 2.6.39-400.215.3.el6uek.x86_64 to 2.6.32-431.20.3.el6.x86_64 and the libguest tools work! Something with UEK is causing the problem. Thanks for all the help. On Thu, Aug 7, 2014 at 3:55 AM, Richard W.M. Jones <rjones@redhat.com> wrote:
I discovered another tip today.
Force TCG by changing the qemu command line to:
-machine pc,accel=tcg
and add the following on the command line:
-d in_asm,exec,int
That will cause each instruction emulated by TCG to be dumped out, along with registers and other information. It should tell you what the VM is doing.
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
participants (2)
-
Richard W.M. Jones -
Zetan Drableg