The ntpd.log file contains almost nothing but the following message: 2022-09-20T00:00:00 ntpd[1000]: LOG: check_logfile: couldn't open /var/log/ntpd.log Permission denied The process (running as the ntp user) can't write to the root:root ntpd.log. In the source tarball, the following file apparent assumes an ntpd daemon run as root. etc/logrotate-config.ntp This patch should fix the problem: --- ntpsec-1.2.1/etc/logrotate-config.ntpd 2022-06-17 13:28:23.647457020 +0000 +++ ntpsec-1.2.1/etc/logrotate-config.ntpd 2022-09-30 00:00:00.000000000 +0000 @@ -5,6 +5,7 @@ /var/log/ntpd.log { monthly + create 0640 ntp root missingok postrotate /usr/bin/killall -HUP ntpd
I just installed net-misc/ntpsec-1.2.2: it does not install a file /etc/logrotate-config.ntpd for me. Adding "logfile /var/log/ntpd.log" to file /etc/ntp.conf seems to make logging to /var/log/ntpd.log work flawlessly, after a restart of the ntpd service. So it appears working to me with 1.2.2.
After a bit of runtime, I do see this line appear in /var/log/ntpd.log: 2023-04-14T23:27:03 ntpd[11555]: LOG: check_logfile: couldn't open /var/log/ntpd.log Permission denied Given that ntpd has dropped privileges, this message seems ironic but accurate. A quick look at function "check_logfile" in 1.2.2 sources reveals that it tries to re-open the log file in case of log-rotation. So if the daemon is running as ntp:ntp and logrotation is used, /var/log/ntpd.log cannot be owned by root:root, I see.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32df79e74beff72d36dae363e53f2d16808c356a commit 32df79e74beff72d36dae363e53f2d16808c356a Author: Sebastian Pipping <sping@gentoo.org> AuthorDate: 2023-04-16 22:35:38 +0000 Commit: Sebastian Pipping <sping@gentoo.org> CommitDate: 2023-04-16 22:35:38 +0000 net-misc/ntpsec: Fix logrotate config Closes: https://bugs.gentoo.org/873514 Signed-off-by: Sebastian Pipping <sping@gentoo.org> net-misc/ntpsec/files/ntpsec-1.2.2-logrotate.patch | 26 ++++ net-misc/ntpsec/ntpsec-1.2.2-r1.ebuild | 164 +++++++++++++++++++++ net-misc/ntpsec/ntpsec-9999.ebuild | 1 + 3 files changed, 191 insertions(+)