-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/etc/os-release is an absolute symlink but should be a relative one for e.g. systemd-nspawn #28833
Comments
There's another use case for this. os-prober can use different methods to detect Linux OSes in other partitions, and if it had access to os-release it would be easier to fill in the parameters it needs (short name and long name, which usually includes the version). In particular, the Debian default installation of os-prober looks for os-release only after looking at other files in /lib , so a custom entry would still be needed for NixOS, but that custom entry would be easier to write and more robust if we could access os-release, in a standard location, from os-prober (it's possible to look for os-release in /nix/store, of course, but not as nice). |
It seems the goal of this issue could be achieved by setting the
|
@palmeida both sounds sensible, I'd either go with something like @palmeida can you / do you want to implement one of your solutions? Otherwise I'd provide a PR, and for me, I'd go with option 2. While Option 1 seems to be cleaner, I don't think there are many other cases where you really need relative links (accesses from outside of the OS is the only thing I could think of — tried to judge how many of the existing |
@florianjacob I completely agree with your analysis. If generality is not useful here (I don't know enough to judge), option 1 is a lot of extra work for nothing. In my Debian system, If you are willing to make the PR, please do. I am completely new to NixOS, I have never even edited anything in my system, other than |
@florianjacob I'm not on NixOS right now, but I can confirm
I'll test the commit when I have time (not sure exactly when that will be...). |
@palmeida That's already sufficient I'd say, as I do nothing else in the PR and I tested it's now a regular file with |
@florianjacob I agree, it's such a simple change, if you tested it and I tested the "end result", it should be fine. |
so that the links can be followed if the NixOS installation is not mounted as filesystem root. In particular, this makes /etc/os-release adhere to the standard: https://www.freedesktop.org/software/systemd/man/os-release.html Fixes NixOS#28833.
so that the links can be followed if the NixOS installation is not mounted as filesystem root. In particular, this makes /etc/os-release adhere to the standard: https://www.freedesktop.org/software/systemd/man/os-release.html Fixes NixOS#28833.
Note that PR was reverted #54980 |
Thank you for your contributions.
|
Issue description
The file
/etc/os-release
is an absolute symlink/etc/os-release -> /etc/static/os-release
, and that is an absolute symlink/etc/static/os-release -> /nix/store/98dh917436hpwwz141l9fv2qclfscffw-etc-os-release
. This results in problems when trying to execute a systemd installation / root image via systemd-nspawn, as systemd-nspawn requiresetc/os-release
to be working from outside of the image.Excerpt from the os-release manpage:
This would be very handy for people like me who wanted to test NixOS and develop their configuration.nix while still using another distribution prior to making the switch.
Related issue: #9884
Steps to reproduce
Boot a (e.g. live) system that is not NixOS and try to execute NixOS via systemd-nspawn. It will fail because it cannot find
/etc/static/os-release
on the host system. On NixOS hosts, this issue is shadowed as then the host system'sos-release
file is used.Technical details
The text was updated successfully, but these errors were encountered: