-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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/ntpd: fix permissions error when creating drift file #367064
nixos/ntpd: fix permissions error when creating drift file #367064
Conversation
This fixes "frequency file /var/lib/ntp/ntp.drift.TEMP: Permission denied". Creating a directory via StateDirectory makes that directory /var/lib/ntp owned by root:root. However, when running ntpd we change to user ntp (see ntpFlags), so the process cannot actually use that directory. Actually creating a home directory for the user at that location solves that problem.
The error only occurs after a while, so keeping this as draft until I can confirm that the error is indeed fixed. |
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.
Seems good to me. Tested with nix-build nixos/tests/ntpd.nix
and that produced a successful outcome:
(finished: must succeed: su -s /bin/sh -c "touch /var/lib/ntp/ntp.drift" ntp, in 0.19 seconds)
(finished: run the VM test script, in 26.40 seconds)
test script finished in 26.48s
I had thought of a different way of solving this problem, but this works too! |
Successfully created backport PR for |
This fixes "frequency file /var/lib/ntp/ntp.drift.TEMP: Permission denied".
Creating a directory via
StateDirectory
makes that directory/var/lib/ntp owned
byroot:root
. However, when runningntpd
we change to userntp
(seentpFlags
), so the process cannot actually use that directory.Actually creating a home directory for the user at that location solves that problem.
Fixes #366475 .
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/
)Add a 👍 reaction to pull requests you find important.