I just pushed the virt-dmesg package to Fedora Rawhide[1].
http://koji.fedoraproject.org/koji/buildinfo?buildID=248890
This tool uses libvirt to let you list the kernel messages from a
Linux KVM guest without needing to log in or run any special agent in
the guest. It's useful when a guest crashes or gets stuck.
Usage is pretty simple:
# virt-dmesg F14x64 | head
<6>[ 0.000000] Initializing cgroup subsys cpuset
<6>[ 0.000000] Initializing cgroup subsys cpu
<5>[ 0.000000] Linux version 2.6.35.13-91.fc14.x86_64
(mockbuild(a)x86-15.phx2.fedoraproject.org) (gcc version 4.5.1 20100924 (Red Hat 4.5.1-4)
(GCC) ) #1 SMP Tue May 3 13:23:06 UTC 2011
<6>[ 0.000000] Command line: ro root=/dev/mapper/vg_f13x64-lv_root
rd_LVM_LV=vg_f13x64/lv_root rd_LVM_LV=vg_f13x64/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM
LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=uk rhgb quiet
<6>[ 0.000000] BIOS-provided physical RAM map:
<6>[ 0.000000] BIOS-e820: 0000000000000000 - 000000000009f400 (usable)
<6>[ 0.000000] BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved)
<6>[ 0.000000] BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
<6>[ 0.000000] BIOS-e820: 0000000000100000 - 000000003fffd000 (usable)
<6>[ 0.000000] BIOS-e820: 000000003fffd000 - 0000000040000000 (reserved)
In some cases virt-dmesg won't be able to find the symbol table, in
which case you can fall back to dumping out the kernel and grepping
it, eg:
# virt-dmesg --dump-kernel F14x64 | strings | grep '^<[0-9]>' | less
There's an accompanying tool called virt-uname which does what you
would think:
# virt-uname F14x64
Linux
f14x64.home.annexia.org 2.6.35.13-91.fc14.x86_64 #1 SMP Tue May 3 13:23:06 UTC 2011
x86_64 (none)
Please let me know if you find (Linux) guests for which virt-dmesg
doesn't work properly (particularly the --dump-kernel option which
ought to work for any Linux guest). Describe the guest as accurately
as you can and provide the output of 'virt-dmesg -v Guest'.
Rich.
[1] Sadly because of some regressions in libvirt, it *won't* work in
Fedora 15 or earlier unless you are able to upgrade to
libvirt >= 0.9.1-3.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top