Skip to content
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

A (rough but working) way to restart systemd to activate config changes. #35036

Conversation

ctheune
Copy link
Contributor

@ctheune ctheune commented Feb 16, 2018

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • [] Fits CONTRIBUTING.md.

SystemD is not restarted and thus changed configuration is not applied upon
changes to configuration like this:

  systemd.extraConfig = ''
    RuntimeWatchdogSec=60
  '';

This commit implements a very simple and rough way of doing so. I'm open to
improvements, like: should we pay attention to more config files like the
journal? Should we refactor this in a way that predicts the reload instead of
looking at the result of the activation?

Unfortunately my Perl fu is very limited, so I'm open to suggestions but might
not be able to implement them ...
@ctheune
Copy link
Contributor Author

ctheune commented Feb 16, 2018

SystemD is not restarted and thus changed configuration is not applied upon
changes to configuration like this:

systemd.extraConfig = ''
RuntimeWatchdogSec=60
'';

This commit implements a very simple and rough way of doing so. I'm open to
improvements, like: should we pay attention to more config files like the
journal? Should we refactor this in a way that predicts the reload instead of
looking at the result of the activation?

Unfortunately my Perl fu is very limited, so I'm open to suggestions but might
not be able to implement them ...

@ctheune
Copy link
Contributor Author

ctheune commented Feb 28, 2018

Thanks, @GrahamcOfBorg ... anything I can do to move this forward?

@Ekleog
Copy link
Member

Ekleog commented Nov 19, 2018

@ctheune Do you this is ready for review and potentially inclusion? Your before-last comment makes me wonder, and I guess that's why the WIP tag has been added :)

@ctheune
Copy link
Contributor Author

ctheune commented Dec 14, 2018

Well, it's been in place over here for a while. I guess I can even figure out a test (although I'm a bit short on time currently) if needed. We could monitor more files, etc. However, that change in itself seems fine so you could maybe even just merge that ... more improvements are always possible ...

@mmahut
Copy link
Member

mmahut commented Aug 12, 2019

Are there any updates on this pull request, please?

@ctheune
Copy link
Contributor Author

ctheune commented Aug 12, 2019

Sorry, this got lost in the flood of my open ends. I might be able to convince @dpausp to pick this up ... :)

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@wmertens
Copy link
Contributor

I like it, it's simple and straightforward. However, as long as we don't have a CAS store, it will restart systemd even if the file contents are the same.

@ctheune, does it restart a lot, and does it ever cause trouble?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 25, 2020
@ctheune
Copy link
Contributor Author

ctheune commented Jun 25, 2020

Hah, that's an old one. I just checked and we didn't use this patch in production as I wanted to get the upstream discussion done first, so I can't tell whether this causes continuous superfluous restarts. However, daemon-reexec isn't something that usually is a problem and this really only depends on how often you run activate on your system. We even usually run daemon-reexec gratuitously if systemd chokes on itself ... ;)

@wmertens
Copy link
Contributor

Ok, in that case I'm A-OK with merging this. Could you perhaps rebase or at least resolve the conflicts?

@ctheune
Copy link
Contributor Author

ctheune commented Jul 13, 2020

I can try a rebase, will take a while. Was on holiday the last weeks and just came back.

@stale
Copy link

stale bot commented Jun 7, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 7, 2021
@ctheune
Copy link
Contributor Author

ctheune commented Jun 7, 2021

@dpausp Is this something we want to follow up on? Do we still maintian this in our overlay/fork?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 7, 2021
@wmertens
Copy link
Contributor

this is still a problem...

@dasJ
Copy link
Member

dasJ commented Dec 7, 2021

I did an alternative implementation in #149342

@flokli
Copy link
Contributor

flokli commented Dec 8, 2021

Let's close this in favor of #149342.

@flokli flokli closed this Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants