On Mon, Jan 06, 2025 at 01:08:03 -0500, Paul Menzel wrote: > Currently, if there is no network connecting during this time, the > service is shown as failed. That downloading the metadata is not > possible with no network connection is expected in my opinion, so the > service should not be shown as failed [1]. Do you have a recommendation https://systemd.io/NETWORK_ONLINE/ https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ This seems to be just the standard case. Think about these: 1. only the system admin can decide what does "online" mean, i.e. which interface and in what state assures "connectivity". In the most basic case, any/the single interface that acquired IP meets the requirements, otherwise it might be some VPN interface being active or the contrary - just the network interfaces set up (even before carrier up) for the servers to bind sockets (ConfigureWithoutCarrier=yes). For the clients' (non-server) setups this often means using Wants/After=systemd-networkd-wait-online@.service https://www.freedesktop.org/software/systemd/man/latest/systemd-networkd-wait-online.service.html 2. The service unit can provide defaults to handle that situation, e.g.: Restart=on-failure StartLimitInterval=0 RestartSec=20 3. The "truly online" condition can never be checked locally, as your router might be offline, and even with upstream there might be some selective routing issues, finally only the server you try to connect can fail. There was also "systemd-networkd-wait-online doesn't wait for DNS" last month worth mentioning. In the general case you can do nothing except retrying later or ignoring. But as the service was run and didn't succeed, it _is_ failed. > how to deal with this? Should `/usr/bin/fwupdmgr refresh` return a > special exit code in this case, or should a condition be added? What > would be used for the condition as different network manager can be used > like NetworkManager or systemd-networkd. You should actually do the both: 1. postpone service start after the system being (locally-administered) "online" (which is only best-effort kind of condition), 2. Treat this "special exit code" as a trigger for restarting (if expected), via RestartForceExitStatus= - _IF_ you can distinguish error conditions that should and should not issue restarts. Some temporary errors can be detected, like timeout or SERVFAIL response from DNS (in contrary to NXDOMAIN, which is permanent one). To be more specific: https://pubs.opengroup.org/onlinepubs/009696799/functions/getnameinfo.html - these seem to be "temporary": EAI_AGAIN EAI_MEMORY EAI_SYSTEM Note, that DNS temporary errors might be interpreted as "not-so-online yet". -- Tomasz Pala <gotar@xxxxxxxxxxxxx>