You are not logged in.

#1 2015-12-28 12:25:23

memphis
Member
Registered: 2014-10-14
Posts: 6

NTPD : Failed to start the service

Hello guys,

I'm on my server and it has 4 network interfaces, two of them connected (static), two not connected (but may be - dhcp).

In this configuration, the system couldn't start ntpd.

Running the command systemctl restart ntpd block and never end.

I got the ntp sync by starting manually the process using the following command : ntpd -q -g -u ntp:ntp

/etc/ntp.conf

# Please consider joining the pool:
#
#     http://www.pool.ntp.org/join.html
#
# For additional information see:
# - https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon
# - http://support.ntp.org/bin/view/Support/GettingStarted
# - the ntp.conf man page

# Associate to Arch's NTP pool
server 0.europe.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org

# By default, the server allows:
# - all queries from the local host
# - only time queries from remote hosts, protected by rate limiting and kod
restrict default kod limited nomodify nopeer noquery notrap
restrict 127.0.0.1
restrict ::1

# Location of drift file
driftfile /var/lib/ntp/ntp.drift

routel

         target            gateway          source    proto    scope    dev tbl
        default           10.0.0.1                                   enp1s0 
      10.0.0.0/ 24                      10.0.0.204   kernel     link enp1s0 
   192.168.1.0/ 24                     192.168.1.1   kernel     link enp3s0 
       10.0.0.0          broadcast      10.0.0.204   kernel     link enp1s0 local
     10.0.0.204              local      10.0.0.204   kernel     host enp1s0 local
     10.0.0.255          broadcast      10.0.0.204   kernel     link enp1s0 local
      127.0.0.0          broadcast       127.0.0.1   kernel     link     lo local
     127.0.0.0/ 8            local       127.0.0.1   kernel     host     lo local
      127.0.0.1              local       127.0.0.1   kernel     host     lo local
127.255.255.255          broadcast       127.0.0.1   kernel     link     lo local
    192.168.1.0          broadcast     192.168.1.1   kernel     link enp3s0 local
    192.168.1.1              local     192.168.1.1   kernel     host enp3s0 local
  192.168.1.255          broadcast     192.168.1.1   kernel     link enp3s0 local
        fe80::/ 64                                   kernel          enp3s0 
        fe80::/ 64                                   kernel          enp1s0 
        default        unreachable                   kernel              lo unspec
            ::1              local                     none              lo local
fe80::76d4:35ff:fec6:3c44              local                     none              lo local
fe80::76d4:35ff:fec6:3c46              local                     none              lo local
        ff00::/ 8                                                    enp3s0 local
        ff00::/ 8                                                    enp1s0 local
        default        unreachable                   kernel              lo unspec

ip addr show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 74:d4:35:c6:3c:44 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.204/24 brd 10.0.0.255 scope global enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::76d4:35ff:fec6:3c44/64 scope link 
       valid_lft forever preferred_lft forever
3: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 74:d4:35:c6:3c:45 brd ff:ff:ff:ff:ff:ff
4: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 74:d4:35:c6:3c:46 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global enp3s0
       valid_lft forever preferred_lft forever
    inet6 fe80::76d4:35ff:fec6:3c46/64 scope link 
       valid_lft forever preferred_lft forever
5: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 74:d4:35:c6:3c:47 brd ff:ff:ff:ff:ff:ff

How can I resolve this issue ? Thx in advance for your help.

Offline

#2 2015-12-28 14:16:18

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: NTPD : Failed to start the service

What happen if you run `ntpd -g -u ntp:ntp` manually then?

Offline

#3 2015-12-28 14:26:36

memphis
Member
Registered: 2014-10-14
Posts: 6

Re: NTPD : Failed to start the service

It works, so it's very strange.

The daemon doesn't start, but the command alone works.

Offline

#4 2015-12-28 14:52:07

paulkerry
Member
From: Sheffield, UK
Registered: 2014-10-02
Posts: 611

Re: NTPD : Failed to start the service

What is the output of...

systemctl status ntpd.service

Offline

#5 2015-12-28 16:33:50

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: NTPD : Failed to start the service

memphis wrote:

The daemon doesn't start, but the command alone works.

So do you actually mean `ntpd -q -g -u ntp:ntp` works but `ntpd -g -u ntp:ntp` does not when ran manually?

Offline

#6 2015-12-31 14:20:44

memphis
Member
Registered: 2014-10-14
Posts: 6

Re: NTPD : Failed to start the service

 
[root@recas-system /]# timedatectl status
      Local time: jeu. 2015-12-31 15:16:27 CET
  Universal time: jeu. 2015-12-31 14:16:27 UTC
        RTC time: jeu. 2015-12-31 14:16:29
       Time zone: Europe/Paris (CET, +0100)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  dim. 2015-10-25 02:59:59 CEST
                  dim. 2015-10-25 02:00:00 CET
 Next DST change: DST begins (the clock jumps one hour forward) at
                  dim. 2016-03-27 01:59:59 CET
                  dim. 2016-03-27 03:00:00 CEST
● ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
[root@recas-system /]# ntpd -q -g -u ntp:ntp
31 Dec 15:19:51 ntpd[2961]: ntpd 4.2.8@1.3265-o Sat Dec 20 02:06:40 UTC 2014 (1): Starting
31 Dec 15:19:51 ntpd[2961]: Command line: ntpd -q -g -u ntp:ntp
31 Dec 15:19:51 ntpd[2961]: proto: precision = 0.034 usec (-25)
31 Dec 15:19:51 ntpd[2961]: Listen and drop on 0 v6wildcard [::]:123
31 Dec 15:19:51 ntpd[2961]: Listen and drop on 1 v4wildcard 0.0.0.0:123
31 Dec 15:19:51 ntpd[2961]: Listen normally on 2 lo 127.0.0.1:123
31 Dec 15:19:51 ntpd[2961]: Listen normally on 3 enp1s0 10.0.0.204:123
31 Dec 15:19:51 ntpd[2961]: Listen normally on 4 enp3s0 192.168.1.1:123
31 Dec 15:19:51 ntpd[2961]: Listen normally on 5 lo [::1]:123
31 Dec 15:19:51 ntpd[2961]: Listen normally on 6 enp1s0 [fe80::76d4:35ff:fec6:3c44%2]:123
31 Dec 15:19:51 ntpd[2961]: Listen normally on 7 enp3s0 [fe80::76d4:35ff:fec6:3c46%4]:123
31 Dec 15:19:51 ntpd[2961]: Listening on routing socket on fd #24 for interface updates
31 Dec 15:19:52 ntpd[2961]: ntpd: time slew +0.001990 s

To summary, the ntpd command always works but the systemctl start ntpd always block.

Offline

#7 2016-01-01 03:37:36

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: NTPD : Failed to start the service

FIrst of all the systemd service does not run the one-time sync command `ntpd -q -g -u ntp:ntp`, instead it starts a daemon with `ntpd -g -u ntp:ntp`. So I don't know whether you actually mean the ntpd does not sync the time when it is run as a daemon, or you simply can't start the systemd service.

Offline

#8 2016-01-01 13:23:28

ratcheer
Member
Registered: 2011-10-09
Posts: 913

Re: NTPD : Failed to start the service

tom.ty89 wrote:
memphis wrote:

The daemon doesn't start, but the command alone works.

So do you actually mean `ntpd -q -g -u ntp:ntp` works but `ntpd -g -u ntp:ntp` does not when ran manually?

I have the exact same situation, and I have reported it several times over the past year or so. No suggestions have solved it. I finally gave up and now use systemd-timesyncd.

Tim

Offline

#9 2016-01-02 20:25:10

paulkerry
Member
From: Sheffield, UK
Registered: 2014-10-02
Posts: 611

Re: NTPD : Failed to start the service

memphis wrote:
 
[root@recas-system /]# timedatectl status
      Local time: jeu. 2015-12-31 15:16:27 CET
  Universal time: jeu. 2015-12-31 14:16:27 UTC
        RTC time: jeu. 2015-12-31 14:16:29
       Time zone: Europe/Paris (CET, +0100)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  dim. 2015-10-25 02:59:59 CEST
                  dim. 2015-10-25 02:00:00 CET
 Next DST change: DST begins (the clock jumps one hour forward) at
                  dim. 2016-03-27 01:59:59 CET
                  dim. 2016-03-27 03:00:00 CEST

Your output is different to mine and I'm unsure why: can anyone elaborate? Here is mine...

[root@paul ~]# timedatectl status
      Local time: Sat 2016-01-02 20:17:23 GMT
  Universal time: Sat 2016-01-02 20:17:23 UTC
        RTC time: Sat 2016-01-02 20:17:23
       Time zone: Europe/London (GMT, +0000)
 Network time on: no
NTP synchronized: yes
 RTC in local TZ: no

Is your system fully up to date?

Have you got ntp 4.2.8.p4-1 installed?

When you manually try to...

systemctl start ntpd.service

what do you get at the end of...

journal -b

pertaining to ntp and the ntp service?

Offline

#10 2016-01-06 15:53:48

memphis
Member
Registered: 2014-10-14
Posts: 6

Re: NTPD : Failed to start the service

Hello guys,

Apparently, the NTP service was blocked by the network service who (i think) wait for the dhcp negociation on my others interfaces.

By editing the file /usr/lib/systemd/system/ntp.service like this :

 
[Unit]
Description=Network Time Service
After=nss-lookup.target
Conflicts=systemd-timesyncd.service

[Service]
Type=forking
PrivateTmp=true
ExecStart=/usr/bin/ntpd -g -u ntp:ntp
Restart=always

[Install]
WantedBy=multi-user.target

the service is correctly started and the ntp synchronization is ON.

Any expert to confirm that the solution is correct ?

NB : Original ntp.service file :

 
[Unit]
Description=Network Time Service
After=network.target nss-lookup.target
Conflicts=systemd-timesyncd.service

[Service]
Type=forking
PrivateTmp=true
ExecStart=/usr/bin/ntpd -g -u ntp:ntp
Restart=always

[Install]
WantedBy=multi-user.target

Offline

#11 2016-01-06 16:21:53

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: NTPD : Failed to start the service

Hmm which dhcp client are you using / how did you start it? Sounds like it is not pulling network.target in...(be noted that it is different from network-online.target, see systemd.special(7) for details)

Offline

Board footer

Powered by FluxBB