I wonder if we could downgrade the "Requires=sys-subsystem-net-devices-XXX.device" to a "Wants=sys-subsystem-net-devices-XXX.device" and add an additional triggering condition on the sysfs path ("ConditionPathExists=|/sys/subsystem/net/devices/XXX"). AFAIU this way the wpa_supplicant unit should fail immediately, if the devices (& its sysfs path) is not there but start as soon as the dongle is plugged in.
Thanks for this investigation! This issue has been discussed in multiple places, like here where a udev rule is recommended: https:/ /github. com/systemd/ systemd/ issues/ 2891
I wonder if we could downgrade the "Requires= sys-subsystem- net-devices- XXX.device" to a "Wants= sys-subsystem- net-devices- XXX.device" and add an additional triggering condition on the sysfs path ("ConditionPath Exists= |/sys/subsystem /net/devices/ XXX"). AFAIU this way the wpa_supplicant unit should fail immediately, if the devices (& its sysfs path) is not there but start as soon as the dongle is plugged in.
https:/ /systemd. network/ systemd. unit.html# Conditions% 20and%20Asserts
I guess this needs some experimentation to fully understand the side-effects.