RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1608131 - inspection fails when swap partition in /etc/fstab has incorrect UUID compared to actual swap partition
Summary: inspection fails when swap partition in /etc/fstab has incorrect UUID compare...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.6
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-25 03:25 UTC by YongkuiGuo
Modified: 2019-01-16 08:07 UTC (History)
2 users (show)

Fixed In Version: libguestfs-1.38.2-10.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 07:47:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
the log of virt-inspector (64.88 KB, text/plain)
2018-07-25 03:25 UTC, YongkuiGuo
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:3021 0 None None None 2018-10-30 07:47:28 UTC

Description YongkuiGuo 2018-07-25 03:25:09 UTC
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:

Comment 2 Richard W.M. Jones 2018-07-25 07:20:38 UTC
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 /

Comment 3 YongkuiGuo 2018-07-25 08:30:13 UTC
(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
}

Comment 4 Richard W.M. Jones 2018-07-25 08:44:44 UTC
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?

Comment 5 YongkuiGuo 2018-07-25 10:24:39 UTC
(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.

Comment 6 YongkuiGuo 2018-07-25 10:30:08 UTC
(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.

Comment 7 Richard W.M. Jones 2018-07-25 11:16:46 UTC
Sorry, another quick question.  What does this say?

><fs> vfs-uuid /dev/sda2
><fs> file /dev/sda2

Comment 8 YongkuiGuo 2018-07-26 00:45:31 UTC
(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

Comment 9 Richard W.M. Jones 2018-07-26 08:23:14 UTC
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.

Comment 10 Richard W.M. Jones 2018-07-26 08:23:54 UTC
I'm moving this to RHEL 7.7 unless it's an actual regression
compared to earlier versions of libguestfs.

Comment 13 YongkuiGuo 2018-07-27 02:53:00 UTC
(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.

Comment 14 Pino Toscano 2018-07-27 13:34:21 UTC
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

Comment 16 Pino Toscano 2018-07-27 14:12:17 UTC
Fixed upstream with
https://github.com/libguestfs/libguestfs/commit/67c36779c3bd383f8c550d9c43b0884d1a108c4d
which is in libguestfs >= 1.39.9.

Comment 18 YongkuiGuo 2018-07-31 05:20:02 UTC
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.

Comment 20 errata-xmlrpc 2018-10-30 07:47:00 UTC
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


Note You need to log in before you can comment on or make changes to this bug.