8

I am new to Ubuntu 16.04 LTS. The time on my machine is not updating from internet. I have changed the CMOS battery and also installed ntp and ntpdate and ran sudo ntpdate ntp.ubuntu.com. But none of these worked for me.

Running below command temporarily updates the time

sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"

Is there any other way to update my system time? I don't want to set it manually every session.

Zanna
  • 70,465

2 Answers2

9

Ubuntu 16.04 works with timedatectl / timesyncd

Check the timseyncd service is ok: systemctl status systemd-timesyncd

Possibly something is blocking the service (eg: ntpd installed), so it avoids syncing to avoid conflicts.

Another possibility is that you may be running a VirtualBox and you may see an error like:

● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   Active: inactive (dead)
Condition: start condition failed at Mon 2018-02-12 17:40:50 AEDT; 1min 31s ago
           ConditionFileIsExecutable=!/usr/sbin/VBoxService was not met
     Docs: man:systemd-timesyncd.service(8)

This was a solution for this case: sudo VBoxService --timesync-set-start. Inspired from this issue with a similar error

Efren
  • 143
3

In my case what I did is comment the line ConditionFileIsExecutable=!/usr/sbin/VBoxService in file /lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf and then:

sudo systemctl daemon-reload
sudo systemctl start systemd-timesyncd

All started to work again.

alexscmar
  • 243