virt-drivers - Detect bootloader, kernel and drivers inside guest
virt-drivers [--options] -d domname virt-drivers [--options] -a disk.img
This tool can detect the bootloader, kernel and drivers inside some guests from only the disk image. It can detect, for example, whether a disk image needs BIOS or UEFI to boot, and whether it supports virtio or requires slower emulated devices.
Normally you should distribute hypervisor metadata (eg. libvirt XML or OVF) alongside disk images to tell the hypervisor how to boot them. This tool is used when this metadata has not been provided. Work with the supplier of the disk image to get them to provide proper metadata.
The output is an XML document. At the top level it lists the operating systems found (the same as virt-inspector(1)):
<operatingsystems> <operatingsystem> <root>/dev/sda2</root> <name>linux</name> <arch>x86_64</arch> <distro>fedora</distro> ... </operatingsystem> <operatingsystem> <root>/dev/sdb1</root> ... </operatingsystem> </operatingsystems>
The <firmware> element lists the firmware which is required to boot the guest. For UEFI it will additionally show the EFI system partition ("ESP"). Guests may support multiple boot firmwares. For example this guest is detected as using UEFI boot, and the UEFI ESP is the first partition of the first disk:
<operatingsystems> <firmware type='uefi'>/dev/sda1</firmware> <operatingsystem> ...
The <bootloader> element shows the bootloader found in the Linux guest. If known, this may contain information about what Linux kernels are provided. For example:
<operatingsystems> <firmware type='bios'/> <operatingsystem> <root>/dev/sda2</root> <name>linux</name> ... <bootloader type='grub2' config='/boot/grub2/grub.cfg'> <kernel> <name>kernel</name> <version>6.1.0-0.rc6.46.fc38.x86_64</version> <vmlinuz>/boot/vmlinuz-6.1.0-0.rc6.46.fc38.x86_64</vmlinuz> <modules> ... </modules> <supports_virtio_blk/> <supports_virtio_net/> ... </kernel> </bootloader>
Many more fields are usually available for Linux guests, including a complete list of kernel modules and information about support for virtio. For a complete example see: https://github.com/rwmjones/guestfs-tools/tree/master/drivers
The <drivers> element lists information about drivers found in Windows guests:
<operatingsystems> <firmware type='bios'/> <operatingsystem> <root>/dev/sda2</root> <name>windows</name> ... <drivers> <driver> <name>scsidev</name> <pci vendor='1077' device='1216' subsystem='8471101E'/> <pci vendor='1077' device='1216' subsystem='8493101E'/> </driver> ... </drivers>
The driver name (eg.
scsidev) corresponds to the Windows driver .INF file (eg. scsidev.inf). The list of PCI, USB etc devices are the matching devices which would cause this driver to load at boot.
Add file which should be a disk image from a virtual machine.
The format of the disk image is auto-detected. To override this and force a particular format use the --format option.
Add a remote disk. The URI format is compatible with guestfish. See "ADDING REMOTE STORAGE" in guestfish(1).
This parameter sets the sector size of the disk image added with -a option and is ignored for libvirt guest added with -d option. See also "guestfs_add_drive_opts" in guestfs(3).
Use ANSI colour sequences to colourize messages. This is the default when the output is a tty. If the output of the program is redirected to a file, ANSI colour sequences are disabled unless you use this option.
If using libvirt, connect to the given URI. If omitted, then we connect to the default libvirt hypervisor.
If you specify guest block devices directly (-a), then libvirt is not used at all.
Add all the disks from the named libvirt guest. Domain UUIDs can be used instead of names.
When prompting for keys and passphrases, virt-get-kernel normally turns echoing off so you cannot see what you are typing. If you are not worried about Tempest attacks and there is no one else in the room you can specify this flag to see what you are typing.
The default for the -a option is to auto-detect the format of the disk image. Using this forces the disk format for the -a option on the command line.
If you have untrusted raw-format guest disk images, you should use this option to specify the disk format. This avoids a possible security problem with malicious guests (CVE-2010-3851).
Specify a key for LUKS, to automatically open a LUKS device when using the inspection.
ID can be either the libguestfs device name, or the UUID of the LUKS device.
Use the specified
KEY_STRING as passphrase.
Read the passphrase from FILENAME.
Attempt passphrase-less unlocking for
ID with Clevis, over the network. Please refer to "ENCRYPTED DISKS" in guestfs(3) for more information on network-bound disk encryption (NBDE).
Note that if any such option is present on the command line, QEMU user networking will be automatically enabled for the libguestfs appliance.
Read key or passphrase parameters from stdin. The default is to try to read passphrases from the user by opening /dev/tty.
If there are multiple encrypted devices then you may need to supply multiple keys on stdin, one per line.
Don’t print ordinary progress messages.
Enable verbose messages for debugging.
Display version number and exit.
Wrap error, warning, and informative messages. This is the default when the output is a tty. If the output of the program is redirected to a file, wrapping is disabled unless you use this option.
Enable tracing of libguestfs API calls.
For other environment variables which affect all libguestfs programs, see "ENVIRONMENT VARIABLES" in guestfs(3).
This program returns 0 if successful, or non-zero if there was an error.
guestfs(3), guestfish(1), guestmount(1), virt-get-kernel(1), virt-inspector(1), virt-v2v(1), http://libguestfs.org/.
Richard W.M. Jones http://people.redhat.com/~rjones/
Copyright (C) 2009-2023 Red Hat Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
When reporting a bug, please supply:
The version of libguestfs.
Where you got libguestfs (eg. which Linux distro, compiled from source, etc)
Describe the bug accurately and give a way to reproduce it.
Run libguestfs-test-tool(1) and paste the complete, unedited output into the bug report.