[systemd-devel] How to ensure a systemd unit waits for ntpd to sync before starting?

Lennart Poettering lennart at poettering.net
Tue Apr 2 13:43:20 UTC 2019

On Di, 02.04.19 18:56, Debraj Manna (subharaj.manna at gmail.com) wrote:

> Thanks again for all the replies.
> I am on Ubuntu 16.04 which is using systemd version 239. It appears to me
> that systemd-time-wait-sync.service is not present on this version of
> systemd.
> I have one more question related to this. If I switch to using systemd's
> timesyncd.service then in my service unit file I can use
> After=time-sync.target
> Wants=time-sync.target
> Can someone let me know for how long will the unit wait for ntp sync to
> happen before giving up ? Is there a way I can control this?

You can set StartTimeoutSec= via a drop-in file for the
systemd-time-wait-sync.service unit file.

But ideally, we'd have a nicer way directly inside of the
systemd-time-wait-sync tool.


Lennart Poettering, Berlin

More information about the systemd-devel mailing list