Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
Clone of bug 1661038, so copying its important bits:
=========================================
Description of problem:
guestfish fails to correctly parse (some?) partitionless devices listed in /etc/fstab within a Linux image and unexpectedly exits with an error.
---
Version-Release number of selected component (if applicable):
$ guestfish --version
guestfish 1.38.2rhel=7,release=12.el7_6.1,libvirt
---
How reproducible:
Consistently.
---
Steps to Reproduce:
1. Build a qcow2 image for a Linux OS where '/etc/fstab' specifies where a device such as '/dev/vdc' should be mounted.
2. Run 'virt-inspector' on the image. Or run 'guestfish -a <image>', and from within the 'guestfish' shell, run 'launch' followed by 'inspect_os'.
As of this writing, the following are bootable images for Fedora 24 and Ubuntu 12.04 that illustrate the issue:
* https://platform.swampinabox.org/platform-images/condor-fedora-24-64-master-2016080801.qcow2.gz
* https://platform.swampinabox.org/platform-images/condor-ubuntu-12.04-64-master-2016102702.qcow2.gz
---
Actual results:
$ virt-inspector condor-fedora-24-64-master-2016080801.qcow2
libguestfs: error: inspect_os: int_of_string
virt-inspector: no operating system could be detected inside this disk image.
---
Expected results:
Valid information.
---
Additional info:
In the 'libguestfs' sources, 'daemon/inspect_fs_unix_fstab.ml' appears to contain a bug. The definition of 're_xdev' allows for partionless devices. The use of this regular expression within the function 'resolve_fstab_device' assumes that the string being matched does specify a partition:
else if PCRE.matches re_xdev spec then (
...
and part = int_of_string (PCRE.sub 3)
...
)
See the attachment 'virt-inspector-verbose.txt' for the output from 'virt-inspector -v'. The following section appears to be relevant:
check_fstab_entry: augeas path: /files/etc/fstab/5
check_fstab_entry: spec=/dev/vdc
check_fstab_entry: mp=/mnt/out
resolve_fstab_device: /dev/vdc matched xdev
ocaml_exn: 'inspect_os' raised 'Failure' exception
guestfsd: error: int_of_string
guestfsd: => inspect_os (0x1e0) took 1.14 secs
libguestfs: error: inspect_os: int_of_string
=========================================
To be more precise: the OCaml code above assumes that the partition number is not an empty string, while re_xdev is:
let re_xdev = PCRE.compile "^/dev/(h|s|v|xv)d([a-z]+)(\\d*)$"
which indeed can result in an empty string for the 3rd match.
This is a regression in the new OCaml code, compared to the old C one (in libguestfs < 1.38).
The old code just took the result of the 3rd match as string, using it as-is without trying to convert it as integer.
Sent a simple patch to fix this:
https://www.redhat.com/archives/libguestfs/2019-January/msg00103.html
=========================================
Fixed upstream with
https://github.com/libguestfs/libguestfs/commit/cf6b527824b2a8dc6e8bc65e38ebdceb227e6db1
which is in libguestfs >= 1.39.15.
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-2019:2096