-1

In my Linux distribution is enabled the service systemd-timesyncd. Very useful to understand how the service works is this post answer.

Below I report some system information about this service:

  • its unit file is: /lib/systemd/system/systemd-timesyncd.service
  • its configuration file is /etc/systemd/timesyncd.conf

I didn't change the default file timesyncd.conf and its content is showed below:

#  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.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See timesyncd.conf(5) for details.

[Time]
#NTP=
#FallbackNTP=time1.google.com time2.google.com time3.google.com time4.google.com
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048

In the file timesyncd.conf the option NTP is not set:

#NTP=

Nevertheless the service is able to set the system date and, by some logs in journalctl, I have seen that the reachable NTP server could be time1.google.com.

Where is set the NTP server (probably time1.google.com) used by systemd-timesyncd?

Thanks

frankfalse
  • 125
  • 9

1 Answers1

2

From the timesyncd.conf man page.

CONFIGURATION DIRECTORIES AND PRECEDENCE
   The default configuration is defined during compilation, so a configuration file
   is only needed when it is necessary to deviate from those defaults. By default,
   the configuration file in /etc/systemd/ contains commented out entries showing the
   defaults as a guide to the administrator. This file can be edited to create local
   overrides.
Chris Woelkers
  • 298
  • 2
  • 11
  • Also relevant: `Any per-interface NTP servers obtained from systemd-networkd.service(8) take precedence over this setting, as do any servers set via NTP= above.` So, these servers are used when no NTP server is provided via networkd. – Gerald Schneider Sep 29 '22 at 13:42
  • Thanks @Chris Woelkers I didn't read the [timesyncd manual page](https://man7.org/linux/man-pages/man5/timesyncd.conf.5.html). – frankfalse Sep 29 '22 at 14:38
  • Thanks to @Gerald Schneider for the other info about networkd. I have read the [networkd manual](https://man7.org/linux/man-pages/man5/networkd.conf.5.html) but I don't find reference to NTP. I think that I have to study something about `systemd-networkd.service`. – frankfalse Sep 29 '22 at 14:41