=head1 NAME

virt-drivers - Detect bootloader, kernel and drivers inside guest

=head1 SYNOPSIS

 virt-drivers [--options] -d domname

 virt-drivers [--options] -a disk.img

=head1 DESCRIPTION

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.

=head2 Notes

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.

=head1 XML FORMAT

The output is an XML document.  At the top level it lists the
operating systems found (the same as L<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>

=head2 E<lt>firmwareE<gt>

The E<lt>firmwareE<gt> 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>
     ...

=head2 E<lt>bootloaderE<gt> and E<lt>kernelE<gt>

The E<lt>bootloaderE<gt> 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:
L<https://github.com/libguestfs/guestfs-tools/tree/master/drivers>

=head2 E<lt>driversE<gt>

The E<lt>driversE<gt> 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. C<scsidev>) corresponds to the Windows driver
F<.INF> file (eg. F<scsidev.inf>).  The list of PCI, USB etc devices
are the matching devices which would cause this driver to load at
boot.

=head1 OPTIONS

=over 4

=item B<--help>

Display help.

=item B<-a> file

=item B<--add> file

Add I<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 I<--format> option.

=item B<-a> URI

=item B<--add> URI

Add a remote disk.  The URI format is compatible with guestfish.
See L<guestfish(1)/ADDING REMOTE STORAGE>.

=item B<--blocksize> B<512>

=item B<--blocksize> B<4096>

This parameter sets the sector size of the disk image added with I<-a>
option and is ignored for libvirt guest added with I<-d> option.  See
also L<guestfs(3)/guestfs_add_drive_opts>.

=item B<--colors>

=item B<--colours>

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.

=item B<-c> URI

=item B<--connect> URI

If using libvirt, connect to the given I<URI>.  If omitted, then we
connect to the default libvirt hypervisor.

If you specify guest block devices directly (I<-a>), then libvirt is
not used at all.

=item B<-d> guest

=item B<--domain> guest

Add all the disks from the named libvirt guest.  Domain UUIDs can be
used instead of names.

=item B<--echo-keys>

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.

=item B<--format> raw|qcow2|..

=item B<--format> auto

The default for the I<-a> option is to auto-detect the format of the
disk image.  Using this forces the disk format for the I<-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).

__INCLUDE:key-option.pod__

__INCLUDE:keys-from-stdin-option.pod__

=item B<-q>

=item B<--quiet>

Don’t print ordinary progress messages.

=item B<-v>

=item B<--verbose>

Enable verbose messages for debugging.

=item B<-V>

=item B<--version>

Display version number and exit.

=item B<--wrap>

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.

=item B<-x>

Enable tracing of libguestfs API calls.

=back

=head1 ENVIRONMENT VARIABLES

For other environment variables which affect all libguestfs programs,
see L<guestfs(3)/ENVIRONMENT VARIABLES>.

=head1 EXIT STATUS

This program returns 0 if successful, or non-zero if there was an
error.

=head1 SEE ALSO

L<guestfs(3)>,
L<guestfish(1)>,
L<guestmount(1)>,
L<virt-get-kernel(1)>,
L<virt-inspector(1)>,
L<virt-v2v(1)>,
L<http://libguestfs.org/>.

=head1 AUTHOR

Richard W.M. Jones L<http://people.redhat.com/~rjones/>

=head1 COPYRIGHT

Copyright (C) 2009-2025 Red Hat Inc.
