Bug 1492208

Summary: Failed to switch root: Specified switch root path /sysroot does not seem to be an OS tree. os-release file is missing
Product: Red Hat Enterprise Linux 7 Reporter: Steve Dickson <steved>
Component: redhat-releaseAssignee: Lubos Kocman <lkocman>
Status: CLOSED DUPLICATE QA Contact: Release Test Team <release-test-team>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: alex.williamson, avagarwa, coughlan, drusek, dtodorov, jbastian, jstancek, kdudka, lkocman, mcsontos, rpeterso, sdodson, systemd-maint-list
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: redhat-release-7.5-0.5.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-06 09:18:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 1469559    

Description Steve Dickson 2017-09-15 19:14:49 UTC
Description of problem:
Updated to today RHEL7 nightly and I get the following errors
when booting

systemd[1]: Starting Switch Root...
systemctl[445]: Failed to switch root: Specified switch root path /sysroot does not seem to be an OS tree. os-release file is missing.
systemd[1]: initrd-switch-root.service: main process exited, code=exited, status=1/FAILURE
systemd[1]: Failed to start Switch Root.
systemd[1]: Startup finished in 595ms (kernel) + 0 (initrd) + 1.354s (userspace) = 1.950s.
systemd[1]: Unit initrd-switch-root.service entered failed state.
systemd[1]: Triggering OnFailure= dependencies of initrd-switch-root.service.
systemd[1]: initrd-switch-root.service failed.
systemd[1]: Started Emergency Shell.

The repo I used was

http://download.lab.bos.redhat.com/rel-eng/latest-RHEL-7/compose/Server/x86_64/os which contains version

 systemd-219-42.el7.x86_64.rpm    


How reproducible:
%100...

Comment 2 Jeff Bastian 2017-09-15 20:12:44 UTC
I just did a fresh install of RHEL-7.5-20170914.n.0 Server x86_64 which includes systemd-219-44.el7.x86_64 and it worked fine.  I rebooted the system a few times and it came fine each time.

https://beaker.engineering.redhat.com/recipes/4268331

Comment 3 Jeff Bastian 2017-09-15 20:14:03 UTC
For the record:
/mnt/redhat/rel-eng/latest-RHEL-7 -> RHEL-7.4-20170711.0

Comment 4 Jeff Bastian 2017-09-15 20:25:04 UTC
I was able to reproduce this by removing the os-release symlinks and files. 

[root@localhost ~]# ls -l /etc/os-release 
lrwxrwxrwx. 1 root root 21 Sep 15 15:54 /etc/os-release -> ../usr/lib/os-release

[root@localhost ~]# ls -l /usr/lib/os-release 
lrwxrwxrwx. 1 root root 28 Sep 15 15:54 /usr/lib/os-release -> os.release.d/os-release-rhel

[root@localhost ~]# rm -f /etc/os-release \
                          /usr/lib/os-release \
                          /usr/lib/os.release.d/os-release-rhel

[root@localhost ~]# reboot
...
...
[    4.910424] localhost.localdomain systemd[1]: Starting Switch Root...
[    4.916397] localhost.localdomain systemctl[463]: Failed to switch root: Specified switch root path /sysroot does not seem to be an OS tree. os-release file is missing.
[    4.917405] localhost.localdomain systemd[1]: initrd-switch-root.service: main process exited, code=exited, status=1/FAILURE


Do you know how your os-release file disappeared?

Comment 5 Jeff Bastian 2017-09-15 20:35:06 UTC
The symlinks seem to be new thing for RHEL 7.5
  /etc/os-release -> /usr/lib/os-release -> os.release.d/os-release-rhel

RHEL 7.4 /etc/os-release is just a plain file

Comment 6 Scott Dodson 2017-09-16 02:30:24 UTC
dupe of https://bugzilla.redhat.com/show_bug.cgi?id=1491957 ?

Comment 7 Steve Dickson 2017-09-16 12:27:31 UTC
(In reply to Jeff Bastian from comment #5)
> The symlinks seem to be new thing for RHEL 7.5
>   /etc/os-release -> /usr/lib/os-release -> os.release.d/os-release-rhel
> 
> RHEL 7.4 /etc/os-release is just a plain file

Yes... /etc/os-release is a symlink but to .. 

:/# ls -ld /etc/os-release
lrwxrwxrwx 1 root 0 2 Sep 15 13:27 /etc/os-release -> ..

and there is no /usr/lib/os-release

:/# ls /usr/lib/os-release
ls: cannot access /usr/lib/os-release: No such file or directory

So this must be the problem... change component to
 redhat-release-server

Comment 8 Avesh Agarwal 2017-09-20 16:04:12 UTC
I also ran into this issue when I upgraded one of VMs to 7.5 from 7.4 and the VM stopped booting with the same error.

As a work around, I mounted sysroot in write mode and created a symlink os-relead.d to os.release.d and the VM booted again.

Comment 9 Robert Peterson 2017-09-20 17:06:35 UTC
I found comment #8 to be a bit cryptic, but it gave me enough
clues to get my machines working again. The exact commands I
pasted into the failed console are:

mount -o remount,rw /sysroot
cd /sysroot/usr/lib
ln -s os.release.d os-release.d   
exit

Comment 11 Lubos Kocman 2017-09-29 08:56:33 UTC
*** Bug 1491957 has been marked as a duplicate of this bug. ***

Comment 13 Lubos Kocman 2017-09-29 13:03:53 UTC
I believe it's related to migration of redhat-release-{variant} into redhat-release. There was a typo in /etc/os.release.d I hope if fixes your issue as well.

Lubos