Ubuntu – Unable to synchronize time using NTP

12.04ntp

When I try to synchronize time using NTP. Using the below command

sudo ntpdate -b pool.ntp.org

I get this error saying NTP socket is in use. How to fix this?

18 Jan 05:53:49 ntpdate[21340]: the NTP socket is in use, exiting

Best Answer

the NTP socket is in use, exiting

Indicates that you have an NTP daemon running, usually the one via the ntp package. You can't have two applications adjusting the clock at the same time.

  1. First stop the current NTP daemon running:

    sudo service ntp stop
    
  2. Run your ntpdate command.

  3. Start the NTP daemon again:

    sudo service ntp start
    

Background

The NTP daemon will not take large steps forwards or backwards, but is useful for very smooth and small transitions. Before it will work correctly, sync the time using ntpdate first, for that reason. You can query the status of the daemon like this:

ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*chime1.surfnet. 194.171.167.130  2 u   59   64    7    3.159   -0.207   0.136
+chime2.surfnet. .GPS.            1 u   59   64    7    6.872   -0.592   0.091
[...]
 ns1.tudelft.nl  .INIT.          16 u    -   64    0    0.000    0.000   0.000
+ev001.tilaa.nl  193.67.79.202    2 u   55   64    7    4.038   -0.613   0.110
Related Question