You are not logged in.

#1 2019-12-28 23:32:50

Registered: 2008-11-10
Posts: 35

Missing /etc/os-release symlink to/usr/lib/os-release file


I've got 3 machines with Arch Linux. All of them have a symlink /etc/os-release -> ../usr/lib/os-release which is right, but, unexpectedly, it is no longer owned by the filesystem package or any other one.

Steps to reproduce:

[musikolo@MyPC ~]$ ls -l /etc/os-release
lrwxrwxrwx 1 root root 21 sep 5 2017 /etc/os-release -> ../usr/lib/os-release
[musikolo@MyPC ~]$ ls -l /usr/lib/os-release
-rw-r--r-- 1 root root 273 nov 13 10:23 /usr/lib/os-release

[musikolo@MyPC ~]$ pacman -Qo /etc/os-release
error: No package owns /etc/os-release
[musikolo@MyPC ~]$ pacman -Qo /usr/lib/os-release
/usr/lib/os-release is owned by filesystem 2019.10-2

The os-release manual recommends having such a symlink for backwards compatibility and it states the following:

The /etc/os-release and /usr/lib/os-release files contain operating system identification data.

The file /etc/os-release takes precedence over /usr/lib/os-release. Applications should check for the former, and exclusively use its data if it exists, and only fall back to /usr/lib/os-release if it is missing. Applications should not read data from both files at the same time. /usr/lib/os-release is the recommended place to store OS release information as part of vendor trees. /etc/os-release should be a relative symlink to /usr/lib/os-release, to provide compatibility with applications only looking at /etc.

So my questions are:
- Has this changed recently?
- Would the same `/etc/os-release` symlink be created in a brand-system?

Asking to solve an open discussion at GitHub.



#2 2019-12-28 23:38:11

Inspector Parrot
Registered: 2011-11-29
Posts: 24,248

Re: Missing /etc/os-release symlink to/usr/lib/os-release file

So your title is incorrect, this link is not missing on any of your systems?

The link does not belong to any package, it is created by systemd:

$ pacman -Qo /usr/lib/tmpfiles.d/etc.conf
/usr/lib/tmpfiles.d/etc.conf is owned by systemd 244.1-1

$ cat /usr/lib/tmpfiles.d/etc.conf
#  This file is part of systemd.
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

# See tmpfiles.d(5) for details

L /etc/os-release - - - - ../usr/lib/os-release
L+ /etc/mtab - - - - ../proc/self/mounts
L! /etc/resolv.conf - - - - ../run/systemd/resolve/stub-resolv.conf
C! /etc/nsswitch.conf - - - -
C! /etc/pam.d - - - -
C! /etc/issue - - - -

Last edited by Trilby (2019-12-28 23:38:31)

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman


#3 2019-12-29 07:04:33

Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,622

Re: Missing /etc/os-release symlink to/usr/lib/os-release file

The last time the filesystem package owned /etc/os-release was in mid-2014.

The commit message for filesystem 2014.07-1 includes "move /etc/os-release to /usr/lib/os-release", and the reason for doing so is very simple: upstream intends that distributors distribute /usr/lib/os-release, not /etc/os-release, and that /etc/os-release shall be automatically created by systemd as a symlink, if it does not exist yet... but that file can be locally modified, in which case being owned by the package is *wrong*, because modifications should be persisted.

Managing AUR repos The Right Way -- aurpublish (now a standalone tool)


#4 2019-12-31 02:49:01

Registered: 2008-11-10
Posts: 35

Re: Missing /etc/os-release symlink to/usr/lib/os-release file

Thanks guys for the clarification!


#5 2019-12-31 14:12:53

Forum Moderator
Registered: 2012-01-15
Posts: 3,337

Re: Missing /etc/os-release symlink to/usr/lib/os-release file

Please remember to mark your thread [SOLVED] (edit the title of your first post).


Board footer

Powered by FluxBB