[systemd-devel] Starting a service before any networking
Mantas Mikulėnas
grawity at gmail.com
Tue Sep 26 12:44:42 UTC 2023
On Tue, Sep 26, 2023, 15:32 Mark Rogers <mark at more-solutions.co.uk> wrote:
> On Tue, 26 Sept 2023 at 13:08, Mantas Mikulėnas <grawity at gmail.com> wrote:
>
>> Depends on what exactly runs dhcpcd and wpa_supplicant. Is that done by
>> networking.service (ifupdown)? NetworkManager? Are they standalone services?
>>
>
> How do I tell?
>
Run `systemctl status <pid>` or browse `systemd-cgls` to map a process to
its .service unit.
> (System is a Pi running an elderly Raspbian. The issue I am having is that
> the device is not getting an IP address - if i wait until booted I have to
> issue "ip link set eth0 down" and "ip link set eth0 up" to get it to retry
> the DHCP request
>
("up" alone isn't sufficient, despite "ip addr" showing the interface as
> DOWN.
>
I think you're confusing two different states, which have similar
indications – "administrative" up/down that you control (the "<UP>" flag,
with nothing shown when down) and "operational" up/down that represents the
actual interface status (the "<RUNNING>" vs "<NO_CARRIER>" flags and/or the
"state XXX" field).
"state DOWN" is *not* directly controlled by `ip link set up` – it's the
result of the interface being operative for any other reason even though it
is administratively <UP> (i.e. turned on).
I'm still not entirely sure of the situation but right now it sounds like
the configuration is okay but the Ethernet interface is failing to
establish a physical link on the first try. Does it also show
"<UP,NO_CARRIER>" within the interface flags?
I am assuming that this is because the config file isn't in place when
> dhcpcd starts but I may be mistaken.)
>
>
>> I would generally expect Before/Wants=network-pre.target to work, but
>> that relies on your network services themselves being set up correctly –
>> they too need to order themselves After that target.
>>
>
> In that case I should probably return to Before/Wants=network-pre.target
> and work out what is breaking it, but same question as above: how do I
> figure that out?
>
`systemctl cat` for direct configuration and `systemctl list-dependencies
--after` (if I remember it right) should be a good start.
> --
> Mark Rogers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20230926/5eda8e0f/attachment.htm>
More information about the systemd-devel
mailing list