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.

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

2 Answers 2

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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