Friday, December 1, 2017

OpenSuSE, Fedora et al. : resolving the "os-release file is missing" problem

Yesterday, booting my OpenSuSE-tumbleweed after a relatively small zypper dup the day before, I found myself in front of this :


Of course, a funny thing is that my laptop was docked, and the USB keyboard not recognized. Switching to the laptop keyboard, I found out more (with the systemctl status initrd-switch-root.service command) :

Failed to switch root: Specified switch root path /sysroot does not seem to be an OS tree. os-release file is missing.
initrd-switch-root.service: main process exited, code=exited, status=1/FAILURE
Failed to start Switch Root.
Startup finished in 6.650s (kernel) + 0 (initrd) + 3min 22.924s (userspace) = 3min 29.574s.
Unit initrd-switch-root.service entered failed state.
Triggering OnFailure= dependencies of initrd-switch-root.service.
initrd-switch-root.service failed.
Started Emergency Shell.

Well... that didn't bode well. But my system was mounted, read-only, in /sysroot/, so, what now?
After searching for a bit and finding nothing of interest on the web, I finally managed to fix that by remounting the / filesystem read-write, and copying the file found on the initrd system. So : find your / partition (cat /sysroot/etc/partitions, or blkid /dev/sdXY)
Then :

umount /sysroot && mount /dev/sdXY /sysroot -o rw
cp /usr/lib/os-release /sysroot/etc/ && cp /usr/lib/os-release /sysroot/usr/lib/

... And rebooting. Fixed everything! #TheMoreYouKnow

No comments:

Post a Comment