Sample Header Ad - 728x90

systemd-networkd-wait-online failing with SocketCAN interface

2 votes
1 answer
520 views
I have configured a SocketCAN interface, can0 (confirmed working using can-utils). I have the below .network config file, so that systemd-networkd brings up the interface on boot.
#/etc/systemd/network/80-can.network
[Match]
Name=can0

[CAN]
BitRate=250K
RestartSec=100ms

[Link]
Unmanaged=no
RequiredForOnline=yes
After a bootup, I can see that the interface is up (note UP flag set) with either
$ ip link show can0
5: can0:  mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 65536
    link/can
or
$ ifconfig can0
can0: flags=193  mtu 16
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 65536  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
I want to run a oneshot service after systemd-networkd brings the network up. Some searching indicates that I should modify the systemd-networkd-wait-online service to pass the flag -i [interface], which I've done as
$ sudo systemctl edit systemd-networkd-wait-online
#/etc/systemd/system/systemd-networkd-wait-online.service.d/override.conf
[Service]
ExecStart=
ExecStart=/lib/systemd/systemd-networkd-wait-online -i can0 --timeout=5
In my custom service I use
[Unit]
...
After=systemd-networkd-wait-online.service
Requires=systemd-networkd-wait-online.service
However, the systemd-networkd-wait-online fails on boot, and when I run the command in isolation it fails after timing out:
$ /lib/systemd/systemd-networkd-wait-online -i can0 --timeout=5
Event loop failed: Connection timed out
For comparison, it succeeds "instantly" when passing -i eth0. So, question(s): 1. Does systemd-networkd-wait-online even work with a SocketCAN interface? 2. If it does, what am I doing wrong? or 3. If it doesn't, what would be a functional way to trigger a service at some point after systemd-networkd has brought the interface up?
Asked by Joshua Voskamp (153 rep)
Sep 7, 2022, 06:45 PM
Last activity: Sep 7, 2023, 07:47 AM