8

When I try to I get this:

# systemctl enable systemd-timesyncd.service
Failed to enable unit: Unit file systemd-timesyncd.service does not exist.

NTP is installed:

# apt-get install ntp
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ntp is already the newest version (1:4.2.8p12+dfsg-3ubuntu4.20.04.1).

Also:

# timedatectl set-ntp true
Failed to set ntp: NTP not supported
aaa90210
  • 221

2 Answers2

15

As @Christian Ehrhard wrote. I installed "systemd-timesyncd" and set a local NTP server as target. After restarting the service, it worked just fine.

sudo apt install systemd-timesyncd
sudo nano /etc/systemd/timesyncd.conf

Set NTP=<IP_of_your_NTP_Server> and

systemctl restart systemd-timesyncd

Result:

System clock synchronized: yes                        
NTP service: active

Further help.

Maybe look into desynchronization problem.
Blog: Fix Ubuntu TimeDateCTL NTP Sync No.

Pablo Bianchi
  • 17,371
Ari
  • 169
3

Unfortunately, by "installing NTP" you did effectively remove systemd-timesyncd. I can understand that it can fly by too fast on an install/upgrade to notice, but those are mutually exclusive. This is due to the fact that there can only be one NTP service reasonable working on a system.

So you could either $ apt install systemd-timesyncd which will remove NTP and make what you initially wanted work. Or alternatively if you want more sophisticated control of time syncing then you should be aware that since 18.04 the supported and recommended package is chrony. Thereby the alternative is $ apt install chrony (which also will remove NTP).

See the bionic release notes which is when this switch happened.

Pablo Bianchi
  • 17,371
Christian Ehrhardt
  • 2,195
  • 16
  • 22