[systemd-devel] Starting a service before any networking
Mark Rogers
mark at more-solutions.co.uk
Wed Sep 27 09:31:24 UTC 2023
On Wed, 27 Sept 2023 at 10:18, Mantas Mikulėnas <grawity at gmail.com> wrote:
> So now I'm curious: if the first command you run is to bring the interface
> *down*, then what exactly brought it up?
>
Good question. The reason for down/up was that this was working as a way to
reset the connection after boot, so I just transferred that to the
ExecStartPre.
Looking at the "journalctl -u dhcpcd" output, this is what I see from my
last boot:
Feb 14 10:12:05 pi systemd[1]: Starting dhcpcd on all interfaces...
Feb 14 10:12:05 pi ip[372]: 2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc
noop state DOWN group default qlen 1000
Feb 14 10:12:05 pi ip[372]: link/ether b8:27:eb:0d:ee:bb brd
ff:ff:ff:ff:ff:ff
Feb 14 10:12:05 pi ip[383]: 2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP>
mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
Feb 14 10:12:05 pi ip[383]: link/ether b8:27:eb:0d:ee:bb brd
ff:ff:ff:ff:ff:ff
Feb 14 10:12:06 pi dhcpcd[385]: wlan0: starting wpa_supplicant
Feb 14 10:12:36 pi dhcpcd[385]: timed out
Feb 14 10:12:36 pi systemd[1]: Started dhcpcd on all interfaces.
Feb 14 10:12:37 pi systemd[1]: Stopping dhcpcd on all interfaces...
Feb 14 10:12:37 pi dhcpcd[519]: sending signal TERM to pid 466
Feb 14 10:12:37 pi dhcpcd[519]: waiting for pid 466 to exit
Feb 14 10:12:38 pi systemd[1]: dhcpcd.service: Succeeded.
Feb 14 10:12:38 pi systemd[1]: Stopped dhcpcd on all interfaces.
Feb 14 10:12:38 pi systemd[1]: Starting dhcpcd on all interfaces...
Feb 14 10:12:38 pi ip[524]: 2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP>
mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
Feb 14 10:12:38 pi ip[524]: link/ether b8:27:eb:0d:ee:bb brd
ff:ff:ff:ff:ff:ff
Feb 14 10:12:38 pi ip[529]: 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu
1500 qdisc pfifo_fast state UP group default qlen 1000
Feb 14 10:12:38 pi ip[529]: link/ether b8:27:eb:0d:ee:bb brd
ff:ff:ff:ff:ff:ff
Feb 14 10:12:38 pi dhcpcd[530]: wlan0: starting wpa_supplicant
Feb 14 10:12:49 pi dhcpcd[530]: Too few arguments.
Feb 14 10:12:49 pi dhcpcd[530]: Too few arguments.
Feb 14 10:12:49 pi systemd[1]: Started dhcpcd on all interfaces.
(I deleted the "ip addr" output from the interfaces other than eth0 for
brevity.)
The interesting thing is surely that dhcpcd is being started twice.
Assuming that was always happening then that suggests dhcpcd was bringing
the network up early (and failing but leaving it in a "stuck" state) and
then again later (where it was unable to recover from the first failure,
but now can)?
--
Mark Rogers // More Solutions Ltd (Peterborough Office) // 0344 251 1450
Registered in England (0456 0902) 21 Drakes Mews, Milton Keynes, MK8 0ER
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20230927/bf4a8db3/attachment.htm>
More information about the systemd-devel
mailing list