I want dhcpcd to activate automatically on the wlan0 interface when I plug in my USB WiFi device.
Approach:
I modified the systemd service (dhcpcd@.service) according to https://wiki.archlinux.org/index.php/dhcpcd#Timeout_delay. If there is no USB WiFi device or if the device is unplugged, the service should run in the background and wait for the device to be plugged in.
Issue:
The systemd service stops with $this->bbcode_second_pass_code('', 'systemd[1]: dhcpcd@wlan0.service: Unit entered failed state.') and does not restart.
Logs, configuration, commands:
I unplugged a the already-configured USB WiFi device and plugged it back in. Here is the system log from that event and the relevant unit files for the systemd service: https://gist.github.com/anonymous/ee8c700383fe826ce72a.
Caveats:
- I am using the interface-specific dhcpcd service (dhcpcd@.service) to avoid the race condition with systemd-udevd (https://wiki.archlinux.org/index.php/dhcpcd#dhcpcd_and_systemd_network_interfaces).
- Simply enabling the interface-specific version of the service only activates dhcpcd at boot, and does not reactivate it if the USB WiFi device is plugged in after boot, or is removed and reinserted.
- I realize that the conflicting systemd-networkd is running at the same time as dhcpcd in the logs provided. However, this does not explain why the systemd service does not restart automatically. I have retried with systemd-networkd and systemd-resolved disabled to no avail.