You are not logged in.

#1 2021-08-23 16:12:00

evybongers
Member
Registered: 2021-04-07
Posts: 4

Systemd target network-online.target finishing early

If this is the wrong board, please let me know!

I have reflector installed on all of my systems and on two of my workstations the systemd service is started too early (before WiFi connection is established).

I traced the issue of the service starting early to a systemd target (network-online.target) returning early:

systemctl status reflector.service network-online.target NetworkManager-wait-online.service
× reflector.service - Refresh Pacman mirrorlist with Reflector.
     Loaded: loaded (/usr/lib/systemd/system/reflector.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Mon 2021-08-23 14:30:50 CEST; 18min ago
       Docs: https://wiki.archlinux.org/index.php/Reflector
    Process: 555 ExecStart=/usr/bin/reflector @/etc/xdg/reflector/reflector.conf (code=exited, status=1/FAILURE)
   Main PID: 555 (code=exited, status=1/FAILURE)
        CPU: 142ms

Aug 23 14:30:50 gadget systemd[1]: Starting Refresh Pacman mirrorlist with Reflector....
Aug 23 14:30:50 gadget reflector[555]: error: failed to retrieve mirrorstatus data: URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
Aug 23 14:30:50 gadget systemd[1]: reflector.service: Main process exited, code=exited, status=1/FAILURE
Aug 23 14:30:50 gadget systemd[1]: reflector.service: Failed with result 'exit-code'.
Aug 23 14:30:50 gadget systemd[1]: Failed to start Refresh Pacman mirrorlist with Reflector..

● network-online.target - Network is Online
     Loaded: loaded (/usr/lib/systemd/system/network-online.target; static)
     Active: active since Mon 2021-08-23 14:30:50 CEST; 18min ago
       Docs: man:systemd.special(7)
             https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget

Aug 23 14:30:50 gadget systemd[1]: Reached target Network is Online.

● NetworkManager-wait-online.service - Network Manager Wait Online
     Loaded: loaded (/usr/lib/systemd/system/NetworkManager-wait-online.service; enabled; vendor preset: disabled)
     Active: active (exited) since Mon 2021-08-23 14:30:50 CEST; 18min ago
       Docs: man:nm-online(1)
    Process: 535 ExecStart=/usr/bin/nm-online -s -q (code=exited, status=0/SUCCESS)
   Main PID: 535 (code=exited, status=0/SUCCESS)
        CPU: 15ms

Aug 23 14:30:49 gadget systemd[1]: Starting Network Manager Wait Online...
Aug 23 14:30:50 gadget systemd[1]: Finished Network Manager Wait Online.

I have this setup configured on three systems (two laptops and a bare bone pc), all of which use WiFi. On one system it works as expected, on the other two nm-online returns within a second, before a WiFi connection is established. Because it works on one system, I believe that it's a configuration/setup issue, but I can't think of what might be the cause.

For reference, this is status for the respective services on the laptop where it does work. Note that here NetworkManager-wait-online.service takes several more seconds to return.

systemctl status reflector.service network-online.target NetworkManager-wait-online.service
○ reflector.service - Refresh Pacman mirrorlist with Reflector.
     Loaded: loaded (/usr/lib/systemd/system/reflector.service; enabled; vendor preset: disabled)
     Active: inactive (dead) since Mon 2021-08-23 18:04:09 CEST; 6min ago
       Docs: https://wiki.archlinux.org/index.php/Reflector
    Process: 465 ExecStart=/usr/bin/reflector @/etc/xdg/reflector/reflector.conf (code=exited, status=0/SUCCESS)
   Main PID: 465 (code=exited, status=0/SUCCESS)
        CPU: 3.223s

Aug 23 18:03:29 tigger systemd[1]: Starting Refresh Pacman mirrorlist with Reflector....
Aug 23 18:04:09 tigger systemd[1]: reflector.service: Deactivated successfully.
Aug 23 18:04:09 tigger systemd[1]: Finished Refresh Pacman mirrorlist with Reflector..
Aug 23 18:04:09 tigger systemd[1]: reflector.service: Consumed 3.223s CPU time.

● network-online.target - Network is Online
     Loaded: loaded (/usr/lib/systemd/system/network-online.target; static)
     Active: active since Mon 2021-08-23 18:03:29 CEST; 7min ago
       Docs: man:systemd.special(7)
             https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget

Aug 23 18:03:29 tigger systemd[1]: Reached target Network is Online.

● NetworkManager-wait-online.service - Network Manager Wait Online
     Loaded: loaded (/usr/lib/systemd/system/NetworkManager-wait-online.service; enabled; vendor preset: disabled)
     Active: active (exited) since Mon 2021-08-23 18:03:29 CEST; 7min ago
       Docs: man:nm-online(1)
    Process: 383 ExecStart=/usr/bin/nm-online -s -q (code=exited, status=0/SUCCESS)
   Main PID: 383 (code=exited, status=0/SUCCESS)
        CPU: 98ms

Aug 23 18:03:17 tigger systemd[1]: Starting Network Manager Wait Online...
Aug 23 18:03:29 tigger systemd[1]: Finished Network Manager Wait Online.

Any help would be appreciated.

Offline

#2 2021-08-23 16:18:54

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,707

Re: Systemd target network-online.target finishing early

Try a drop-in for NetworkManager-wait-online which removes the -s option. If I'm reading that right it will only properly work with system connections and seems to generally be a weird default. Note the examples you will have to specify ExecStart= once as empty to actually override the cmdline being invoked.

As for differences without that change. Is the general environment/the tool you used to setup the connection the same between these systems?

Last edited by V1del (2021-08-23 16:19:31)

Offline

#3 2021-08-23 18:45:50

evybongers
Member
Registered: 2021-04-07
Posts: 4

Re: Systemd target network-online.target finishing early

All three systems have a near identical setup: mainline kernel ('linux' package), greetd, sway, NetworkManager. One laptop has disk encryption enabled, the other laptop has a unified kernel image. As I'm typing this, I'm wondering if the unified kernel image could have an effect on it, as that's the laptop where it works as expected. It's also the only system that has the efi system partition mounted on /efi, whereas for the others it's on /boot.

Offline

#4 2021-08-23 20:15:14

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,707

Re: Systemd target network-online.target finishing early

Yes and which tool did you use to setup the connection to your network? Check whether the working one is configured as "system connection" as that will lead to credentials being stored in a root accessible directory that NM can directly query, otherwise there might be some other mechanism at play for accessing the network secrets, which could lead to this logical delay.

Last edited by V1del (2021-08-23 20:15:22)

Offline

#5 2021-09-22 23:17:03

Cvlc
Member
Registered: 2020-03-26
Posts: 273

Re: Systemd target network-online.target finishing early

Hi,

Had a similar issue when I changed the NM backend from wpa_supplicant to iwd. Removing the -s switch from the service solved it for me.

Offline

Board footer

Powered by FluxBB