0

I followed Ingo's excellent description how to set up the Pi (running latest, fresh version of buster) as an access point, routing to either a wifi dongle or an umts-stick. Everything works, except one issue:

  • when connecting just the wifi dongle, system comes up immediately.
  • when connecting just the umts stick system needs >60sec to come up.

Using journalctl I see that systemd waits for the wpa_supplicant job trying to setup the (non-connected) wifi dongle and times out after about 60sec. My internet search pointed to "systemd-networkd-wait-online.service" and modifying timeouts etc. - however this service seems not to be active/used on buster.

Any hints?

UPDATE with information from a comment:
Configuration was made for both the wifi dongle and the UMTS-stick and both of them work fine as an uplink. I am using it on a boat and only connect one of them at a time depending on the availability of a wifi hotspot or the necessity to use UMTS. The only issue is that when I connect just the UMTS-stick and leave the wifi dongle unconnected systemd (wpa_supplicant) hangs until timing out after about 90 sec and the whole startup process is delayed. I could not find a way in the configuration to reduce the delay or make the wifi dongle "optional".

UPDATE2: The issue of the startup delay is NOT related to the UMTS-Stick. Same occurs when neither wifi dongle nor UMTS-stick is connected as an uplink and immediately goes away when the wifi dongle is connected (regardless of the UMTS-stick being connected or not). Journalctl clearly shows wpa_supplicant waiting for the uplink on the (in that case not connected) wifi dongle as the cause of the delay until it messages a timeout after about 90sec. The reference to systemd-networkd-wait-online.service as causing this did not help as this service is not even active (according to systemctl status) - which I only realized after the referenced settings did not make any difference. Info about the UMTS-Stick: It is a Huawei E300 which registers automatically as an ethernet device (eth1) and (according to journcalctl) comes up a few seconds after boot. Coniguration is thus extremely trivial. Just this .network file:

    [Match]
    Name=eth1
    [Network]
    DNS=84.200.69.80 8.8.8.8 1.1.1.1
    DHCP=ipv4
tbue
  • 3
  • 2

1 Answers1

1

I refer to the tutorial you have used at Access point as WiFi router/repeater with additional WiFi-dongle.

From all given information we can extract the problem. With detached USB/WiFi dongle systemd is trying to initialize its interface wlan1 without success and is waiting 90 seconds on startup before timing out. You will see these messages on the text console:

[ .... ] A start job is running for /sys/sub…net/devices/wlan1 (46s / 1min 30s)
[ TIME ] Timed out waiting for device /subsystem/net/devices/wlan1.
[DEPEND] Dependency failed for WPA … (interface-specific version).

This is ennoying because it involves the whole boot process and has nothing to do with other services except device /subsystem/net/devices/wlan1.

If we look at the service that should start the USB/WiFi dongle we find:

rpi ~$ systemctl cat wpa_supplicant@wlan1.service
# /etc/systemd/system/wpa_supplicant@wlan1.service
[Unit]
Description=WPA supplicant daemon (interface-specific version)
Requires=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
Before=network.target
Wants=network.target

NetworkManager users will probably want the dbus version instead.

[Service] Type=simple ExecStart=/sbin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -Dnl80211,wext -i%I

[Install] Alias=multi-user.target.wants/wpa_supplicant@%i.service

With the option Requires=sys-subsystem-net-devices-%i.device systemd will wait until timeout and then will never start the service. This is the generic method to check availability of an interface. But in this case we can just let wpa_supplicant check this. We only have to ensure that the unit is started after the network is up and wpa_supplicant can do its work and may fail if its interface isn't available. Just edit the service:

rpi ~$ sudo systemctl edit --full wpa_supplicant@wlan1.service

and replace only the complete [Unit] section with:

[Unit]
Description=WPA supplicant daemon (interface-specific version)
After=network.target

After a reboot without USB/WiFi dongle attached and no timeout wait you will not have a wlan1 interface anymore and systemctl status wpa_supplicant@wlan1.service shows you that the service was started but failed because wpa_supplicant complains: Could not read interface wlan1 flags: No such device.

Ingo
  • 42,961
  • 20
  • 87
  • 207