Bug 1332025
Summary: | Inspection does not parse /etc/redhat-release containing "Derived from Red Hat Enterprise Linux 7.1 (Source)" | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Richard W.M. Jones <rjones> |
Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> |
Status: | CLOSED ERRATA | QA Contact: | |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 7.2 | CC: | ptoscano, rbalakri, xchen |
Target Milestone: | rc | ||
Target Release: | 7.3 | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | libguestfs-1.32.4-1.el7.x86_64 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2016-11-03 18:00:05 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | 1218766 | ||
Bug Blocks: |
Description
Richard W.M. Jones
2016-05-01 10:02:05 UTC
The cloud image is the standard CentOS image from http://cloud.centos.org/centos/7/images/ They have split the release information out to /etc/centos-release so we should parse that file in preference to /etc/redhat-release. This also caused issues for facter: https://tickets.puppetlabs.com/browse/FACT-893 and the facter bug links to more info here: https://lists.centos.org/pipermail/centos-devel/2015-February/012876.html /etc/centos-release contains: CentOS Linux release 7.2.1511 (Core) The cloud images are detected properly: $ wget http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 $ virt-inspector -a CentOS-7-x86_64-GenericCloud.qcow2 <?xml version="1.0"?> <operatingsystems> <operatingsystem> <root>/dev/sda1</root> <name>linux</name> <arch>x86_64</arch> <distro>centos</distro> <product_name>CentOS Linux release 7.2.1511 (Core) </product_name> <major_version>7</major_version> <minor_version>2</minor_version> <package_format>rpm</package_format> <package_management>yum</package_management> [...] Also, this has been fixed one year ago in CentOS, see: https://lists.centos.org/pipermail/centos-announce/2015-April/021010.html (In reply to Richard W.M. Jones from comment #0) > virt-builder centos-7.1 \ > --write '/etc/redhat-release:Derived from Red Hat Enterprise Linux 7.1 > (Source)' > virt-inspector -a centos-7.1.img This is not a valid reproducer though, since /etc/redhat-release is a symlink to /etc/centos-release, which means the old content of centos-release is lost and there's no way to parse its version information again. Neither using the plain centos-7.0 template we provide triggers the bug. If the disk image is a real one (i.e. not forged manually, like above), I'd like to inspect it manually. (In reply to Richard W.M. Jones from comment #0) > As well as fixing the parsing problem, we should also make > sure that we don't try to infer the package manager / format > when the major version is obviously bogus. This is what happens in src/inspect.c: void guestfs_int_check_package_management (guestfs_h *g, struct inspect_fs *fs) { switch (fs->distro) { [...] case OS_DISTRO_REDHAT_BASED: case OS_DISTRO_RHEL: case OS_DISTRO_CENTOS: case OS_DISTRO_SCIENTIFIC_LINUX: case OS_DISTRO_ORACLE_LINUX: if (fs->major_version >= 5) fs->package_management = OS_PACKAGE_MANAGEMENT_YUM; else fs->package_management = OS_PACKAGE_MANAGEMENT_UP2DATE; break; Maybe a different logic can be setting UP2DATE when version_major is > 0 && < 5, although I'm not sure it would that much better. Yes Pino is completely correct here. This is fixed by: commit 1ff463e8692aae4313bd5b42bb6f09932bb63392 Author: Pino Toscano <ptoscano> Date: Fri May 29 16:01:26 2015 +0200 inspection: fix CentOS 7 detection In newer CentOS 7 versions /etc/redhat-release says that the distro is derived from RHEL, so we need to look at /etc/centos-release for actually identifying it as CentOS. The old code is needed as sub-case of /etc/redhat-release, as on CentOS < 7 that file is a symlink to /etc/centos-release. This is a RHEL 7.2-only bug which will be fixed by the rebase. (In reply to Pino Toscano from comment #3) > If the disk image is a real one (i.e. not forged manually, like above), I'd > like to inspect it manually. The disk image is: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1503.qcow2 which was released before the fix announced in comment 3. This is not reproducible with upstream libguestfs, which correctly displays the version of the guest as 7.1 and gives the right package management tool (yum). However it is also reproducible with RHEL 7.2: $ virt-inspector CentOS-7-x86_64-GenericCloud-1503.qcow2 ... <major_version>0</major_version> <minor_version>0</minor_version> <package_format>rpm</package_format> <package_management>up2date</package_management> ... It is fixed in our current RHEL 7.3 package (libguestfs-1.32.4-1.el7.x86_64). Couple of additional patches we might consider backporting: https://www.redhat.com/archives/libguestfs/2016-May/msg00016.html https://www.redhat.com/archives/libguestfs/2016-May/msg00017.html Those two patches are now upstream: https://github.com/libguestfs/libguestfs/commit/5470f059c2e45342638a598ac3515013e05aba12 https://github.com/libguestfs/libguestfs/commit/547662d9f6cea869d5edefd7e4612f070fa73143 They are optional in terms of fixing this bug (which is already fixed), but improve the error messages if this situation happens again in future. Verified with the packages: libguestfs-1.32.4-3.el7.x86_64 Verify steps: 1. Download the image: # wget http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1503.qcow2 2. There are two release file : # virt-cat -a CentOS-7-x86_64-GenericCloud-1503.qcow2 /etc/centos-release CentOS Linux release 7.1.1503 (Core) # virt-cat -a CentOS-7-x86_64-GenericCloud-1503.qcow2 /etc/redhat-release Derived from Red Hat Enterprise Linux 7.1 (Source) 3. # virt-inspector -a CentOS-7-x86_64-GenericCloud-1503.qcow2 <?xml version="1.0"?> <operatingsystems> <operatingsystem> <root>/dev/sda1</root> <name>linux</name> <arch>x86_64</arch> <distro>centos</distro> <product_name>CentOS Linux release 7.1.1503 (Core) </product_name> <major_version>7</major_version> <minor_version>1</minor_version> ... ... So Verified. 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://rhn.redhat.com/errata/RHSA-2016-2576.html |