Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#70067 - boot: systemd network dependency problem

Attached to Project: Arch Linux
Opened by Christophe Réquillart (crequill) - Thursday, 18 March 2021, 18:25 GMT
Last edited by Christian Hesse (eworm) - Friday, 19 March 2021, 08:37 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Christian Hesse (eworm)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Some systemd services with network access are not started after a reboot (nrpe or snmpd or nfs mount). For example nrpe, the error is:
mars 18 16:52:18 nrpe[386]: Cannot bind to any address.
mars 18 16:52:18 nrpe[386]: Bind to port 5666 on X.X.Y.Z failed: Cannot assign requested address.
mars 18 16:52:18 nrpe[386]: Starting up daemon

If I look the boot, I can see:
mars 18 16:52:34 systemd[1]: Reached target Network is Online.

So why for example nrpe is launched 16 s. before network is up? It seems systemd change network.target dependency now to network-online.target. But all services are not updated.

Additional info:
* package version(s) : systemd 247.4-2, nrpe 4.0.3-1
* package used to get the network up is systemd-networkd


Steps to reproduce:
reboot
This task depends upon

Closed by  Christian Hesse (eworm)
Friday, 19 March 2021, 08:37 GMT
Reason for closing:  Not a bug
Additional comments about closing:  specific configuration
Comment by Christian Hesse (eworm) - Thursday, 18 March 2021, 21:48 GMT
I checked snmpd.service and nrpe service, both have `After=network.target` for ordering, but no `Requires=network.target` to pull in the dependency.
Is the target active on your system? Does it help to require the target?
Comment by Christophe Réquillart (crequill) - Friday, 19 March 2021, 06:48 GMT
Yes network.target is active at 16:52:18!. I will test requires.

# systemctl status network.target
● network.target - Network
Loaded: loaded (/usr/lib/systemd/system/network.target>
Active: active since Thu 2021-03-18 16:52:18 CET; 14h>
Docs: man:systemd.special(7)
https://www.freedesktop.org/wiki/Software/sys>;

mars 18 16:52:18 systemd[1]: Reached target Network.
Comment by Christian Hesse (eworm) - Friday, 19 March 2021, 06:57 GMT
Oh, and another thought: Are your services configured to listen on a specific ip address?
With network.target just basic network functionality is available, so services can bind to ::/0 or 0.0.0.0/0 - if you want to bind to a specific ip address configured on an interface you have to use network-online.target. In that case just create drop-in configuration for your services, for example /etc/systemd/system/smtpd.service.d/network-online.conf:

[Unit]
Requires=network-online.target
After=network-online.target

Alternatively just bind to all addresses an configure your firewall to allow traffic from specific interface or address only.
Comment by Christophe Réquillart (crequill) - Friday, 19 March 2021, 08:26 GMT
I have tested with Requires=network.target, same problem.
So I test with After=syslog.target network-online.target for snmpd.service (I don't see your comments before). I have rebooted and snmpd.service is up.
Yes my services are configured to listen on a specific ip address, for example in snmpd.conf, agentaddress is configured with two addresses.
So for me, all services with network.target as dependency must be modified with network-online.target dependency.
Comment by Christian Hesse (eworm) - Friday, 19 March 2021, 08:36 GMT
Looks like, yes. But this is not a systemd issue as it depends on your configuration.

Loading...