.\" Automatically generated by Podwrapper::Man 1.34.6 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "virt-inspector 1" .TH virt-inspector 1 "2017-03-08" "libguestfs-1.34.6" "Virtualization Support" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "НАЗВА" .IX Header "НАЗВА" virt-inspector \- Display operating system version and other information about a virtual machine .SH "КОРОТКИЙ ОПИС" .IX Header "КОРОТКИЙ ОПИС" .Vb 1 \& virt\-inspector [\-\-параметри] \-d назва_домену \& \& virt\-inspector [\-\-параметри] \-a диск.img [\-a диск.img ...] .Ve .PP Застарілий стиль: .PP .Vb 1 \& virt\-inspector назва_домену \& \& virt\-inspector диск.img [диск.img ...] .Ve .SH "ОПИС" .IX Header "ОПИС" \&\fBvirt-inspector\fR examines a virtual machine or disk image and tries to determine the version of the operating system and other information about the virtual machine. .PP Virt-inspector produces \s-1XML\s0 output for feeding into other programs. .PP In the normal usage, use \f(CW\*(C`virt\-inspector \-d domname\*(C'\fR where \f(CW\*(C`domname\*(C'\fR is the libvirt domain (see: \f(CW\*(C`virsh list \-\-all\*(C'\fR). .PP You can also run virt-inspector directly on disk images from a single virtual machine. Use \f(CW\*(C`virt\-inspector \-a disk.img\*(C'\fR. In rare cases a domain has several block devices, in which case you should list several \fI\-a\fR options one after another, with the first corresponding to the guest's \&\fI/dev/sda\fR, the second to the guest's \fI/dev/sdb\fR and so on. .PP You can also run virt-inspector on install disks, live CDs, bootable \s-1USB\s0 keys and similar. .PP Virt-inspector can only inspect and report upon \fIone domain at a time\fR. To inspect several virtual machines, you have to run virt-inspector several times (for example, from a shell script for-loop). .PP Because virt-inspector needs direct access to guest images, it won't normally work over remote libvirt connections. .PP All of the information available from virt-inspector is also available through the core libguestfs inspection \s-1API\s0 (see \*(L"\s-1INSPECTION\*(R"\s0 in \fIguestfs\fR\|(3)). The same information can also be fetched using guestfish or via libguestfs bindings in many programming languages (see \*(L"\s-1GETTING INSPECTION DATA FROM THE LIBGUESTFS API\*(R"\s0). .SH "ПАРАМЕТРИ" .IX Header "ПАРАМЕТРИ" .IP "\fB\-\-help\fR" 4 .IX Item "--help" Показати коротку довідку. .IP "\fB\-a\fR файл" 4 .IX Item "-a файл" .PD 0 .IP "\fB\-\-add\fR файл" 4 .IX Item "--add файл" .PD Add \fIfile\fR which should be a disk image from a virtual machine. If the virtual machine has multiple block devices, you must supply all of them with separate \fI\-a\fR options. .Sp Формат образу диска визначається автоматично. Щоб перевизначити його і примусово використати певний формат, скористайтеся параметром \&\fI\-\-format=..\fR. .IP "\fB\-a\fR адреса" 4 .IX Item "-a адреса" .PD 0 .IP "\fB\-\-add\fR адреса" 4 .IX Item "--add адреса" .PD Додати віддалений диск. Див. \*(L"ДОДАВАННЯ ВІДДАЛЕНОГО СХОВИЩА\*(R" in \fIguestfish\fR\|(1). .IP "\fB\-c\fR адреса" 4 .IX Item "-c адреса" .PD 0 .IP "\fB\-\-connect\fR адреса" 4 .IX Item "--connect адреса" .PD Якщо використовується libvirt, встановити з’єднання з вказаним \fI\s-1URI\s0\fR. Якщо пропущено, з’єднання буде встановлено з типовим гіпервізором libvirt. .Sp Libvirt is only used if you specify a \f(CW\*(C`domname\*(C'\fR on the command line. If you specify guest block devices directly (\fI\-a\fR), then libvirt is not used at all. .IP "\fB\-d\fR гість" 4 .IX Item "-d гість" .PD 0 .IP "\fB\-\-domain\fR гість" 4 .IX Item "--domain гість" .PD Додати всі диски з вказаної гостьової системи libvirt. \s-1UUID\s0 доменів можна використовувати замість назв. .IP "\fB\-\-echo\-keys\fR" 4 .IX Item "--echo-keys" When prompting for keys and passphrases, virt-inspector 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. .IP "\fB\-\-format=raw|qcow2|..\fR" 4 .IX Item "--format=raw|qcow2|.." .PD 0 .IP "\fB\-\-format\fR" 4 .IX Item "--format" .PD Specify the format of disk images given on the command line. If this is omitted then the format is autodetected from the content of the disk image. .Sp If disk images are requested from libvirt, then this program asks libvirt for this information. In this case, the value of the format parameter is ignored. .Sp If working with untrusted raw-format guest disk images, you should ensure the format is always specified. .IP "\fB\-\-keys\-from\-stdin\fR" 4 .IX Item "--keys-from-stdin" Read key or passphrase parameters from stdin. The default is to try to read passphrases from the user by opening \fI/dev/tty\fR. .IP "\fB\-\-no\-applications\fR" 4 .IX Item "--no-applications" By default the output of virt-inspector includes the list of all the applications installed in the guest, if available. .Sp Specify this option to disable this part of the resulting \s-1XML.\s0 .IP "\fB\-\-no\-icon\fR" 4 .IX Item "--no-icon" By default the output of virt-inspector includes the icon of the guest, if available (see \*(L"icon\*(R"). .Sp Specify this option to disable this part of the resulting \s-1XML.\s0 .IP "\fB\-v\fR" 4 .IX Item "-v" .PD 0 .IP "\fB\-\-verbose\fR" 4 .IX Item "--verbose" .PD Увімкнути докладний показ повідомлень з метою діагностики. .IP "\fB\-V\fR" 4 .IX Item "-V" .PD 0 .IP "\fB\-\-version\fR" 4 .IX Item "--version" .PD Показати дані щодо версії і завершити роботу. .IP "\fB\-x\fR" 4 .IX Item "-x" Увімкнути трасування викликів програмного інтерфейсу libguestfs. .IP "\fB\-\-xpath\fR запит" 4 .IX Item "--xpath запит" Perform an XPath query on the \s-1XML\s0 on stdin, and print the result on stdout. In this mode virt-inspector simply runs an XPath query; all other inspection functions are disabled. See \*(L"\s-1XPATH QUERIES\*(R"\s0 below for some examples. .SH "ПАРАМЕТРИ КОМАНДНОГО РЯДКА У ФОРМАТІ ПОПЕРЕДНІХ ВЕРСІЙ" .IX Header "ПАРАМЕТРИ КОМАНДНОГО РЯДКА У ФОРМАТІ ПОПЕРЕДНІХ ВЕРСІЙ" Previous versions of virt-inspector allowed you to write either: .PP .Vb 1 \& virt\-inspector диск.img [диск.img ...] .Ve .PP або .PP .Vb 1 \& virt\-inspector назва_гостьової_системи .Ve .PP whereas in this version you should use \fI\-a\fR or \fI\-d\fR respectively to avoid the confusing case where a disk image might have the same name as a guest. .PP З міркувань зворотної сумісності передбачено підтримку запису параметрів у застарілому форматі. .SH "ФОРМАТ XML" .IX Header "ФОРМАТ XML" The virt-inspector \s-1XML\s0 is described precisely in a \s-1RELAX NG\s0 schema file \&\fIvirt\-inspector.rng\fR which is supplied with libguestfs. This section is just an overview. .PP The top-level element is , and it contains one or more elements. You would only see more than one element if the virtual machine is multi-boot, which is vanishingly rare in real world VMs. .SS "" .IX Subsection "" In the tag are various optional fields that describe the operating system, its architecture, the descriptive \*(L"product name\*(R" string, the type of \s-1OS\s0 and so on, as in this example: .PP .Vb 12 \& \& \& /dev/sda2 \& windows \& i386 \& windows \& Windows 7 Enterprise \& Client \& 6 \& 1 \& /Windows \& installed .Ve .PP In brief, is the class of operating system (something like \&\f(CW\*(C`linux\*(C'\fR or \f(CW\*(C`windows\*(C'\fR), is the distribution (eg. \f(CW\*(C`fedora\*(C'\fR but many other distros are recognized) and is the guest architecture. The other fields are fairly self-explanatory, but because these fields are taken directly from the libguestfs inspection \s-1API\s0 you can find precise information from \*(L"\s-1INSPECTION\*(R"\s0 in \fIguestfs\fR\|(3). .PP The element is the root filesystem device, but from the point of view of libguestfs (block devices may have completely different names inside the \s-1VM\s0 itself). .SS "" .IX Subsection "" Un*x\-like guests typically have multiple filesystems which are mounted at various mountpoints, and these are described in the element which looks like this: .PP .Vb 7 \& \& \& ... \& \& / \& /boot \& .Ve .PP As with , devices are from the point of view of libguestfs, and may have completely different names inside the guest. Only mountable filesystems appear in this list, not things like swap devices. .SS "" .IX Subsection "" is like but covers \fIall\fR filesystems belonging to the guest, including swap and empty partitions. (In the rare case of a multi-boot guest, it covers filesystems belonging to this \s-1OS\s0 or shared with this \s-1OS\s0 and other OSes). .PP Ви побачите щось таке: .PP .Vb 9 \& \& \& ... \& \& \& ext4 \& \& e6a4db1e\-15c2\-477b\-ac2a\-699181c396aa \& .Ve .PP The optional elements within are the filesystem type, the label, and the \s-1UUID.\s0 .SS "" .IX Subsection "" The related elements , and describe applications installed in the virtual machine. .PP , if present, describes the packaging system used. Typical values would be \f(CW\*(C`rpm\*(C'\fR and \f(CW\*(C`deb\*(C'\fR. .PP , if present, describes the package manager. Typical values include \f(CW\*(C`yum\*(C'\fR, \f(CW\*(C`up2date\*(C'\fR and \f(CW\*(C`apt\*(C'\fR .PP lists the packages or applications installed. .PP .Vb 9 \& \& \& ... \& \& \& coreutils \& 8.5 \& 1 \& .Ve .PP The version and release fields may not be available for some types guests. Other fields are possible, see \&\*(L"guestfs_inspect_list_applications\*(R" in \fIguestfs\fR\|(3). .SS "" .IX Subsection "" For operating systems like Windows which use drive letters, virt-inspector is able to find out how drive letters map to filesystems. .PP .Vb 7 \& \& \& ... \& \& /dev/sda2 \& /dev/sdb1 \& .Ve .PP In the example above, drive C maps to the filesystem on the second partition on the first disk, and drive E maps to the filesystem on the first partition on the second disk. .PP Note that this only covers permanent local filesystem mappings, not things like network shares. Furthermore \s-1NTFS\s0 volume mount points may not be listed here. .SS "" .IX Subsection "" Virt-inspector is sometimes able to extract an icon or logo for the guest. The icon is returned as base64\-encoded \s-1PNG\s0 data. Note that the icon can be very large and high quality. .PP .Vb 7 \& \& \& ... \& \& iVBORw0KGgoAAAANSUhEUgAAAGAAAABg[.......] \& [... багато рядків даних base64 ...] \& .Ve .PP To display the icon, you have to extract it and convert the base64 data back to a binary file. Use an XPath query or simply an editor to extract the data, then use the coreutils \fIbase64\fR\|(1) program to do the conversion back to a \s-1PNG\s0 file: .PP .Vb 1 \& base64 \-i \-d < дані.піктограми > icon.png .Ve .SS "\s-1INSPECTING INSTALL DISKS, LIVE\s0 CDs" .IX Subsection "INSPECTING INSTALL DISKS, LIVE CDs" Virt-inspector can detect some operating system installers on install disks, live CDs, bootable \s-1USB\s0 keys and more. .PP In this case the tag will contain \f(CW\*(C`installer\*(C'\fR and other fields may be present to indicate a live \s-1CD,\s0 network installer, or one part of a multipart \s-1CD.\s0 For example: .PP .Vb 11 \& \& \& /dev/sda \& linux \& i386 \& ubuntu \& Ubuntu 10.10 "Maverick Meerkat" \& 10 \& 10 \& installer \& .Ve .SH "XPATH QUERIES" .IX Header "XPATH QUERIES" Virt-inspector includes built in support for running XPath queries. The reason for including XPath support directly in virt-inspector is simply that there are no good and widely available command line programs that can do XPath queries. The only good one is \fIxmlstarlet\fR\|(1) and that is not available on Red Hat Enterprise Linux. .PP To perform an XPath query, use the \fI\-\-xpath\fR option. Note that in this mode, virt-inspector simply reads \s-1XML\s0 from stdin and outputs the query result on stdout. All other inspection features are disabled in this mode. .PP Приклад: .PP .Vb 5 \& $ virt\-inspector \-d Guest | virt\-inspector \-\-xpath \*(Aq//filesystems\*(Aq \& \& \& ext4 \& [...] \& \& $ virt\-inspector \-d Guest | \e \& virt\-inspector \-\-xpath "string(//filesystem[@dev=\*(Aq/dev/sda1\*(Aq]/type)" \& ext4 \& \& $ virt\-inspector \-d Guest | \e \& virt\-inspector \-\-xpath \*(Aqstring(//icon)\*(Aq | base64 \-i \-d | display \- \& [displays the guest icon, if there is one] .Ve .SH "GETTING INSPECTION DATA FROM THE LIBGUESTFS API" .IX Header "GETTING INSPECTION DATA FROM THE LIBGUESTFS API" In early versions of libguestfs, virt-inspector was a large Perl script that contained many heuristics for inspecting guests. This had several problems: in order to do inspection from other tools (like guestfish) we had to call out to this Perl script; and it privileged Perl over other languages that libguestfs supports. .PP By libguestfs 1.8 we had rewritten the Perl code in C, and incorporated it all into the core libguestfs \s-1API\s0 (\fIguestfs\fR\|(3)). Now virt-inspector is simply a thin C program over the core C \s-1API.\s0 All of the inspection information is available from all programming languages that libguestfs supports, and from guestfish. .PP For a description of the C inspection \s-1API,\s0 read \*(L"\s-1INSPECTION\*(R"\s0 in \fIguestfs\fR\|(3). .PP For example code using the C inspection \s-1API,\s0 look for \fIinspect\-vm.c\fR which ships with libguestfs. .PP \&\fIinspect\-vm.c\fR has also been translated into other languages. For example, \&\fIinspect_vm.pl\fR is the Perl translation, and there are other translations for OCaml, Python, etc. See \*(L"\s-1USING LIBGUESTFS WITH OTHER PROGRAMMING LANGUAGES\*(R"\s0 in \fIguestfs\fR\|(3) for a list of man pages which contain this example code. .SS "\s-1GETTING INSPECTION DATA FROM GUESTFISH\s0" .IX Subsection "GETTING INSPECTION DATA FROM GUESTFISH" If you use the guestfish \fI\-i\fR option, then the main C inspection \s-1API\s0 \&\*(L"guestfs_inspect_os\*(R" in \fIguestfs\fR\|(3) is called. This is equivalent to the guestfish command \f(CW\*(C`inspect\-os\*(C'\fR. You can also call this guestfish command by hand. .PP \&\f(CW\*(C`inspect\-os\*(C'\fR performs inspection on the current disk image, returning the list of operating systems found. Each \s-1OS\s0 is represented by its root filesystem device. In the majority of cases, this command prints nothing (no OSes found), or a single root device, but beware that it can print multiple lines if there are multiple OSes or if there is an install \s-1CD\s0 attached to the guest. .PP .Vb 4 \& $ guestfish \-\-ro \-a F15x32.img \& > run \& > inspect\-os \& /dev/vg_f15x32/lv_root .Ve .PP Using the root device, you can fetch further information about the guest: .PP .Vb 8 \& > inspect\-get\-type /dev/vg_f15x32/lv_root \& linux \& > inspect\-get\-distro /dev/vg_f15x32/lv_root \& fedora \& > inspect\-get\-major\-version /dev/vg_f15x32/lv_root \& 15 \& > inspect\-get\-product\-name /dev/vg_f15x32/lv_root \& Fedora release 15 (Lovelock) .Ve .PP Limitations of guestfish make it hard to assign the root device to a variable (since guestfish doesn't have variables), so if you want to do this reproducibly you are better off writing a script using one of the other languages that the libguestfs \s-1API\s0 supports. .PP To list applications, you have to first mount up the disks: .PP .Vb 5 \& > inspect\-get\-mountpoints /dev/vg_f15x32/lv_root \& /: /dev/vg_f15x32/lv_root \& /boot: /dev/vda1 \& > mount\-ro /dev/vg_f15x32/lv_root / \& > mount\-ro /dev/vda1 /boot .Ve .PP and then call the inspect-list-applications \s-1API:\s0 .PP .Vb 10 \& > inspect\-list\-applications /dev/vg_f15x32/lv_root | head \-28 \& [0] = { \& app_name: ConsoleKit \& app_display_name: \& app_epoch: 0 \& app_version: 0.4.5 \& app_release: 1.fc15 \& app_install_path: \& app_trans_path: \& app_publisher: \& app_url: \& app_source_package: \& app_summary: \& app_description: \& } \& [1] = { \& app_name: ConsoleKit\-libs \& app_display_name: \& app_epoch: 0 \& app_version: 0.4.5 \& app_release: 1.fc15 \& app_install_path: \& app_trans_path: \& app_publisher: \& app_url: \& app_source_package: \& app_summary: \& app_description: \& } .Ve .PP To display an icon for the guest, note that filesystems must also be mounted as above. You can then do: .PP .Vb 1 \& > inspect\-get\-icon /dev/vg_f15x32/lv_root | display \- .Ve .SH "ПОПЕРЕДНІ ВЕРСІЇ VIRT-INSPECTOR" .IX Header "ПОПЕРЕДНІ ВЕРСІЇ VIRT-INSPECTOR" As described above, early versions of libguestfs shipped with a different virt-inspector program written in Perl (the current version is written in C). The \s-1XML\s0 output of the Perl virt-inspector was different and it could also output in other formats like text. .PP The old virt-inspector is no longer supported or shipped with libguestfs. .PP To confuse matters further, in Red Hat Enterprise Linux 6 we ship two versions of virt-inspector with different names: .PP .Vb 2 \& virt\-inspector Old Perl version. \& virt\-inspector2 New C version. .Ve .SH "СТАН ВИХОДУ" .IX Header "СТАН ВИХОДУ" Ця програма повертає значення 0 у разі успішного завершення і ненульове значення, якщо сталася помилка. .SH "ТАКОЖ ПЕРЕГЛЯНЬТЕ" .IX Header "ТАКОЖ ПЕРЕГЛЯНЬТЕ" \&\fIguestfs\fR\|(3), \fIguestfish\fR\|(1), http://www.w3.org/TR/xpath/, \&\fIbase64\fR\|(1), \fIxmlstarlet\fR\|(1), http://libguestfs.org/. .SH "АВТОРИ" .IX Header "АВТОРИ" .IP "\(bu" 4 Richard W.M. Jones http://people.redhat.com/~rjones/ .IP "\(bu" 4 Matthew Booth mbooth@redhat.com .SH "АВТОРСЬКІ ПРАВА" .IX Header "АВТОРСЬКІ ПРАВА" © Red Hat Inc., 2010–2012 .SH "LICENSE" .IX Header "LICENSE" .SH "BUGS" .IX Header "BUGS" To get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools .PP To report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools .PP When reporting a bug, please supply: .IP "\(bu" 4 The version of libguestfs. .IP "\(bu" 4 Where you got libguestfs (eg. which Linux distro, compiled from source, etc) .IP "\(bu" 4 Describe the bug accurately and give a way to reproduce it. .IP "\(bu" 4 Run \fIlibguestfs\-test\-tool\fR\|(1) and paste the \fBcomplete, unedited\fR output into the bug report.