Synchronize date and time: Difference between revisions

From WickyWiki
mNo edit summary
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
#check settings
#check state and settings
timedatectl
timedatectl


Line 13: Line 13:
</syntaxhighlight>
</syntaxhighlight>


= Problem on 14.04 =
= Ubuntu upgrades to 14.04 =


Source:
Source:
Line 26: Line 26:
#install ntp daemon (ntpd)
#install ntp daemon (ntpd)
sudo apt install ntp
sudo apt install ntp
</syntaxhighlight>
Force update now:


#restart service, force update
<syntaxhighlight lang=bash>
sudo service ntp stop
sudo service ntp stop


Line 33: Line 36:
sudo ntpd -gq
sudo ntpd -gq


#start the service
sudo service ntp start
sudo service ntp start
</syntaxhighlight>
Check state and settings:
<syntaxhighlight lang=bash>
timedatectl
</syntaxhighlight>
</syntaxhighlight>



Latest revision as of 20:21, 18 August 2017


timedatectl

#check state and settings
timedatectl

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

Ubuntu upgrades to 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

Force update now:

sudo service ntp stop

#correct the time regardless of the offset (g) and exit immediately (q)
sudo ntpd -gq

sudo service ntp start

Check state and settings:

timedatectl

See also

ntpdate (depreciated)

Source:

sudo ntpdate pool.ntp.org