Re: [chrony-users] NetworkManager dispatcher script(20-chrony) not working on systemd-networkd

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


Thank you for answering.

> I don't follow. Doesn't the routable state follow configured? Why
> would it need to be called twice?

> Do you have an example sequence of the events?

Below is log of the networkd-dispatcher environment variables when the 20-chrony script(linked in the routable.d & off.d) is called during boot.

IFACE: eth1, STATE: off, AdministrativeState: unmanaged, OperationalState: off
IFACE: eth0, STATE: routable, AdministrativeState: configuring, OperationalState: routable
IFACE: eth0, STATE: routable, AdministrativeState: configuring, OperationalState: routable (The last time 20-chrony is called)
I don't know why, but if the script was called when the interface was in the configuring state, even if it was in the routable state, the sources were taken offline.
(Although not printed in the log, the eth0 interface is eventually in the configured state, and then the source is in the online state when I run the 'chronyc onoffline' command.)

FYI, below is the log of other servers without the problem.

IFACE: eth1, STATE: off, AdministrativeState: unmanaged, OperationalState: off
IFACE: eth0, STATE: routable, AdministrativeState: configured, OperationalState: routable


> Isn't this missing the "off" state?

It was a test script, so I didn't pay much attention to it.

Based on your answer, it sounds like simply creating a link under the configured.d directory without any script modifications would solve the problem.

Thanks for your help.



2023년 6월 14일 (수) 오후 5:46, Miroslav Lichvar <mlichvar@xxxxxxxxxx>님이 작성:
On Wed, Jun 14, 2023 at 04:44:50PM +0900, Jongkyu Seok wrote:
> Because networkd-dispatcher uses specific environment variables to pass
> interface state, nothing exists in the shell argument of dispatcher script.
>
> Because of this, the '[ $# -ge 2]' condition in the existing
> NetworkManager-based script (20-chrony) was always FALSE, causing the
> 'chronyc onoffline' command to be executed regardless of the type of
> interface event.

That condition is there for the case when running as a NetworkManager
dispatcher script. As a networkd-dispatcher script it is expected to
always make the chronyc command when the script is executed, i.e. on
the routable and off events if linked in the routable.d and off.d
directories.

> And crucially, the script did not exist in the
> /usr/lib/networkd-dispatcher/configured.d/ directory, so the last time
> 'chronyc onoffline' was run when the interface was in the configuring
> state, the source was taken offline.

I don't follow. Doesn't the routable state follow configured? Why
would it need to be called twice?

Do you have an example sequence of the events?

> # Note: for networkd-dispatcher routable.d ~= on and off.d ~= off
>
> [ "$STATE" != "routable" ] && [ "$AdministrativeState" != "configured" ] &&
> exit 0

Isn't this missing the "off" state?

--
Miroslav Lichvar


--
To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx
with "unsubscribe" in the subject.
For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx
with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/