[00:29] <Jared> has anyone successfully configured a static ip on a raspberry pi running ubuntu 20.01 using the netplan "network-config" file? I can't get it working
[00:35] <jallen2281> has anyone successfully configured a static ip on a raspberry pi running ubuntu 20.01 using the netplan "network-config" file? I can't get it working
[00:35] <jallen2281> Even when there aren't any errors, the ip doesn't apply
[08:04] <slyon> kjetilho: Yes. It mostly uses .network/.netdev/.link units, though. I'm not sure if those are visible in systemctl, as those are not system services. "systemctl list-units | grep netplan" should show any WPA/OVS netplan service units. Information about the other services should be visible in "networkctl".
[08:06] <slyon> Also, the names should be pretty predictable: "run/systemd/network/10-netplan-<NETDEF_ID>.{network,netdev,link}" (where NETDEF_ID is the ID from the YAML file, most commonly an interface name like "ens3")
[11:11] <kjetilho> slyon: that's the thing - that grep returns zero lines. (don't know what WPA/OVS is, though)
[11:13] <slyon> kjetilho: yeah. It would only return some lines if you use wifi/wpa_supplicant (WPA) or OpenVSwitch (OVS) in netplan. The "normal" networking stuff does not use system services, but network services (run/systemd/system/ vs run/systemd/network/)
[11:13] <slyon> I'm not an systemd expert, so I'm not sure how you could depend on a 10-netplan-ens3.network service for example
[11:13] <kjetilho> so - is this a netplan or networkd deficiency?
[11:17] <slyon> IMO it's neither's deficiency. We just don't know how to make systemd wait for a device to appear... But this looks promising: https://unix.stackexchange.com/questions/257888/systemd-wait-for-network-interface-to-be-up-before-running-service (e.g. wait for "sys-devices-virtual-net-bond0.device")
[11:17] <slyon> did you try something like this already?
[11:32] <kjetilho> interface being up doesn't mean it is configured
[11:33] <kjetilho> although it should be OK usually when configured statically - there will be a race condition
[11:35] <kjetilho> netlink reports when IP addresses are loaded in the kernel, so if the .network unit was available, it should be usable.
[11:39] <kjetilho> I think I need to read up on systemd-networkd to know what needs fixing
[11:40] <ddstreet> if you want to make a service After= networking up generally at boot, use After=network-online.target and Wants=network-online.target
[11:41] <ddstreet> there is no way to depend per-interface on an interface being configured, and network-online.target only works at boot, it doesn't stop/restart services if an interface goes down later
[11:41] <ddstreet> generally you shouldn't stop/start services when individual interface(s) lose/gain carrier/configuration
[11:42] <ddstreet> you can use netlink if you really need to from inside your application to listen for specific interface changes
[11:46] <kjetilho> that's just an opinion - systemd supports lots of stuff which the application could just as easily do itself.  e.g, switch user, set rlimits, etc. etc.
[11:47] <ddstreet> i'm telling you how it currently works, feel free to implement per-interface-state unit files with upstream systemd ;-)
[11:47] <kjetilho> great :)