Synchronize date and time: Difference between revisions

From WickyWiki
m Wilbert moved page Synchronize date to Synchronize date and time: completion
mNo edit summary
Line 2: Line 2:
[[Category:Ubuntu System]]
[[Category:Ubuntu System]]
[[Category:201708]]
[[Category:201708]]
= timedatectl =
<syntaxhighlight lang=bash>
#check settings
timedatectl
#turn sync on, it could take some minutes to sync
sudo timedatectl set-ntp true
</syntaxhighlight>
= Problem on 14.04 =


Source:
Source:
* https://askubuntu.com/questions/228/how-to-set-ubuntu-to-synchronize-my-clock-with-a-time-server
* https://www.tecklyfe.com/fix-ubuntu-timedatectl-ntp-sync-no/
* https://help.ubuntu.com/lts/serverguide/NTP.html
 
An Ubuntu upgrade keeps the ntpdate configuration intact and timedatectl is turned on but not synchronizing. Since ntpdate is depreciated you can manually uninstall it and replace it with ntp.


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
sudo ntpdate pool.ntp.org
#uninstall ntpdate
sudo apt-get autoremove ntpdate
 
#install ntp daemon (ntpd)
sudo apt install ntp
 
#restart service, force update
sudo service ntp stop
sudo sh ntpd -gq
sudo service ntp start
</syntaxhighlight>
</syntaxhighlight>
Note: -gq tells the ntp daemon to correct the time regardless of the offset (g) and exit immediately (q).


See also
See also
* https://www.digitalocean.com/community/tutorials/how-to-set-up-time-synchronization-on-ubuntu-16-04
* https://www.digitalocean.com/community/tutorials/how-to-set-up-time-synchronization-on-ubuntu-16-04
= ntpdate (depreciated) =
Source:
* https://askubuntu.com/questions/228/how-to-set-ubuntu-to-synchronize-my-clock-with-a-time-server


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
sudo timedatectl set-ntp on
sudo ntpdate pool.ntp.org
</syntaxhighlight>
</syntaxhighlight>

Revision as of 19:05, 7 August 2017


timedatectl

#check settings
timedatectl

#turn sync on, it could take some minutes to sync
sudo timedatectl set-ntp true

Problem on 14.04

Source:

An Ubuntu upgrade keeps the ntpdate configuration intact and timedatectl is turned on but not synchronizing. Since ntpdate is depreciated you can manually uninstall it and replace it with ntp.

#uninstall ntpdate
sudo apt-get autoremove ntpdate

#install ntp daemon (ntpd)
sudo apt install ntp

#restart service, force update
sudo service ntp stop
sudo sh ntpd -gq
sudo service ntp start

Note: -gq tells the ntp daemon to correct the time regardless of the offset (g) and exit immediately (q).

See also

ntpdate (depreciated)

Source:

sudo ntpdate pool.ntp.org