NTPD won't autostart

General support questions
Post Reply
dizwell
Posts: 29
Joined: 2006/03/16 22:27:28
Contact:

NTPD won't autostart

Post by dizwell » 2014/08/02 05:09:15

Building a CentOS 7 server with Kickstart, my %post section contains the lines

Code: Select all

systemctl enable dhcpd.service
systemctl enable named.service
systemctl enable ntpd.service
systemctl enable httpd.service
After installation and on first login, a ps -ef | grep httpd, or ps -ef | grep named or a ps -ef | grep dhcpd all return meaningful results, showing that *those* services have indeed been enabled and are auto-starting just fine. But a similar grep for ntpd returns nothing, and a ntpq -p returns nothing, either (except a timeout, expected when the daemon isn't running).

However, I can manually issue the command systemctl start ntpd.service no problems, at which point both ps and ntpq tests all return correct results. I had thought maybe the failure to autostart was down to my ntp.conf having bad entries, but since I can start the thing manually without error, I imagine that it can't be that.

Reduced to wild experimentation, I even added "service ntpd start" and/or "systemctl start ntpd.service" in my rc.local file, but neither produces a running ntp daemon at first login.

What am I doing wrong, please?

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: NTPD won't autostart

Post by TrevorH » 2014/08/02 10:30:56

CentOS 7 uses chrony instead of ntpd by default. You'd probably have to disable chrony before you can enable ntpd.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

dizwell
Posts: 29
Joined: 2006/03/16 22:27:28
Contact:

Re: NTPD won't autostart

Post by dizwell » 2014/08/02 22:48:56

Thanks for the tip. I'll give that a go and see how I get on. Much appreciated.

User avatar
vonskippy
Posts: 839
Joined: 2006/12/30 03:00:04
Location: Western Slope Colorado

Re: NTPD won't autostart

Post by vonskippy » 2014/08/02 23:00:56

TrevorH wrote:CentOS 7 uses chrony instead of ntpd by default.
Yes because ntpd was just oh so flaky and unreliable.

What is wrong with Redhat? They're screwing themselves out of the server market with all these moronic, and totally unnecessary, changes (I'm talking about you systemd).
For the 2.5^15th time :: Better Details = Better Answers

dizwell
Posts: 29
Joined: 2006/03/16 22:27:28
Contact:

Re: NTPD won't autostart

Post by dizwell » 2014/08/03 02:00:09

I found that issuing this command:

Code: Select all

systemctl disable chrony.service
and then this :

Code: Select all

systemctl enable ntpd.service
...did absolutely nothing for the server that had already been built. Ntpd still didn't start automatically at reboot.

However, I went back and edited my Kickstart file, added a single "-chrony" to the packages section and rebuilt the server from scratch... and it worked just fine. No need to edit rc.local either. It just starts automatically as it ought to, thanks to the 'systemctl enable ntpd.service' line.

Just what I was after, so thanks for the pointer in the right direction!

dizwell
Posts: 29
Joined: 2006/03/16 22:27:28
Contact:

Re: NTPD won't autostart

Post by dizwell » 2014/08/03 22:13:37

Just a follow up: systemctl disable chronyd.service works.
I missed the 'd' off my original command, which systemctl didn't seem to mind, but it meant that chrony was still running when I thought it wasn't.

KFrench
Posts: 2
Joined: 2016/01/21 23:07:12

Re: NTPD won't autostart

Post by KFrench » 2016/09/16 20:47:50

dizwell wrote:

Code: Select all

systemctl enable ntpd.service

Just wanted to stop by and say thanks. I am a CentOS newb and didn't enable the service after I installed it. I would have assumed Yum would do that for me. Surprisingly, Chrony doesn't seem to be on my system at all. Simply enabling ntpd did the trick.

Post Reply