3

the time-synchronization does not work on my Ubuntu 20.04 (it always shows a time two hours ahead of the actual time). I have tried to follow the hints here and here but without success.

I have already installed ntp, but when I run

timedatectl set-ntp on

in the terminal I get the output:

Failed to set ntp: NTP not supported

It drives me crazy because even when I set the time manually, it reverts to the old (and wrong) setting after restart.

Any hint is greatly appreciated!

Artur Meinild
  • 31,035
Philipp
  • 31

1 Answers1

6

You have probably selected wrong time zone.

Also, if the system is not going to be used as a time server, the ntp daemon is not recommended in recent versions of Ubuntu. Instead, systemd-timesyncd daemon should be used.

Please,

  1. Run sudo apt remove ntp to remove ntp.

  2. Run sudo apt install --reinstall systemd-timesyncd to refresh systemd-timesyncds installation.

  3. Run sudo dpkg-reconfigure tzdata to select the correct time zone.

  4. Afterwards, run cat /etc/timezone to check it.

  5. Run, timedatectl status to check that:

    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: no
    

    Note: If you are not dual booting (with Windows) you should set the hardware clock to UTC (i.e., RTC in local TZ: no in the above output), using the command timedatectl set-local-rtc 0 --adjust-system-clock. For more information see this: How to tell Ubuntu that hardware clock is local time?

  6. Run, systemctl status systemd-timesyncd to check that systemd-timesyncd daemon is:

    Active: active (running) since ...
    
  7. If it is not active, run systemctl enable systemd-timesyncd to enable it and systemctl restart systemd-timesyncd to start it.

  8. If you get errors in the above commands, you may need to run:

    $ timedatectl set-ntp false
    $ ## set approximate time manually using the `date` command.
    $ timedatectl set-ntp true
    

    and retry from step 5.

  9. Reboot system and check once more.

Zanna
  • 72,312
FedKad
  • 13,420