Opened 8 years ago

Closed 8 years ago

#958 closed enhancement (fixed)

systemd-timesyncd daemon

Reported by: William Harrington Owned by: chris@…
Priority: major Milestone: CLFS Standard 3.0
Component: BOOK Version: CLFS Sysroot GIT
Keywords: Cc: berzerkula@…, jonathan@…

Description

A new "systemd-timesyncd" daemon has been added for synchronizing the system clock across the network. It implements an SNTP client. In contrast to NTP implementations such as chrony or the NTP reference server this only implements a client side, and does not bother with the full NTP complexity, focusing only on querying time from one remote server and synchronizing the local clock to it. Unless you intend to serve NTP to networked clients or want to connect to local hardware clocks this simple NTP client should be more than appropriate for most installations. The daemon runs with minimal privileges, and has been hooked up with networkd to only operate when network connectivity is available. The daemon saves the current clock to disk every time a new NTP sync has been acquired, and uses this to possibly correct the system clock early at bootup, in order to accommodate for systems that lack an RTC such as the Raspberry Pi and embedded devices, and make sure that time monotonically progresses on these systems, even if it is not always correct.

To make use of this daemon a new system user and group "systemd-timesync" needs to be created on installation of systemd.

Okay, I propose adding the user and group for this option

For /etc/passwd: systemd-timesync:x:29:29:Systemd Timesyncd User:/dev/null:/bin/false For /etc/group: systemd-timesync:x:29:

All that needs to be done to use this, and add this to the systemd-network section or somewhere in the Network chapter other than systemd-networkd setup:

systemctl enable systemd-networkd

It will then run on startup.

I do not know if there is a way to tell it which time server to connect to, but there may be. We need to look closer at the man-pages or other documentation, maybe even the source.

Change History (9)

comment:1 Changed 8 years ago by William Harrington

Correction:

systemctl enable systemd-networkd

needs to be

systemctl enable systemd-timesyncd

comment:2 Changed 8 years ago by William Harrington

we can edit /etc/systemd/timesyncd.conf

# This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # See timesyncd.conf(5) for details

[Time] #Servers=@NTP_SERVERS@

Now, NTP_SERVERS comes from configure where the user can edit the list of default time servers:

--with-ntp-servers=NTPSERVERS

Defaults are:

NTP_SERVERS="time1.google.com time2.google.com time3.google.com time4.google.com"

comment:3 Changed 8 years ago by William Harrington

We may want to add the setup of this user and group and the configuration for it in the network chapter along with systemd network configuration. It would be good to see about adding this before release.

comment:5 Changed 8 years ago by William Harrington

That looks good. All we need to do is decide the uid/gid numbers for it.

For future Systemd builds we'll have these future additions for uid/gid:

systemd-bus-proxy
systemd-journal-gateway
systemd-network
systemd-resolve

So it may not be good to start right after 28. Maybe find a block we have free numbers and set some consecutive numbers in a group like in BLFS.

Last edited 8 years ago by William Harrington (previous) (diff)

comment:6 Changed 8 years ago by William Harrington

Chris, would you like to push your changes to the book for this ticket?

comment:7 Changed 8 years ago by chris@…

Committed in http://trac.cross-lfs.org/changeset/63f19424c04637b783c6f6e0f1f7787df953dc4a. I noticed we have a block of unused uid's and gid's from 40-49, so I put the systemd-timesync user and group at 41, to allow for the possibility of moving systemd-journal to 40, and then the rest of the systemd users/groups needed for the next version can be added to that consecutive block. Does this sound good?

comment:8 Changed 8 years ago by chris@…

Owner: changed from clfs-commits@… to chris@…
Status: newassigned

OK, closing this ticket. We can always open a new one to discuss user/group numbers.

comment:9 Changed 8 years ago by chris@…

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.