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
  • With the given information it isn't possible to understand the problem. With an additional USB/WiFi dongle it works as expected? Then you replaced that dongle with an UMTS-stick and expect that it also works without any modifications? That is a complete different piece of hardware and needs different drivers and configuration, isn't it? – Ingo Jun 22 '21 at 22:13
  • Sorry for being cryptic. Of course 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". – tbue Jun 23 '21 at 07:57
  • Please next time add additional information to the question and do not use comments to elaborate the question. – Ingo Jun 23 '21 at 09:25

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
  • 40,606
  • 15
  • 76
  • 189
  • Thanks for the reply. I had already found the reference to systemd-networkd-wait-online.service. Tried both reducing timeout and excluding the wifi interface according to the description to no avail until I realized that - according to systemctl status - this service is not even active. The "UMTS-Stick UP" is not the issue, it is up. It is systemd blocking the desktop from coming up until the timeout occurs waiting for the (then non connected) wlan1 that I want to fix. Any other details I should provide to help explain? – tbue Jun 23 '21 at 09:50
  • @tbue Please [Edit](https://raspberrypi.stackexchange.com/posts/127630/edit) your question and add the output of this commands to it: `ip addr` and `ip route`. What is the name of the service that starts the UMTS-Stick? How do you install the connection program of it? Please also add the `*.network` file to the question that configures the UMTS interface. – Ingo Jun 25 '21 at 08:16
  • Ingo, thanks again. Still learning how to use this site properly... I now edited the question. I strongly believe this has nothing to do with the UMTS-stick (see my remarks in update2 in the question). – tbue Jun 25 '21 at 09:35
  • @tbue I have rewritten the answer. – Ingo Jun 28 '21 at 01:10
  • Vielen Dank! Thank your for the fix and the explanation what was actually going on! – tbue Jun 29 '21 at 12:35
  • @tbue If this fix your problem it would be nice if you could accept the answer with a click on the tick on its left side. This will finish the question and show others that is has a solution and it will not pop up again annoying us to look for an answer it already has. – Ingo Jun 30 '21 at 07:13