Skip to content

systemd: Add "After" dependency on time-sync.target #12248

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

Merged
merged 1 commit into from
Dec 7, 2022

Conversation

kpfleming
Copy link
Contributor

Short description

Adds 'After=time-sync.target' to the service unit files; this will not have any immediate effect, unless the system administrator has also enabled a unit which has a 'Before' dependency on that target; there are none of those units enabled in a default configuration in common distributions. systemd itself adds such an 'After' dependency to all timer units with OnCalendar settings, and to some other units.

However, in a system which makes use of systemd-timesyncd, the admin can enable systemd-time-wait-sync.service, which has such a dependency. The result would be that none of the PowerDNS services on the system would be started until after systemd-timesyncd is certain that the system's clock is synchronized with the configured external source.

A similar configuration can be achieved on systems which use ntpd, chronyd, or other time synchronization tools.

Closes #11153.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)
  • checked that this code was merged to master

Adds 'After=time-sync.target' to the service unit files; this will not
have any immediate effect, unless the system administrator has also
enabled a unit which has a 'Before' dependency on that target;
there are none of those units enabled in a default configuration in
common distributions. systemd itself adds such an 'After' dependency
to all timer units with OnCalendar settings, and to some other units.

However, in a system which makes use of systemd-timesyncd, the admin
can enable systemd-time-wait-sync.service, which has such a
dependency. The result would be that none of the PowerDNS services on
the system would be started until after systemd-timesyncd is certain
that the system's clock is synchronized with the configured external
source.

A similar configuration can be achieved on systems which use ntpd,
chronyd, or other time synchronization tools.

Closes PowerDNS#11153.
@rgacogne rgacogne added this to the common-soon milestone Nov 29, 2022
@kpfleming kpfleming marked this pull request as ready for review November 29, 2022 12:03
Copy link
Member

@omoerbeek omoerbeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine and safe to me.

@omoerbeek omoerbeek requested a review from rgacogne December 7, 2022 07:46
@rgacogne
Copy link
Member

rgacogne commented Dec 7, 2022

CI failures are unrelated to this PR.

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.

Consider adding 'After=time-sync.target' to systemd service unit files
3 participants