Hi Rich,

Thank you for your response.

I am using the units that are supplied with gentoo....
I just restarted my machine and I get this output "systemctl status ntpdate":


* ntpdate.service - Set time via NTP using ntpdate
   Loaded: loaded (/lib/systemd/system/ntpdate.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/ntpdate.service.d
           `-00gentoo.conf
   Active: failed (Result: exit-code) since Mon 2019-03-11 00:33:37 CET; 2min 30s ago   Process: 4553 ExecStart=/usr/sbin/ntpdate -b -u $SERVER (code=exited, status=1/FAILURE)
 Main PID: 4553 (code=exited, status=1/FAILURE)

Mar 11 00:33:36 localhost systemd[1]: Starting Set time via NTP using ntpdate... Mar 11 00:33:37 localhost ntpdate[4553]: Exiting, name server cannot be used: Temporary failure in name resolution (-3)11 Mar 00:33:37 ntpdate[4553]: name server cannot be used: Temporary failure in name resolution (-3) Mar 11 00:33:37 localhost systemd[1]: ntpdate.service: Main process exited, code=exited, status=1/FAILURE Mar 11 00:33:37 localhost systemd[1]: ntpdate.service: Failed with result 'exit-code'. Mar 11 00:33:37 localhost systemd[1]: Failed to start Set time via NTP using ntpdate.

and for the output looks like this:

-- Logs begin at Tue 2019-02-19 08:58:02 CET, end at Mon 2019-03-11 00:34:43 CET. -- Mar 11 00:33:36 localhost systemd[1]: Starting Set time via NTP using ntpdate... Mar 11 00:33:37 localhost ntpdate[4553]: Exiting, name server cannot be used: Temporary failure in name resolution (-3)11 Mar 00:33:37 ntpdate[4553]: name server cannot be used: Temporary failure in name resolution (-3) Mar 11 00:33:37 localhost systemd[1]: ntpdate.service: Main process exited, code=exited, status=1/FAILURE Mar 11 00:33:37 localhost systemd[1]: ntpdate.service: Failed with result 'exit-code'. Mar 11 00:33:37 localhost systemd[1]: Failed to start Set time via NTP using ntpdate.

If i start by hand, after the system is up with "systemctl start ntpdate":

* ntpdate.service - Set time via NTP using ntpdate
   Loaded: loaded (/lib/systemd/system/ntpdate.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/ntpdate.service.d
           `-00gentoo.conf
   Active: active (exited) since Sun 2019-03-10 23:38:36 CET; 2s ago
  Process: 5093 ExecStart=/usr/sbin/ntpdate -b -u $SERVER (code=exited, status=0/SUCCESS)
 Main PID: 5093 (code=exited, status=0/SUCCESS)

Mar 11 00:37:59 localhost systemd[1]: Starting Set time via NTP using ntpdate... Mar 10 23:38:36 localhost ntpdate[5093]: 10 Mar 23:38:36 ntpdate[5093]: step time server 162.23.41.10 offset -3573.367681 sec Mar 10 23:38:36 localhost systemd[1]: Started Set time via NTP using ntpdate.

also the result here looks different ( journalctl -ab -u ntpdate) by executing manually:

Mar 10 23:38:36 localhost ntpdate[5093]: 10 Mar 23:38:36 ntpdate[5093]: step time server 162.23.41.10 offset -3573.367681 sec Mar 10 23:38:36 localhost systemd[1]: Started Set time via NTP using ntpdate.

then everything looks fine...


Any ideas ?


best, Tamer

On 10.03.19 22:36, Rich Freeman wrote:
On Sun, Mar 10, 2019 at 5:16 PM Tamer Higazi <th9...@googlemail.com> wrote:
I have my gentoo system running with systemd.

I figured out that ntpdate is getting started before network is up.
I am not yet very familiar with systemd.

Can somebody of you tell me how to fix that, that "ntpdate" is started
the moment network devices are up ?

How is ntpdate being run?  If you're using the supplied unit then it
should default to starting after network-online.target, which if
you're using a network manager started by systemd should delay it
until the network is running.

Now, if you're starting ntpdate in some other way then you'd need to
make sure that the network is online, and if you're starting the
network without using a supplied systemd unit then you'd need to make
sure systemd is aware of when it is up.

Basically, it should just work for the most part if you're using the
supplied units, but you don't mention much about your configuration
and Gentoo users do have a tendency to roll up their sleeves and do
things in scripts/etc.

The output of something like "systemctl status ntpdate" or "journalctl
-ab -u ntpdate" might be helpful.  I'm not sure how you're configuring
your network (networkd, etc)?  That would also be useful to know, as
well as the journal log for the associated units.

Systemd is highly dependency-driven and parallel, so issues like this
are mostly the result of failing to declare a dependency somewhere
(either on the network side or the ntp side).  If you're using openrc
in parallel mode you need to do the same, and again that should be
taken care of out of the box if you're using the supplied services,
but if you roll your own you also have to be careful.


Reply via email to