How to start/enable timesyncd on Ubuntu 20.04 LTS

How To Start/Enable Timesyncd On Ubuntu 20.04 LTS

The systemctl command is used to manage system services on Ubuntu 20. One of the services it can manage is the systemd-timesyncd service, which is responsible for synchronizing the system clock.

The status option is used to display the current status of a service. When used with systemd-timesyncd, it will display whether the service is running or not, and if there are any errors or warnings.

To use the systemctl status systemd-timesyncd command on Ubuntu 20, open a terminal window and enter the command. The output will look something like this:

systemd-timesyncd command on nexonhost servers

The output shows that the systemd-timesyncd service is running (Active: active (running)), and it also shows the time when it started (Active since), as well as any status messages or errors.

Overall, the systemctl status systemd-timesyncd command is a useful tool for checking the status of the systemd-timesyncd service on Ubuntu 20, and for troubleshooting any clock synchronization issues.

If the output of the systemctl status systemd-timesyncd command shows that the systemd-timesyncd service is not active, it means that the system clock is not being synchronized. There are several reasons why this might happen, and here is how you can take to troubleshoot the issue:

 

Check the NTP Configuration File

The systemd-timesyncd service uses the NTP configuration file (/etc/systemd/timesyncd.conf) to determine which NTP servers to use for clock synchronization. Make sure that the configuration file is properly configured with the correct NTP servers.

Open the NTP configuration file with the following command:

sudo nano /etc/systemd/timesyncd.conf

Make sure that the NTP option is not commented out, and that it points to the correct NTP servers. For example, from this :

#  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=ntp.ubuntu.com
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048

To this.

#  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=<IP_of_your_NTP_Server>
FallbackNTP=<IP_of_your_NTP_Backup.Server>
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048

FallbackNTP is an option in the systemd-timesyncd configuration file (/etc/systemd/timesyncd.conf) on Ubuntu 20.04 and other Linux systems. This option specifies a secondary NTP server to use if the primary NTP server specified in the NTP option is not reachable or does not respond within a certain amount of time.

In other words, if the systemd-timesyncd service is unable to synchronize the system clock with the primary NTP server, it will try to synchronize with the fallback NTP server specified in the FallbackNTP option.

Here’s an example of how the FallbackNTP option can be used in the timesyncd.conf file:

NTP=primary.server
FallbackNTP=backup.server

In this example, if the systemd-timesyncd service is unable to synchronize the system clock with primary.server , it will try to synchronize with backup.server.

It’s worth noting that the FallbackNTP option is optional, and if it is not specified, the systemd-timesyncd service will not use a fallback NTP server. Also, it’s important to choose a reliable and accurate fallback NTP server to ensure that the system clock is synchronized as accurately as possible.