I use systemd-timesyncd
to keep the system time up to date on my raspi / debian system.
To do so i did the following steps:
1. Check the state of timedatectl
Therefore type the comand timedatectl
to the shell.
The output should look something like this:
Local time: Fr 2023-01-06 19:34:27 CET
Universal time: Fr 2023-01-06 18:34:27 UTC
RTC time: n/a
Time zone: Europe/Berlin (CET, +0100)
System clock synchronized: no
NTP service: n/a
RTC in local TZ: no
The important part is “System clock synchronized: no
” and “NTP service: n/a
“. This tells us that there currently is no timesyncing via systemds timedatectl
.
2. Install systemd-timesyncd
To install the missing software via apt by typing
sudo apt install systemd-timesyncd
After installing the software the output of timedatectl
shows that syncing and ntp is working now:
Local time: Fr 2023-01-06 19:38:40 CET
Universal time: Fr 2023-01-06 18:38:40 UTC
RTC time: n/a
Time zone: Europe/Berlin (CET, +0100)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
(Optional 3. Configure time servers)
For me the next step was to configure the timeservers that should be used. This might not be needed but my system doesn’t have internet access so the default ntp servers are not accessible. (To show which settings are active currently the comand “timedatectl show-timesync --all
” can be used)
The timeservers are configured in /etc/systemd/timesyncd.conf
after changing its content the service has to be reloaded/restarted by sudo systemctl restart systemd-timesyncd
.