Unable to start ntpd.service
Andrew Mclaughlin
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.748However, 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!
15 Answers
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/ sudo apt-get install -y ntp
sudo timedatectl set-ntp on
sudo service ntp restart
sudo service ntp status | cat 1 On Ubuntu 16.04 LTS the ntp package contain:
- client and utilites -
/usr/bin/calc_tickadj,/usr/bin/ntpdc,/usr/bin/ntpq,/usr/bin/ntpsweep,/usr/bin/ntptrace,/usr/bin/update-leap. - daemon (
/usr/sbin/ntpd), started by/etc/init.d/ntp.
You may restart the service with
sudo systemctl restart ntp.serviceor
sudo service ntp restartYou can check that server is running with
sudo service ntp status
sudo systemctl status ntp.service
sudo netstat -pl | grep ntpon my system it returns:
$ sudo netstat -pl | grep ntp
udp 0 0 10.0.2.15:ntp *:* 12303/ntpd
udp 0 0 localhost:ntp *:* 12303/ntpd
udp 0 0 *:ntp *:* 12303/ntpd
udp6 0 0 fe80::99a2:45db:62e:ntp [::]:* 12303/ntpd
udp6 0 0 ip6-localhost:ntp [::]:* 12303/ntpd
udp6 0 0 [::]:ntp [::]:* 12303/ntpAnd it was started by systemd:
$ pstree -l -s -p -a 12303
systemd,1 splash └─ntpd,12303 -p /var/run/ntpd.pid -g -u 121:129
$ ps -P 12303 PID PSR TTY STAT TIME COMMAND
12303 0 ? Ss 0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 121:129 2 sudo systemctl unmask ntp.service
sudo systemctl start ntp.service
sudo systemctl enable ntp.serviceVoilà!
NTP is a peer to peer protocol, so the ntpd daemon acts as both server and client at the same time.
On Ubuntu, the service is named ntp even though the daemon is named ntpd.
If you look at the output of sudo systemctl status ntp you'll see that it actually runs ntpd:
CGroup: / └─1201 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 110:118So everything is fine. systemctl shows the ntpd daemon is running, and ntpq -p shows it's synchronizing successfully to other servers.