LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 10-23-2014, 03:57 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Question NTP Wont Auto Start w/ Systemd


For some reason I assumed I configured my server to have NTP enabled on boot but when I start my system, systemd tells me the service is enabled yet when I start my OS, I'm unable to find the daemon running until I manually run the service...

I log in and take a look if anything failed starting up:
Code:
cachedrive ~ $ systemctl --failed
0 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
OK cool! Nothing failed. Lets verify a service is enabled:
Code:
cachedrive ~ $ systemctl is-enabled ntpd.service
enabled
Wonderful. So since it's enabled, lets verify:
Code:
cachedrive ~ $ systemctl status ntpd.service
ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
   Active: inactive (dead)
Huh?! Why is it 'inactive'? Lets make sure:
Code:
cachedrive ~ $ ps -ef | grep ntp | grep -v grep
cachedrive ~ $
Well clearly there's no PID for NTP and it's enabled to start w/ systemd but isn't and doesn't report a failure.
What happens when I manually start it and check:
Code:
cachedrive ~ $ sudo systemctl start ntpd.service
[sudo] password for cachedrive:
cachedrive ~ $ sudo systemctl status ntpd.service
ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
   Active: active (running) since Thu 2014-10-23 16:22:58 EDT; 10s ago
  Process: 1806 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 1807 (ntpd)
   CGroup: /system.slice/ntpd.service
           └─1807 /usr/sbin/ntpd -u ntp:ntp -g

Oct 23 16:22:58 db1.orl ntpd[1807]: proto: precision = 0.107 usec
Oct 23 16:22:58 db1.orl ntpd[1807]: 0.0.0.0 c01d 0d kern kernel time sync enabled
Oct 23 16:22:58 db1.orl systemd[1]: Started Network Time Service.
Oct 23 16:22:58 db1.orl ntpd[1807]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Oct 23 16:22:58 db1.orl ntpd[1807]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Oct 23 16:22:58 db1.orl ntpd[1807]: Listen and drop on 1 v6wildcard :: UDP 123
Oct 23 16:22:58 db1.orl ntpd[1807]: Listen normally on 2 lo 127.0.0.1 UDP 123
Oct 23 16:22:58 db1.orl ntpd[1807]: Listen normally on 3 eno16780032 10.6.200.121 UDP 123
Oct 23 16:22:58 db1.orl ntpd[1807]: Listen normally on 4 lo ::1 UDP 123
Oct 23 16:22:58 db1.orl ntpd[1807]: Listen normally on 5 eno16780032 fe80::250:56ff:febf:19d5 UDP 123
Oct 23 16:22:58 db1.orl ntpd[1807]: Listening on routing socket on fd #22 for interface updates
Oct 23 16:22:58 db1.orl ntpd[1807]: 0.0.0.0 c016 06 restart
Oct 23 16:22:58 db1.orl ntpd[1807]: 0.0.0.0 c012 02 freq_set kernel 10.483 PPM
Oct 23 16:22:59 db1.orl ntpd[1807]: 0.0.0.0 c615 05 clock_sync
Can anyone help me understand what is wrong here?
 
Old 10-24-2014, 09:59 AM   #2
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Anyone have any info on how to fix this? I'm extremely green when it comes to systemd and I've upgraded my box to make sure it's not an issue w/ an older revision of systemd:

Code:
Dependencies Resolved

====================================================================================================================================================================================
 Package                                    Arch                                 Version                                                Repository                             Size
====================================================================================================================================================================================
Updating:
 kexec-tools                                x86_64                               2.0.4-32.el7.centos.5                                  updates                               321 k
 libgudev1                                  x86_64                               208-11.el7_0.4                                         updates                                48 k
 systemd                                    x86_64                               208-11.el7_0.4                                         updates                               2.6 M
 systemd-libs                               x86_64                               208-11.el7_0.4                                         updates                               153 k
 systemd-sysv                               x86_64                               208-11.el7_0.4                                         updates                                35 k

Transaction Summary
====================================================================================================================================================================================
Upgrade  5 Packages
 
Old 10-24-2014, 01:10 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I thought this may have been due to something like network not yet being configured and I don't know about CentOS 7 but with Fedora 20 I eventually just stuck the systemctl start ntpd.service command in /etc/rc.d/rc.local.
 
Old 10-24-2014, 01:33 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
what do you get from systemd when you start it manually:
Code:
sudo systemctl start ntpd
what status, and is there a pid?

do you have a particular problem with time protocal or are you just generally worried?

i'm not sure there has to be a pid all the time, maybe it's not really a daemon in the traditional sense?
 
Old 10-07-2015, 11:34 AM   #5
davidsain
LQ Newbie
 
Registered: Jan 2009
Distribution: Mostly CentOS
Posts: 4

Rep: Reputation: 0
Still an issue

This thread is unresolved and still an issue, thus I chose to revive it from it's pseudo dormant state.

I have exactly the same problem. Another problem is have is I'm still somewhat green when it comes to Linux. I wouldn't have revived this thread if the problem were different. It looks like a solution is to hack it as UnSpawn suggested "...I don't know about CentOS 7 but with Fedora 20 I eventually just stuck the systemctl start ntpd.service command in /etc/rc.d/rc.local."

I've Googled this up and down and I'm not seeing anything useful.

My clients are a combination of Windows, Cisco hardware, EMC hardware. I wanted to move my time over to Linux just to have some simple machines with small hardware requirements. Seems as if it's not worth the extra effort, but I want to resolve this and not rely on Windows. Is CentOS a reliable distro? Maybe I should be using something else?

On a Windows machine I'm running Greyware Automations Windows Time Agent. I can see the status and variance of all up to 6 time servers. I can see the daemon isn't running until I manually start it after reboot because the app times out when it reaches out to that host for time.

Three different servers. Same symptoms, but the OS is identical.

OS CentOS Linux 7
Kernel 3.10.0-229.14.1.el7.x86_x64 on an x86_x64.

Hardware is vSphere/ESXi 5.5 for 2 servers, and old Dell R310 for the remaining server.

To start over I executed:

# systemctl disable ntpd.service
rm '/etc/systemd/system/multi-user.target.wants/ntpd.service'

# systemctl enable ntpd.service
ln -s '/usr/lib/systemd/system/ntpd.service' '/etc/systemd/system/multi-user.target.wants/ntpd.service'

# systemctl status ntpd
ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
Active: inactive (dead)

# systemctl is-enabled ntpd.service; echo $?
enabled
0

# reboot

.....

#systemctl status ntpd
ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
Active: inactive (dead)

#systemctl start ntpd

#systemctl status ntpd

ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
Active: active (running) since Wed 2015-10-07 10:05:03 MDT; 5s ago
Process: 29681 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 29682 (ntpd)
CGroup: /system.slice/ntpd.service
└─29682 /usr/sbin/ntpd -u ntp:ntp -g

Oct 07 10:05:03 time2.[mydomain].org ntpd[29682]: 0.0.0.0 c01d 0d kern kernel time...d
Oct 07 10:05:03 time2.[mydomain].org ntpd[29682]: ntp_io: estimated max descriptor...6
Oct 07 10:05:03 time2.[mydomain].org ntpd[29682]: Listen and drop on 0 v4wildcard ...3
Oct 07 10:05:03 time2.[mydomain].org systemd[1]: Started Network Time Service.
Oct 07 10:05:03 time2.[mydomain].org ntpd[29682]: Listen and drop on 1 v6wildcard ...3
Oct 07 10:05:03 time2.[mydomain].org ntpd[29682]: Listen normally on 2 lo 127.0.0....3
Oct 07 10:05:03 time2.[mydomain].org ntpd[29682]: Listen normally on 3 em1 10.130....3
Oct 07 10:05:03 time2.[mydomain].org ntpd[29682]: Listen normally on 4 lo ::1 UDP 123
Oct 07 10:05:03 time2.[mydomain].org ntpd[29682]: Listen normally on 5 em1 fe80::8...3
Oct 07 10:05:03 time2.[mydomain].org ntpd[29682]: Listening on routing socket on f...s
Hint: Some lines were ellipsized, use -l to show in full.



Thanks for any assistance!
 
Old 10-08-2015, 02:04 PM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
all those status lines look ok to me.
not every systemd service is running all the time, so it's perfectly ok if it says "dead".
especially since the last status output doesn't show any errors.

is something actually not working on your system?

on a side note, systemd now has its own timesyncd, so you don't need ntpd anymore.
might depend on your systemd version, but on 226 it works.
 
Old 10-28-2015, 05:52 PM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
CentOS 7 uses chrony by default rather than ntp:
https://www.centos.org/forums/viewto...p?f=47&t=47626

ntp probably isn't auto-starting because there's a conflict. What's the output of "systemctl status chronyd"? What is the result if you run "systemctl disable chronyd; systemctl enable ntpd", and reboot?

Last edited by suicidaleggroll; 10-28-2015 at 05:56 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ntp drift file in /etc/ntp instead of /var/lib/ntp - suggestion for a patch in Slack niels.horn Slackware 16 05-07-2009 07:35 PM
Debian Sarge - NTP wont stay running kenwoodgt Linux - Software 1 02-06-2007 12:03 PM
getting ntp to auto start on reboot linneaw Red Hat 2 05-29-2006 04:34 PM
How do I auto start modules that aren't auto loaded on boot? darkbluedrew Debian 2 09-18-2005 09:10 AM
eth0 Auto Connect, How to auto start on logon cornish Linux - Networking 2 05-09-2005 12:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 01:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration