7

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.

  • Please mark the answer if it fixed your problem – Efren Jun 27 '18 at 3:22
  • @Efren No it didn't, I ended up pasting the above command in a script which runs everytime the machine starts – Flying Gambit Jun 28 '18 at 4:49
  • That's strange, so what was the timsyncd service status? – Efren Jun 28 '18 at 5:08
  • Sorry I no longer remember, shortly after this I was assigned a new windows machine – Flying Gambit Jun 28 '18 at 5:11
8

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

| improve this answer | |
2

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.