1 |
Hi Rich, |
2 |
|
3 |
Thank you for your response. |
4 |
|
5 |
I am using the units that are supplied with gentoo.... |
6 |
I just restarted my machine and I get this output "systemctl status |
7 |
ntpdate": |
8 |
|
9 |
|
10 |
* ntpdate.service - Set time via NTP using ntpdate |
11 |
Loaded: loaded (/lib/systemd/system/ntpdate.service; enabled; vendor |
12 |
preset: disabled) |
13 |
Drop-In: /etc/systemd/system/ntpdate.service.d |
14 |
`-00gentoo.conf |
15 |
Active: failed (Result: exit-code) since Mon 2019-03-11 00:33:37 |
16 |
CET; 2min 30s ago |
17 |
Process: 4553 ExecStart=/usr/sbin/ntpdate -b -u $SERVER (code=exited, |
18 |
status=1/FAILURE) |
19 |
Main PID: 4553 (code=exited, status=1/FAILURE) |
20 |
|
21 |
Mar 11 00:33:36 localhost systemd[1]: Starting Set time via NTP using |
22 |
ntpdate... |
23 |
Mar 11 00:33:37 localhost ntpdate[4553]: Exiting, name server cannot be |
24 |
used: Temporary failure in name resolution (-3)11 Mar 00:33:37 |
25 |
ntpdate[4553]: name server cannot be used: Temporary failure in name |
26 |
resolution (-3) |
27 |
Mar 11 00:33:37 localhost systemd[1]: ntpdate.service: Main process |
28 |
exited, code=exited, status=1/FAILURE |
29 |
Mar 11 00:33:37 localhost systemd[1]: ntpdate.service: Failed with |
30 |
result 'exit-code'. |
31 |
Mar 11 00:33:37 localhost systemd[1]: Failed to start Set time via NTP |
32 |
using ntpdate. |
33 |
|
34 |
and for the output looks like this: |
35 |
|
36 |
-- Logs begin at Tue 2019-02-19 08:58:02 CET, end at Mon 2019-03-11 |
37 |
00:34:43 CET. -- |
38 |
Mar 11 00:33:36 localhost systemd[1]: Starting Set time via NTP using |
39 |
ntpdate... |
40 |
Mar 11 00:33:37 localhost ntpdate[4553]: Exiting, name server cannot be |
41 |
used: Temporary failure in name resolution (-3)11 Mar 00:33:37 |
42 |
ntpdate[4553]: name server cannot be used: Temporary failure in name |
43 |
resolution (-3) |
44 |
Mar 11 00:33:37 localhost systemd[1]: ntpdate.service: Main process |
45 |
exited, code=exited, status=1/FAILURE |
46 |
Mar 11 00:33:37 localhost systemd[1]: ntpdate.service: Failed with |
47 |
result 'exit-code'. |
48 |
Mar 11 00:33:37 localhost systemd[1]: Failed to start Set time via NTP |
49 |
using ntpdate. |
50 |
|
51 |
If i start by hand, after the system is up with "systemctl start ntpdate": |
52 |
|
53 |
* ntpdate.service - Set time via NTP using ntpdate |
54 |
Loaded: loaded (/lib/systemd/system/ntpdate.service; enabled; vendor |
55 |
preset: disabled) |
56 |
Drop-In: /etc/systemd/system/ntpdate.service.d |
57 |
`-00gentoo.conf |
58 |
Active: active (exited) since Sun 2019-03-10 23:38:36 CET; 2s ago |
59 |
Process: 5093 ExecStart=/usr/sbin/ntpdate -b -u $SERVER (code=exited, |
60 |
status=0/SUCCESS) |
61 |
Main PID: 5093 (code=exited, status=0/SUCCESS) |
62 |
|
63 |
Mar 11 00:37:59 localhost systemd[1]: Starting Set time via NTP using |
64 |
ntpdate... |
65 |
Mar 10 23:38:36 localhost ntpdate[5093]: 10 Mar 23:38:36 ntpdate[5093]: |
66 |
step time server 162.23.41.10 offset -3573.367681 sec |
67 |
Mar 10 23:38:36 localhost systemd[1]: Started Set time via NTP using |
68 |
ntpdate. |
69 |
|
70 |
also the result here looks different ( journalctl -ab -u ntpdate) by |
71 |
executing manually: |
72 |
|
73 |
Mar 10 23:38:36 localhost ntpdate[5093]: 10 Mar 23:38:36 ntpdate[5093]: |
74 |
step time server 162.23.41.10 offset -3573.367681 sec |
75 |
Mar 10 23:38:36 localhost systemd[1]: Started Set time via NTP using |
76 |
ntpdate. |
77 |
|
78 |
then everything looks fine... |
79 |
|
80 |
|
81 |
Any ideas ? |
82 |
|
83 |
|
84 |
best, Tamer |
85 |
|
86 |
On 10.03.19 22:36, Rich Freeman wrote: |
87 |
> On Sun, Mar 10, 2019 at 5:16 PM Tamer Higazi <th982a@××××××××××.com> wrote: |
88 |
>> I have my gentoo system running with systemd. |
89 |
>> |
90 |
>> I figured out that ntpdate is getting started before network is up. |
91 |
>> I am not yet very familiar with systemd. |
92 |
>> |
93 |
>> Can somebody of you tell me how to fix that, that "ntpdate" is started |
94 |
>> the moment network devices are up ? |
95 |
>> |
96 |
> How is ntpdate being run? If you're using the supplied unit then it |
97 |
> should default to starting after network-online.target, which if |
98 |
> you're using a network manager started by systemd should delay it |
99 |
> until the network is running. |
100 |
> |
101 |
> Now, if you're starting ntpdate in some other way then you'd need to |
102 |
> make sure that the network is online, and if you're starting the |
103 |
> network without using a supplied systemd unit then you'd need to make |
104 |
> sure systemd is aware of when it is up. |
105 |
> |
106 |
> Basically, it should just work for the most part if you're using the |
107 |
> supplied units, but you don't mention much about your configuration |
108 |
> and Gentoo users do have a tendency to roll up their sleeves and do |
109 |
> things in scripts/etc. |
110 |
> |
111 |
> The output of something like "systemctl status ntpdate" or "journalctl |
112 |
> -ab -u ntpdate" might be helpful. I'm not sure how you're configuring |
113 |
> your network (networkd, etc)? That would also be useful to know, as |
114 |
> well as the journal log for the associated units. |
115 |
> |
116 |
> Systemd is highly dependency-driven and parallel, so issues like this |
117 |
> are mostly the result of failing to declare a dependency somewhere |
118 |
> (either on the network side or the ntp side). If you're using openrc |
119 |
> in parallel mode you need to do the same, and again that should be |
120 |
> taken care of out of the box if you're using the supplied services, |
121 |
> but if you roll your own you also have to be careful. |
122 |
> |