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 1836094 - virt-inspector fails to display the applications of RHEL 9 and OpenSUSE Tumbleweed (using sqlite rpmdb)
Summary: virt-inspector fails to display the applications of RHEL 9 and OpenSUSE Tumbl...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: libguestfs
Version: 8.6
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Virtualization Maintenance
QA Contact: YongkuiGuo
URL:
Whiteboard:
Depends On: 1938928
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-15 07:09 UTC by YongkuiGuo
Modified: 2022-05-10 13:27 UTC (History)
5 users (show)

Fixed In Version: libguestfs-1.44.0-4.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-10 13:18:34 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
virt-inspector log (79.58 KB, text/plain)
2020-05-15 07:09 UTC, YongkuiGuo
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2022:1759 0 None None None 2022-05-10 13:20:07 UTC

Description YongkuiGuo 2020-05-15 07:09:51 UTC
Created attachment 1688797 [details]
virt-inspector log

Description of problem:
The virt-inspector command fails to display the applications of the latest openSUSE Tumbleweed.


Version-Release number of selected component (if applicable):
libguestfs-1.42.0-1.module+el8.3.0+6496+d39ac712.x86_64
qemu-kvm-4.2.0-19.module+el8.3.0+6478+69f490bb.x86_64
kernel-4.18.0-196.el8.x86_64


How reproducible:
100%


Steps:

1. On rhel8.3 host
# virt-inspector -a openSUSE-Tumbleweed.qcow2 -v -x
...
command: mount '-o' 'ro' '/dev/system/root' '/sysroot//'
[    4.645712] EXT4-fs (dm-1): mounted filesystem with ordered data mode. Opts: (null)
guestfsd: => mount_ro (0x49) took 0.04 secs
libguestfs: trace: mount_ro = 0
libguestfs: trace: inspect_list_applications2 "/dev/system/root"
libguestfs: trace: inspect_get_type "/dev/system/root"
guestfsd: <= inspect_get_type (0x1e3) request length 60 bytes
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: udevadm --debug settle -E /dev/system/root
calling: settle
libguestfs: trace: inspect_get_type = "linux"
libguestfs: trace: inspect_get_package_format "/dev/system/root"
guestfsd: => inspect_get_type (0x1e3) took 0.02 secs
guestfsd: <= inspect_get_package_format (0x1e5) request length 60 bytes
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: udevadm --debug settle -E /dev/system/root
calling: settle
libguestfs: trace: inspect_get_package_format = "rpm"
libguestfs: trace: filesize "/var/lib/rpm/Name"
guestfsd: => inspect_get_package_format (0x1e5) took 0.02 secs
guestfsd: <= filesize (0xda) request length 64 bytes
guestfsd: error: /var/lib/rpm/Name: No such file or directory
guestfsd: => filesize (0xda) took 0.00 secs
libguestfs: trace: filesize = -1 (error)
libguestfs: error: filesize: /var/lib/rpm/Name: No such file or directory
libguestfs: trace: inspect_list_applications2 = NULL (error)
libguestfs: trace: close
libguestfs: closing guestfs handle 0x560970507930 (state 2)

2.
# virt-inspector -a openSUSE-Tumbleweed.qcow2 --no-applications
<?xml version="1.0"?>
<operatingsystems>
  <operatingsystem>
    <root>/dev/system/root</root>
    <name>linux</name>
    <arch>x86_64</arch>
    <distro>opensuse</distro>
    <product_name>openSUSE Tumbleweed</product_name>
    <major_version>20200511</major_version>
    <minor_version>0</minor_version>
    <package_format>rpm</package_format>
    <package_management>zypper</package_management>
    <osinfo>opensuse20200511.0</osinfo>
    <mountpoints>
      <mountpoint dev="/dev/system/root">/</mountpoint>
    </mountpoints>
    <filesystems>
      <filesystem dev="/dev/system/root">
        <type>ext4</type>
        <uuid>9a64421a-3abf-48ff-a06e-b581d36731d0</uuid>
      </filesystem>
      <filesystem dev="/dev/system/swap">
        <type>swap</type>
        <uuid>5f6eca79-b0fe-4f20-b62b-cd6e36f22c48</uuid>
      </filesystem>
    </filesystems>
    <icon>iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgIfAhkiAAAAAlw
...
F7NZS4n5qvFVSFWfizlj1eDLRzWJMhg959zMGfu1VRjgvwC17+4daFJg/QAAAABJRU5ErkJg
gg==</icon>
  </operatingsystem>
</operatingsystems>

It works fine.


Actual results:
The virt-inspector command fails.

Expected results:
The virt-inspector command run successfully.


Additional info:

Comment 1 Richard W.M. Jones 2020-05-15 12:14:14 UTC
It's likely this applies to Fedora Rawhide guests as well.  Both
now use a different RPM database (sqlite for Rawhide, not sure about SUSE)
so we need to use librpm in order to process the database instead
of assuming they're all using BDB.

Comment 3 Eric Hadley 2021-09-08 16:42:18 UTC
Bulk update: Move RHEL-AV bugs to RHEL9. If necessary to resolve in RHEL8, then clone to the current RHEL8 release.

Comment 4 YongkuiGuo 2021-09-09 02:19:31 UTC
I retested this issue and it was fixed on RHEL9. See this bug: https://bugzilla.redhat.com/show_bug.cgi?id=1935181. Due to this issue, on RHEL8 virt-inspector also fails to detect the rhel-guest-image-9.0-xxx.qcow2. (I see we don't support handling RHEL n+1 image on RHEL n officially)

On rhel8.6 bare metal:
# virt-inspector -a rhel-guest-image-9.0-20210906.7.x86_64.qcow2
libguestfs: error: filesize: /var/lib/rpm/Name: No such file or directory

If there is a plan to fix this issue on RHEL8, maybe we should revert this bug to RHEL8 again. Otherwise, we can close it.

Comment 5 Richard W.M. Jones 2021-09-09 07:18:57 UTC
Let's move this back to RHEL 8.  It should be possible to
backport this fix.

Comment 6 YongkuiGuo 2021-09-09 07:51:43 UTC
(In reply to Richard W.M. Jones from comment #5)
> Let's move this back to RHEL 8.  It should be possible to
> backport this fix.

Okay, thanks.

Comment 7 Dan Zheng 2021-09-27 03:37:47 UTC
Packages installed:
libvirt-6.0.0-37.module+el8.5.0+12162+40884dd2.ppc64le
qemu-kvm-4.2.0-58.module+el8.5.0+12272+74ace547.ppc64le
libguestfs-tools-c-1.40.2-28.module+el8.5.0+10717+67be7ac4.ppc64le
kernel-4.18.0-344.el8.ppc64le

RHEL 9.0 guest compose: http://download-node-02.eng.bos.redhat.com/rhel-9/composes/RHEL-9/RHEL-9.0.0-20210924.5

libvirt need to test RHEL 9.0 PPC guest installation on a RHEL 8.5 PPC host . 
The command we use to verify the installed guest is working normally. But it failed while I can start the guest using this image and log on and operate normally within the guest.

# virt-sysprep -a /var/lib/libvirt/images/image-builder3.qcow2 --run-command 'echo > /etc/machine-id'
 [   0.0] Examining the guest ...
virt-sysprep: error: no operating systems were found in the guest image 
If reporting bugs, run virt-sysprep with debugging enabled and include the 
complete output:

  virt-sysprep -v -x [...]



Dan Zheng
Libvirt QE

Comment 8 Richard W.M. Jones 2021-09-27 07:17:50 UTC
Can you add -v -x options to find out what the real problem is.

However one issue is going to be that examining RHEL > n guest using RHEL = n
host is not supported.

Comment 11 YongkuiGuo 2021-10-15 10:51:53 UTC
Verified with package:
libguestfs-1.44.0-4.module+el8.6.0+12969+f61072d9.x86_64


Steps:

1. On rhel8.6 host
# virt-inspector -a rhel-guest-image-9.0-20211014.7.x86_64.qcow2
<?xml version="1.0"?>
<operatingsystems>
  <operatingsystem>
    <root>/dev/sda3</root>
    <name>linux</name>
    <arch>x86_64</arch>
    <distro>rhel</distro>
    <product_name>Red Hat Enterprise Linux 9.0 Beta (Plow)</product_name>
    <major_version>9</major_version>
    <minor_version>0</minor_version>
    <package_format>rpm</package_format>
    <package_management>dnf</package_management>
    <osinfo>rhel9.0</osinfo>
    <mountpoints>
      <mountpoint dev="/dev/sda3">/</mountpoint>
      <mountpoint dev="/dev/sda2">/boot/efi</mountpoint>
    </mountpoints>
    <filesystems>
      <filesystem dev="/dev/sda2">
        <type>vfat</type>
        <uuid>7B77-95E7</uuid>
      </filesystem>
      <filesystem dev="/dev/sda3">
        <type>xfs</type>
        <label>root</label>
        <uuid>5057f04a-7fbc-4eef-b1d5-14517fa4b7c8</uuid>
      </filesystem>
    </filesystems>
    <applications>
      <application>
        <name>NetworkManager</name>
        <epoch>1</epoch>
        <version>1.34.0</version>
        <release>0.1.el9</release>
        <arch>x86_64</arch>
        ...
      </application>
    </applications>
  </operatingsystem>
</operatingsystems>

2.
# virt-inspector -a openSUSE-Tumbleweed.qcow2
<?xml version="1.0"?>
<operatingsystems>
  <operatingsystem>
    <root>/dev/system/root</root>
    <name>linux</name>
    <arch>x86_64</arch>
    <distro>opensuse</distro>
    <product_name>openSUSE Tumbleweed</product_name>
    <major_version>20200511</major_version>
    <minor_version>0</minor_version>
    <package_format>rpm</package_format>
    <package_management>zypper</package_management>
    <osinfo>opensuse20200511.0</osinfo>
    <mountpoints>
      <mountpoint dev="/dev/system/root">/</mountpoint>
    </mountpoints>
    <filesystems>
      <filesystem dev="/dev/system/root">
        <type>ext4</type>
        <uuid>9a64421a-3abf-48ff-a06e-b581d36731d0</uuid>
      </filesystem>
      <filesystem dev="/dev/system/swap">
        <type>swap</type>
        <uuid>5f6eca79-b0fe-4f20-b62b-cd6e36f22c48</uuid>
      </filesystem>
    </filesystems>
    <applications/>
    <icon>iVBORw0KGgoAAAAN
    ...
    gg==</icon>
  </operatingsystem>
</operatingsystems>

It works well on RHEL 9 guest image and OpenSUSE Tumbleweed.

Comment 13 errata-xmlrpc 2022-05-10 13:18:34 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 (Moderate: virt:rhel and virt-devel:rhel security, bug fix, and enhancement update), 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/RHSA-2022:1759


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