timedatectl [options …]{ command}
Query or change the system clock and its settings.
If no Real Time Clock and no network access set-time
is needed, otherwise these are configuration items
that probably aren't needed.
Use /lib/systemd-firstboot
† to initialize the system time zone for mounted (but not booted) system images.
[status] |
list-timezones
Pager overrides $PAGER.
If neither $SYSTEMD_PAGER
nor $PAGER
are set, a set of
$SYSTEMD_PAGER
$SYSTEMD_LESS
Override the charset passed to less
(by default "utf-8", if the invoking terminal is determined to be UTF-8 compatible). $SYSTEMD_LESSCHARSET
/lib/systed/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf [Unit] # don't run timesyncd if we have another NTP daemon installed compare NTP deamons ConditionFileIsExecutable=!/usr/sbin/ntpd (may be in busybox ConditionFileIsExecutable=!/usr/sbin/openntpd ConditionFileIsExecutable=!/usr/sbin/chronyd Seems better ConditionFileIsExecutable=!/usr/sbin/VBoxService
# @file /lib/systemd/system/systemd-timesyncd.service [Unit] Description=Network Time Synchronization Documentation=man:systemd-timesyncd.service(8) ConditionCapability=CAP_SYS_TIME ConditionVirtualization=!container DefaultDependencies=no RequiresMountsFor=/var/lib/systemd/clock After=systemd-remount-fs.service systemd-tmpfiles-setup.service systemd-sysusers.service Before=time-sync.target sysinit.target shutdown.target Conflicts=shutdown.target Wants=time-sync.target [Service] Type=notify Restart=always RestartSec=0 ExecStart=/lib/systemd/systemd-timesyncd WatchdogSec=3min CapabilityBoundingSet=CAP_SYS_TIME CAP_SETUID CAP_SETGID CAP_SETPCAP CAP_CHOWN CAP_DAC_OVERRIDE CAP_FOWNER PrivateTmp=yes PrivateDevices=yes ProtectSystem=full ProtectHome=yes ProtectControlGroups=yes ProtectKernelTunables=yes MemoryDenyWriteExecute=yes RestrictRealtime=yes RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 SystemCallFilter=~@cpu-emulation @debug @keyring @module @mount @obsolete @raw-io [Install] WantedBy=sysinit.target
$ timedatectl set-ntp true ==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp === Authentication is required to control whether network time synchronization shall be enabled. Authenticating as: user Password: ******** ==== AUTHENTICATION COMPLETE === $ systemctl status systemd-timesyncd.service systemd-timesyncd.service - Network Time Synchronization Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled) Active: active (running) since Mo 2015-03-30 14:20:38 CEST; 5s ago Docs: man:systemd-timesyncd.service(8) Main PID: 595 (systemd-timesyn) Status: "Using Time Server 216.239.38.15:123 (time4.google.com)." CGroup: /system.slice/systemd-timesyncd.service 595 /lib/systemd/systemd-timesyncd …
systemd-timesyncd , systemd-timesyncd.service
/lib/systemd/systemd-timesyncd
/lib/systemd/system/time-sync.target [Unit] Description=System Time Synchronized Documentation=man:systemd.special(7) RefuseManualStart=yesSystem service that synchronizes the local system clock with a remote Network Time Protocol (NTP) server.
/var/lib/systemd/clock
is set. timedatectl settime
is issued ..ls -l /var/lib/systemd/clock -rw-r--r-- 1 systemd-timesync systemd-timesync 0 May 10 07:17 /var/lib/systemd/clockThe NTP servers contacted are determined from
timesyncd.conf
,
the per-link static settings in .network
and the per-link dynamic settings received DHCP. See systemd.network(5)
set-ntp
enables and starts, or disables and stops
/var/lib/systemd/clock
timesyncd.conf, timesyncd.conf.d - Network
/etc/systemd/timesyncd.conf
# This file (timesyncd.conf) is part of systemd.
#
# Entries in this file show the compile time defaults.
# Defaults can be restored by simply deleting this file.
[Time]
#NTP=
#FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
/etc/systemd/timesyncd.conf.d/*.conf
/run/systemd/timesyncd.conf.d/*.conf
/usr/lib/systemd/timesyncd.conf.d/*.conf
These configuration files control NTP network time synchronization. See systemd.syntax(5)
/etc/systemd/timesyncd.conf.d/*.conf
which contains comments showing the defaults .
Packages needing to customize the configuration( why would they ?? ed),
install configuration snippets in /usr/lib/systemd/*.conf.d/
.
The main configuration file is read first and values may be overriden by subsequent entries.
Files in *.conf.d/
are sorted by their filename, regardless of subdirectories.
When multiple files specify the same option, those which accept a
To disable a configuration file supplied by the vendor, place a symlink to /dev/null in the
configuration directory in /etc/, with the same filename as the vendor configuration file.
/etc/
overrides configuration files installed by packages.
[Time]
section:
NTP=srv [srv2 … ] |
/lib/systemd/system/systemd-networkd.service
[Unit] Description=Network Service Documentation=man:systemd-networkd.service(8) ConditionCapability=CAP_NET_ADMIN DefaultDependencies=no # systemd-udevd.service can be dropped once tuntap is moved to netlink After=systemd-networkd.socket systemd-udevd.service network-pre.target systemd-sysusers.service systemd-sysctl.service Before=network.target multi-user.target shutdown.target Conflicts=shutdown.target Wants=systemd-networkd.socket network.target [Service] AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW BusName=org.freedesktop.network1 CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW DeviceAllow=char-* rw ExecStart=!!/lib/systemd/systemd-networkd LockPersonality=yes MemoryDenyWriteExecute=yes NoNewPrivileges=yes ProtectProc=invisible ProtectClock=yes ProtectControlGroups=yes ProtectHome=yes ProtectKernelLogs=yes ProtectKernelModules=yes ProtectSystem=strict Restart=on-failure RestartKillSignal=SIGUSR2 RestartSec=0 RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6 AF_PACKET AF_ALG RestrictNamespaces=yes RestrictRealtime=yes RestrictSUIDSGID=yes RuntimeDirectory=systemd/netif RuntimeDirectoryPreserve=yes SystemCallArchitectures=native SystemCallErrorNumber=EPERM SystemCallFilter=@system-service Type=notify User=systemd-network WatchdogSec=3min [Install] WantedBy=multi-user.target Also=systemd-networkd.socket Alias=dbus-org.freedesktop.network1.service # We want to enable systemd-networkd-wait-online.service whenever this service # is enabled. systemd-networkd-wait-online.service has # WantedBy=network-online.target, so enabling it only has an effect if # network-online.target itself is enabled or pulled in by some other unit. Also=systemd-networkd-wait-online.service†
/usr/share/dbus-1/system.d/org.freedesktop.timedate1.conf
<busconfig> <policy user="root"> <allow own="org.freedesktop.timedate1"> <allow send_destination="org.freedesktop.timedate1"> <allow receive_sender ="org.freedesktop.timedate1"> </policy> <policy context="default"> <allow send_destination="org.freedesktop.timedate1"> <allow receive_sender ="org.freedesktop.timedate1"> </policy> </busconfig></pre>