Bug 1399770

Summary: rpm-ostree install fails due to missing os-release
Product: Red Hat Enterprise Linux 7 Reporter: Michael Nguyen <mnguyen>
Component: rpm-ostree-clientAssignee: Colin Walters <walters>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: lfriedma, miabbott
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-06 21:02:15 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:

Description Michael Nguyen 2016-11-29 17:12:44 UTC
Description of problem:
Receiving the following error while running rpm-ostree install:
  error: Could not find os-release in etc/ nor in usr/lib under source root 

Version-Release number of selected component (if applicable):
7.3.1


How reproducible:
Always

Steps to Reproduce:
[cloud-user@rhelah ~]$ sudo rpm-ostree install wget
Checking out tree 93050f5... done
error: Could not find os-release in etc/ nor in usr/lib under source root '/proc/self/fd/24/tmp/rpmostree-commit-J9V2RY'
[cloud-user@rhelah ~]$ cat /etc/os-release 
NAME="Red Hat Enterprise Linux Atomic Host"
VERSION="7.3"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Atomic Host"
VARIANT_ID=atomic.host
VERSION_ID="7.3"
PRETTY_NAME="Red Hat Enterprise Linux Atomic Host 7.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.3:GA:atomic-host"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION=7.3



Actual results:
error: Could not find os-release in etc/ nor in usr/lib under source root 

Expected results:
package is installed

Additional info:
rhel-atomic-host-ostree:rhel-atomic-host/7/x86_64/standard
       Version: 7.3.1 (2016-11-28 16:36:31)
        Commit: 93050f5ea207511a834f8d1bd19740fb7175940876b6d8858f5713fadc9f50eb
        OSName: rhel-atomic-host

rpm-ostree-client-2016.11-2.atomic.el7.x86_64

Comment 2 Colin Walters 2016-11-29 18:26:09 UTC
Testing this now if anyone else wants to eyeball it:

diff --git a/redhat-release-atomic-host.spec b/redhat-release-atomic-host.spec
index 21cd874..effbd7e 100644
--- a/redhat-release-atomic-host.spec
+++ b/redhat-release-atomic-host.spec
@@ -5,7 +5,7 @@
 %define variant_titlecase Atomic Host
 %define variant_titlecase_concat AtomicHost
 %define variant_lowercase atomic-host
-%define release_pkg_version 20160824.0
+%define release_pkg_version 20161129.0
 %define base_release_version 7
 %define full_release_version 7.3
 %define dist_release_version 7
@@ -14,7 +14,7 @@
 
 Name:           redhat-release-atomic-host
 Version:        %{full_release_version}
-Release:        %{release_pkg_version}.atomic%{?dist}.3
+Release:        %{release_pkg_version}.atomic%{?dist}.4
 Summary:        %{product_family}%{?variant_titlecase: %{variant_titlecase}} release file
 Group:          System Environment/Base
 License:        GPLv2
@@ -42,17 +42,19 @@ rm -rf %{buildroot}
 
 # create /etc
 mkdir -p %{buildroot}/etc
+mkdir -p %{buildroot}/usr/lib/
 
 mkdir -p %{buildroot}/etc/pki/product
 cp %{SOURCE3} %{buildroot}/etc/pki/product/271.pem
 cp %{SOURCE4} %{buildroot}/etc/pki/product/69.pem
 
 # create /etc/system-release and /etc/redhat-release
-echo "%{product_family}%{?variant_titlecase: %{variant_titlecase}} release %{full_release_version}%{?beta: %{beta}}" > %{buildroot}/etc/redhat-release
-ln -s redhat-release %{buildroot}/etc/system-release
+echo "%{product_family}%{?variant_titlecase: %{variant_titlecase}} release %{full_release_version}%{?beta: %{beta}}" > %{buildroot}/usr/lib/redhat-release
+ln -s ../usr/lib/redhat-release %{buildroot}/etc/system-release
+ln -s ../usr/lib/redhat-release %{buildroot}/etc/redhat-release
 
 # create /etc/os-release
-cat << EOF >>%{buildroot}/etc/os-release
+cat << EOF >>%{buildroot}/usr/lib/os-release
 NAME="%{product_family}%{?variant_titlecase: %{variant_titlecase}}"
 VERSION="%{full_release_version}"
 ID="rhel"
@@ -71,8 +73,10 @@ REDHAT_BUGZILLA_PRODUCT_VERSION=%{full_release_version}
 REDHAT_SUPPORT_PRODUCT="%{product_family}"
 REDHAT_SUPPORT_PRODUCT_VERSION=%{full_release_version}
 EOF
+ln -s ../usr/lib/os-release %{buildroot}/etc/os-release
 # write cpe to /etc/system/release-cpe
-echo "cpe:/o:redhat:enterprise_linux:%{full_release_version}:%{?beta:beta}%{!?beta:GA}%{?variant_lowercase::%{variant_lowercase}}" | tr [A-Z] [a-z] > %{buildroot}/etc/system-release-cpe
+echo "cpe:/o:redhat:enterprise_linux:%{full_release_version}:%{?beta:beta}%{!?beta:GA}%{?variant_lowercase::%{variant_lowercase}}" | tr [A-Z] [a-z] > %{buildroot}/usr/lib/system-release-cpe
+ln -s ../usr/lib/system-release-cpe %{buildroot}/etc/system-release-cpe
 
 # create /etc/issue and /etc/issue.net
 echo '\S' > %{buildroot}/etc/issue
@@ -137,6 +141,9 @@ rm -rf %{buildroot}
 %defattr(0644,root,root,0755)
 /etc/redhat-release
 /etc/system-release
+%{_prefix}/lib/os-release
+%{_prefix}/lib/redhat-release
+%{_prefix}/lib/system-release-cpe
 %config(noreplace) /etc/os-release
 %config /etc/system-release-cpe
 %config(noreplace) /etc/issue
@@ -156,6 +163,11 @@ rm -rf %{buildroot}
 %dir /etc/cockpit/ws-certs.d
 
 %changelog
+* Tue Nov 29 2016 walters - 7.3-20161129.0.atomic.el7.4
+- Switch to /usr/lib/os-release to work around
+  https://github.com/rpm-software-management/libhif/pull/215
+  Resolves: #1399770
+
 * Wed Aug 24 2016 Colin Walters <walters>
 - Update version, add VARIANT/VARIANT_ID; see
   https://github.com/CentOS/sig-atomic-buildscripts/issues/61

Comment 3 Micah Abbott 2016-11-29 18:42:33 UTC
(In reply to Colin Walters from comment #2)
> Testing this now if anyone else wants to eyeball it:

My eyeballs say LGTM

Comment 5 Micah Abbott 2016-11-29 20:29:35 UTC
I tried to 'ostree admin unlock && rpm -Uhv' the new 'redhat-release-atomic-host' package to verify the fix, but that didn't seem to work.

However, after making a custom compose with the new package and rebasing to it I was able to successfully 'rpm-ostree install' a package again.

Comment 8 errata-xmlrpc 2016-12-06 21:02:15 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/RHBA-2016:2864