ntp-client.service failed to sync clock in systemd [Solved]

Discussion in general that pertains to Sabayon Linux - Must Pertain to Sabayon Linux

Moderator: Moderators

ntp-client.service failed to sync clock in systemd [Solved]

Postby TuxmAL » Wed Jul 24, 2013 20:58

I use my laptop with a wlan connection and after enabling ntpd-client.service in systemd, it fails to sync clock at boot. It works correctly starting it manually on console (after boot)
Code: Select all
[email protected] # systemctl start ntpd-client.service

Investigating with
Code: Select all
[email protected] # journalctl -bx --full
showed me
Code: Select all
...
-- Unit ModemManager.service has begun starting up.
lug 24 23:25:27 chiba ntpdate[4242]: Error resolving ntp1.inrim.it: System error (-11)
lug 24 23:25:27 chiba ntpdate[4242]: Error resolving ntp2.inrim.it: System error (-11)
lug 24 23:25:27 chiba systemd[1]: ntp-client.service: main process exited, code=exited, status=1/FAILUR
lug 24 23:25:27 chiba systemd[1]: Failed to start Set time via NTP.
-- Subject: Unit ntp-client.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022
--
-- Unit ntp-client.service has failed.
--
-- The result is failed.
lug 24 23:25:27 chiba systemd[1]: Unit ntp-client.service entered failed state.
...

and this seemed to happen before wi-fi is started (so the name resolution is not possible at all).
I tried to change ntp-cliente.service adding into the [Unit] section
Code: Select all
Requires=wpa_supplicant.service
Before=wpa_supplicant.service

but nothing changed.
Any advice?
Thanks!
Tuxmal
Last edited by TuxmAL on Wed Oct 23, 2013 17:34, edited 1 time in total.
casa: Sabayon Linux (KDE) - i686 su Dell Inspiron 6400.
ufficio: Fedora 19 - x86_64 su Compaq 500B MT (Intel Dual Core)
TuxmAL
Baby Hen
 
Posts: 11
Joined: Wed May 02, 2012 16:59
Location: Napoli, ITaly

Re: ntp-client.service failed to sync clock in systemd

Postby matuss » Thu Jul 25, 2013 20:57

Have you tried changing
Code: Select all
Before=wpa_supplicant.service

to
Code: Select all
After=wpa_supplicant.service

in the edited file?

From http://www.freedesktop.org/software/systemd/man/systemd.unit.html:
Code: Select all
If a unit foo.service contains a setting Before=bar.service and both units are being started, bar.service's start-up is delayed until foo.service is started up.

- in your case it means, ntp service will be started BEFORE wpa_supplicant which is opposite to what you want

(ps: I would suggest a little sleep after starting wpa_supplicant to have some time to connect to your network, but I have no idea how to do that :) )
matuss
Baby Hen
 
Posts: 9
Joined: Fri Jul 19, 2013 8:36

Re: ntp-client.service failed to sync clock in systemd

Postby rdnetto » Fri Jul 26, 2013 0:54

I have the same issue with an Ethernet network connection.
rdnetto
Young Hen
 
Posts: 27
Joined: Sun Jun 23, 2013 10:06

Re: ntp-client.service failed to sync clock in systemd

Postby joost » Wed Jul 31, 2013 11:23

What if you added:

Code: Select all
After=network.target
joost
Sagely Hen
 
Posts: 2605
Joined: Fri Nov 17, 2006 12:11
Location: The Netherlands

Re: ntp-client.service failed to sync clock in systemd

Postby TuxmAL » Wed Jul 31, 2013 18:27

Well, ntp-client.servis unit already have
Code: Select all
After=network.target nss-lookup.target

and reading the journal it seems a problem with switching on the wlan (or the eth), then switching off, then starting ntp-client and then again network.
Now I must delay the solution to this problem until I'll came back to work, cause I must ;-) go on vacation wit my family!
casa: Sabayon Linux (KDE) - i686 su Dell Inspiron 6400.
ufficio: Fedora 19 - x86_64 su Compaq 500B MT (Intel Dual Core)
TuxmAL
Baby Hen
 
Posts: 11
Joined: Wed May 02, 2012 16:59
Location: Napoli, ITaly

Re: ntp-client.service failed to sync clock in systemd

Postby TuxmAL » Wed Jul 31, 2013 19:03

Hi matuss,
matuss wrote:Have you tried changing
Code: Select all
Before=wpa_supplicant.service

to
Code: Select all
After=wpa_supplicant.service

in the edited file?

sorry, but neither this worked!
As I said before, I'll let this problem for a while for vacation, i'll work on it later!
casa: Sabayon Linux (KDE) - i686 su Dell Inspiron 6400.
ufficio: Fedora 19 - x86_64 su Compaq 500B MT (Intel Dual Core)
TuxmAL
Baby Hen
 
Posts: 11
Joined: Wed May 02, 2012 16:59
Location: Napoli, ITaly

Re: ntp-client.service failed to sync clock in systemd

Postby TuxmAL » Wed Jul 31, 2013 19:18

rdnetto wrote:I have the same issue with an Ethernet network connection.

Me too saw this with ethernet. Maybe the problem is related with the "managed" state of the network and NetworkManager?
I don't know. :shock:
casa: Sabayon Linux (KDE) - i686 su Dell Inspiron 6400.
ufficio: Fedora 19 - x86_64 su Compaq 500B MT (Intel Dual Core)
TuxmAL
Baby Hen
 
Posts: 11
Joined: Wed May 02, 2012 16:59
Location: Napoli, ITaly

Re: ntp-client.service failed to sync clock in systemd

Postby TuxmAL » Wed Oct 23, 2013 17:33

After many other (unsuccessful) tests and some reading on the net on ntpdate superseded by ntpd -g -q, I found a solution changing ntp-client.service ExecStart command and setting accordingly /etc/ntp.conf.
Code: Select all
< ExecStart=/usr/sbin/ntpdate -b -u $SERVER
---
> ExecStart=/usr/sbin/ntpd -g -q

The only small negative is that time is updated with one or two seconds delay, so is it possible that KDM logon screen could show an incorrect time before logging in.
casa: Sabayon Linux (KDE) - i686 su Dell Inspiron 6400.
ufficio: Fedora 19 - x86_64 su Compaq 500B MT (Intel Dual Core)
TuxmAL
Baby Hen
 
Posts: 11
Joined: Wed May 02, 2012 16:59
Location: Napoli, ITaly


Return to Sabayon Linux General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests