Ubuntu – Unable to start ntpd.service

ntp

First, I installed the ntp package through sudo apt-get install ntp

I accessed /etc/ntp.conf to change the servers to a few local ones based on country, then I saved and restarted it using sudo systemctl restart ntp then checked the status with sudo systemctl status ntp which is shown running.

I also did ntpq -p which gave the below result, I think this means the client is running:

    remote          refid   st t when poll reach   delay   offset  jitter
==============================================================================
 ntp.ubuntu.com  .POOL.         16 p    -   64  0   0.000   0.000   0.000
*time-a-g.nist.g .NIST.         1 u -   64   77   11.567   -7.287   7.636
-174.138.107.37  46.243.26.34   2 u   63   64   37   84.975 0.159   4.474
-ns3.weiszhostin 128.138.141.172  2 u   1   64   77   69.844  -11.884   6.043
+li290-38.member 128.138.141.172  2 u   65   64   37   43.448   -3.202   6.023
+pugot.canonical 145.238.203.14   2 u   61   64   37   79.540   -5.833   4.040
+alphyn.canonica 132.246.11.231   2 u   4   64   77   11.714   -5.017   7.244
+chilipepper.can 145.238.203.14   2 u   61   64   37   78.136   -4.269   4.769
+golem.canonical 145.238.203.14   2 u   55   64   37   81.139   -3.766   4.748

However, I can't seem to get the daemon to run. I found that out when I did sudo systemctl status ntpd, then it gave the below result:

ntpd.service 
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

I thought it was not started at first so I did sudo systemctl start ntpd, but it gave:

Failed to start ntpd.service: Unit ntpd.service not found.

That's when I found out something is seriously wrong, I checked ls -l /etc/init.d and found only ntp is in the list, ntpd can't be found. I also tried to reinstall ntp but that didn't help.

Any ideas? Thanks a lot!

Best Answer

  • It was an issue for a long time on my Ubuntu 18.04 LTS. It was enabled, but inactive, so I'd had to start it manually after every reboot.

    $ sudo systemctl status ntp.service
    
    ● ntp.service - Network Time Service
       Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enabled)
       Active: inactive (dead)
         Docs: man:ntpd(8)
    

    The reason was in conflict with service systemd-timesyncd.service, and it's a part of systemd. After I disabled it ntp.service began to start successfully.

    $ sudo systemctl show ntp.service | grep Conflicts
    Conflicts=shutdown.target systemd-timesyncd.service
    $ sudo systemctl status  systemd-timesyncd.service
    ● systemd-timesyncd.service - Network Time Synchronization
       Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
       Active: active (running) since Fri 2019-07-12 05:17:21 UTC; 18min ago
    $ dpkg -S /lib/systemd/system/systemd-timesyncd.service
    systemd: /lib/systemd/system/systemd-timesyncd.service
    $ sudo systemctl disable systemd-timesyncd.service
    Removed /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service.