-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
nixos/switch-to-configuration: add sysinit-reactivation.target #271067
Conversation
@ofborg test switchTest acme |
In any case: This is missing test cases |
This test: 28a3dc9#diff-01800945c1d1316489cb95dcf6d13d9e33660ffc8a4f7b952ec20873cd46ef8a excerices this new functionality. It wouldn't work when we use the direct tmpfiles invocation because it needs sysusers to run BEFORE tmpfiles. Also the acme tests excercises this. It was the test that showed that the previous change was a channel blocker. |
I'll add a specific test case. |
@dasJ Although this doesn't directly contribute to removing perl from activation, I think it's an important step. Having a logic for reconfiguring the system via systemd seems important to me. |
nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.md
Outdated
Show resolved
Hide resolved
When switching to a generation with this PR, from one that didn't have it, there's this error during activation:
and the service is not actually restarted. This is probably due to the original service setting It's probably not a huge issue in the end, but maybe we should at least mention this in the release notes? |
Does this PR support the case when systemd-tmpfiles creates files in a filesystem location, which must be mounted first?
I'm not sure about |
031e6e1
to
f7c8978
Compare
@r-vdp I added a release note. Hope that describes the issue clearly enough.
@AleXoundOS If I understand this correctly, this is indeed a limitation of the previous system because the upstream systemd-tmpfiles unit is configured to run after local-fs.target but this is not respected right now. With the changes I propose, you can indeed order this correctly but you'd need to add the dependency to local-fs.target as described in the docs. I'd be happy to review a PR if you're interested in doing this. |
@ofborg test sysinit-reactivation acme switchTest |
f7c8978
to
7518b07
Compare
@dasJ can I get you to review this one again? I added a test as you requested. |
I'm afraid, that simply making systemd-tmpfiles dependent on FS mounts will potentially introduce locking of OS booting, e.g. if some non-crucial external FS is unavailable. It seems running systemd-tmpfiles is mandatory for OS internals, even systemd itself to work properly. |
systemd-tmpfiles already depends on local-fs.target However, to make local-fs.target correctly REactivate, you need to add an additional dependency on |
@nikstur I think there's an issue still because For instance, dbus-broker fails when reloaded during a switch when I run with this patch, because its temporary files get wiped, presumably because we have lines like
in our tmpfiles config, which are supposed to be executed only during boot, but with this patch they are also executed during a switch. I think we need a distinction between the tmpfiles invocation during bootup, which has |
7518b07
to
5d15193
Compare
I now added a separate service
|
I am running with the updated patch now on my system to test. I can try to reproduce this in a VM test, I think it should be sufficient to restart the tmpfiles service (the one with |
@nikstur: this commit introduces a test that fails with the previous implementation and succeeds now, showing the problem with dbus-broker. I'm sure that there must be other services that would break if their temporary files get wiped during a switch, dbus-broker is just the only one that I encountered the issue with on my own system. |
Nice! Thank you. So this PR is good to go from your side @r-vdp? |
Yeah I think so, the change to not include Maybe good to cherry-pick the nixos test onto this branch to avoid regressions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little annoyance here is that reactivation units are being start twice on stc. Once from systemctl restart sysinit-reactivation.target
and once from starting units ....
. I don't know how much this matter realistically, just a little imperfection IMO. I don't mind ignoring it.
5d15193
to
82a5079
Compare
82a5079
to
8f3abd2
Compare
brrrrrrr |
For those of us that are still on nixos stable (23.11) and therefore do not have |
Description of changes
Second try of #269983
This solution is my interpretation of what @ElvishJerricco described in this comment: #269983 (comment)
Although this doesnt remove any custom code from stc, now at least we can restart multiple services that are pulled in by sysinit.target while respecting the ordering between them (e.g. sysusers runs before tmpfiles).
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Priorities
Add a 👍 reaction to pull requests you find important.