Created attachment 1470420 [details] the log of virt-inspector Description of problem: virt-inspector can't inspect rhel7 guest image on which / partition is formatted with btrfs filesystem Version-Release number of selected component (if applicable): libguestfs-1.38.2-8.el7.x86_64 How reproducible: 100% Steps: 1.Inspect the rhel7.3-btrfs.qcow2 guest image #virt-inspector -a rhel7.3-btrfs.qcow2 libguestfs: error: inspect_os: findfs exited with status 1: findfs: unable to resolve 'UUID=e89ce156-8cd1-4fdb-8d2b-519a813fe701' virt-inspector: no operating system could be detected inside this disk image. ... Note: # guestfish -a rhel7.3-btrfs.qcow2 ><fs> run ><fs> list-filesystems /dev/sda1: btrfs btrfsvol:/dev/sda1/root: btrfs btrfsvol:/dev/sda1/root/var/lib/machines: btrfs /dev/sda2: swap ><fs> inspect-os libguestfs: error: inspect_os: findfs exited with status 1: findfs: unable to resolve 'UUID=e89ce156-8cd1-4fdb-8d2b-519a813fe701' Please check the -v -x log in attachment for details. Actual results: Failed to inspect guest image which contains btrfs filesystem. Expected results: Libguestfs can inspect the guest image above successfully. Additional info:
Can you run these guestfish commands in the guest: ><fs> vfs-uuid btrfsvol:/dev/sda1/root ><fs> mount btrfsvol:/dev/sda1/root / ><fs> btrfs-subvolume-list /
(In reply to Richard W.M. Jones from comment #2) ><fs> vfs-uuid btrfsvol:/dev/sda1/root c4335bff-816c-4c3a-8cfd-82a5a2428bc5 ><fs> mount btrfsvol:/dev/sda1/root / ><fs> btrfs-subvolume-list / [0] = { btrfssubvolume_id: 257 btrfssubvolume_top_level_id: 5 btrfssubvolume_path: root } [1] = { btrfssubvolume_id: 259 btrfssubvolume_top_level_id: 257 btrfssubvolume_path: var/lib/machines }
I guess this is a regression in the new inspection code. Do you happen to know if it worked with RHEL 7.5 libguestfs (if you don't know, then don't worry). It would be useful to get /etc/fstab from the guest. Also do you know what guest device has UUID e89ce156-8cd1-4fdb-8d2b-519a813fe701 inside the guest?
(In reply to Richard W.M. Jones from comment #4) # virt-cat -a rhel7.3-btrfs.qcow2 /etc/fstab ------------------------------------------------ libguestfs: error: findfs_uuid: findfs: unable to resolve 'UUID=c4335bff-816c-4c3a-8cfd-82a5a2428bc5' libguestfs: error: findfs_uuid: findfs: unable to resolve 'UUID=e89ce156-8cd1-4fdb-8d2b-519a813fe701' # # /etc/fstab # Created by anaconda on Fri Mar 17 12:02:59 2017 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=c4335bff-816c-4c3a-8cfd-82a5a2428bc5 / btrfs subvol=root,auto 0 0 UUID=e89ce156-8cd1-4fdb-8d2b-519a813fe701 swap swap defaults 0 0 ------------------------------------------------- The virt-* commands work fine on RHEL7.5, but there are similar errors at the beginning of the result. > Also do you know what guest device has > UUID e89ce156-8cd1-4fdb-8d2b-519a813fe701 inside the guest? I will check it.
(In reply to Richard W.M. Jones from comment #4) > Also do you know what guest device has > UUID e89ce156-8cd1-4fdb-8d2b-519a813fe701 inside the guest? It's swap partition.
Sorry, another quick question. What does this say? ><fs> vfs-uuid /dev/sda2 ><fs> file /dev/sda2
(In reply to Richard W.M. Jones from comment #7) ><fs> vfs-uuid /dev/sda2 88eaf36a-743c-4844-8a2d-5e46afd587d3 ><fs> file /dev/sda2 Linux/i386 swap file (new style), version 1 (4K pages), size 524031 pages, no label, UUID=88eaf36a-743c-4844-8a2d-5e46afd587d3
So I guess the swap partition doesn't in fact have UUID e89ce156-etc (unless there's another swap partition?) However inspection probably shouldn't fail in this case.
I'm moving this to RHEL 7.7 unless it's an actual regression compared to earlier versions of libguestfs.
(In reply to Richard W.M. Jones from comment #9) > So I guess the swap partition doesn't in fact have UUID > e89ce156-etc (unless there's another swap partition?) Yes, probably there is a wrong UUID for swap partition in /etc/fstab. And there's no other swap partition.
This is actually a regression in the new inspection code. The previous C code did not fail if guestfs_findfs_uuid or guestfs_findfs_label returned an error (which was effectively ignored), but just ignored the device. Now the OCaml code defaults if raising exceptions, which is the case since the "findfs" command returns an error. I just posted a patch to restore the old behaviour, i.e. ignore devices in fstab whose UUID or LABEL cannot be resolved: https://www.redhat.com/archives/libguestfs/2018-July/msg00069.html
Fixed upstream with https://github.com/libguestfs/libguestfs/commit/67c36779c3bd383f8c550d9c43b0884d1a108c4d which is in libguestfs >= 1.39.9.
Verified with package: libguestfs-1.38.2-10.el7.x86_64 Steps: 1. Inspect the rhel7.3-btrfs.qcow2 guest image $virt-inspector -a rhel7.3-btrfs.qcow2 -------------------------------------- <?xml version="1.0"?> <operatingsystems> <operatingsystem> <root>btrfsvol:/dev/sda1/root</root> <name>linux</name> <arch>x86_64</arch> <distro>rhel</distro> <product_name>Red Hat Enterprise Linux Server 7.3 (Maipo)</product_name> <major_version>7</major_version> <minor_version>3</minor_version> ... -------------------------------------- It works fine. And other commands like virt-cat, guestfish also work well.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2018:3021