Add debugging to dmesg code.
[virt-dmesg.git] / man / virt-dmesg.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 virt-dmesg - Print kernel messages from a Linux virtual machine
6
7 =head1 SYNOPSIS
8
9  virt-dmesg [--options] domname
10
11  virt-uname [--options] domname
12
13  virt-dmesg --dump-kernel domname | strings | less
14
15 =head1 DESCRIPTION
16
17 B<virt-dmesg> prints the kernel messages from a running Linux virtual
18 machine.  It is like L<dmesg(1)> except that it works on virtual
19 machines instead of the host.
20
21 virt-dmesg requires memory snooping features only available in the
22 QEMU and KVM hypervisors, and so at present it will only work for QEMU
23 and KVM virtual machines.  It may be possible to add support for other
24 hypervisors in future.
25
26 virt-dmesg works by snooping the memory of the virtual machine,
27 reading and downloading the kernel memory, and then using heuristics
28 to find the kernel symbols.  The advantage of this is that it should
29 work for most Linux virtual machines, regardless of version and
30 distro.  The disadvantage is that heuristics are not guaranteed to be
31 successful.  For reliable access to many Linux kernel structures,
32 including process tables and much more, please use the I<kdump>,
33 I<virsh dump> and/or L<crash(8)> utilities instead.
34
35 =head1 USAGE FOR GETTING KERNEL MESSAGES (DMESG)
36
37 To display the kernel messages (dmesg), where I<Guest> is the libvirt
38 name of a running Linux virtual machine do:
39
40  virt-dmesg Guest
41
42 =head1 USAGE FOR GETTING KERNEL VERSION (UNAME, UTSNAME)
43
44 If virt-dmesg is invoked with the I<--uname> option or if virt-uname
45 is a hard link to the virt-dmesg program, then the program shows the
46 system "utsname", the strings returned by the utsname(2) system call
47 or the L<uname(1)> program:
48
49  virt-uname Guest
50
51  virt-dmesg --uname Guest
52
53 =head1 USAGE FOR DUMPING KERNEL
54
55 Instead of having virt-dmesg attempt to heuristically parse the kernel
56 image, you can have virt-dmesg simply dump the kernel image to stdout.
57 You can pass this to L<hexdump(1)> or L<strings(1)> to look for
58 strings or other secrets in the kernel:
59
60  virt-dmesg --dump-kernel Guest | strings | less
61
62 A tip: to find the kernel messages, try searching for the following
63 patterns:
64
65  ^<5>.*Linux
66  ^<[0-9]>
67
68 or for other strings that you suspect might be in the kernel output
69 such as common initialization strings or error messages.
70
71 =head1 OPTIONS
72
73 =over 4
74
75 =item B<--help>
76
77 Display brief help.
78
79 =item B<-c> URI
80
81 =item B<--connect> URI
82
83 If using libvirt, connect to the given I<URI>.  If omitted, then we
84 connect to the default libvirt hypervisor.
85
86 =item B<--dump-kernel>
87
88 Dump the kernel to stdout.  This prints lots of binary data, so it is
89 best to pipe this through a program such as L<strings(1)>.
90
91 =item B<--uname>
92
93 Print utsname strings (ie. kernel version) instead of kernel messages.
94
95 If virt-uname is a hard link to virt-dmesg, then this is the default.
96
97 =item B<-v>
98
99 Enable verbose messages for debugging.
100
101 =item B<-V>
102
103 =item B<--version>
104
105 Display version number and exit.
106
107 =back
108
109 =head1 DIAGNOSTICS
110
111 =head2 "cannot find kernel"
112
113 We can't find the kernel at any known address.  We don't scan the
114 whole of the guest memory, because that would take far too long.
115 Instead we look in a small number of locations where Linux kernels are
116 commonly found.  If none of these locations appear to contain a kernel
117 then you will see this error message.
118
119 Assuming that the guest really is running Linux, use the I<virt-dmesg
120 -v> option to see what addresses the program is checking.
121
122 Compare this to the contents of C</proc/kallsyms> or C</boot/config-*>
123 B<inside> the guest.
124
125 If the kernel is located at a completely different address, or if the
126 address is correct but virt-dmesg does not appear to detect the kernel
127 there, please file a bug (see L</REPORTING BUGS> below).
128
129 =head2 "could not find kernel log buffer in kernel image"
130
131 The kernel symbols (C<log_buf>, C<log_buf_len>, C<log_end>,
132 C<logged_chars>) are not exported in C</proc/kallsyms> in the guest
133 kernel.
134
135 Ask your Linux distributor to enable all of these kernel configuration
136 options:
137
138  CONFIG_KALLSYMS=y
139  CONFIG_KALLSYMS_ALL=y
140  CONFIG_KALLSYMS_EXTRA_PASS=y
141
142 =head1 SEE ALSO
143
144 L<dmesg(1)>,
145 L<uname(1)>,
146 L<crash(8)>,
147 L<http://libvirt.org/>.
148
149 =head1 AUTHOR
150
151 Richard W.M. Jones L<http://people.redhat.com/~rjones/>
152
153 =head1 COPYRIGHT
154
155 Copyright (C) 2008-2011 Red Hat Inc.
156
157 This program is free software; you can redistribute it and/or modify
158 it under the terms of the GNU General Public License as published by
159 the Free Software Foundation; either version 2 of the License, or
160 (at your option) any later version.
161
162 This program is distributed in the hope that it will be useful,
163 but WITHOUT ANY WARRANTY; without even the implied warranty of
164 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
165 GNU General Public License for more details.
166
167 You should have received a copy of the GNU General Public License
168 along with this program; if not, write to the Free Software
169 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
170
171 =head1 REPORTING BUGS
172
173 You can see current bugs reported against virt-dmesg at the following
174 URL:
175
176 https://bugzilla.redhat.com/buglist.cgi?component=virt-dmesg
177
178 If the bug you are experiencing is not listed there, please file a new
179 bug here:
180
181 https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=virt-dmesg
182
183 Give as much detail as possible.  Include:
184
185 =over 4
186
187 =item *
188
189 The version of virt-dmesg, libvirt and qemu/KVM.
190
191 =item *
192
193 How you obtained virt-dmesg (packaged in Fedora, compiled from source,
194 etc.)
195
196 =item *
197
198 The version of the guest you are trying to inspect.
199
200 It's is also useful to have C</proc/kallsyms> and C</boot/config-*>
201 from inside the guest.
202
203 =item *
204
205 The full output of virt-dmesg when you add the I<-v> (debugging)
206 option.
207
208 =back