You are not logged in.
https://wiki.archlinux.org/title/System … work_is_up contains a section with this text:
For nss-lookup.target to have any effect it needs a service that pulls it in via Wants=nss-lookup.target and orders itself before it with Before=nss-lookup.target.
My Arch doesn't use a networking manager. It does use dhcpcd.
It looks like my systemd unit file is started before the nss resolver is functioning.
I used:
[Unit]
Wants=network-online.target nss-lookup.target
After=network.target network-online.target
Before=nss-lookup.targetAny hint is welcome to how to make my unit file start after the dns-resolver is up and running.
Last edited by probackup-nl (2023-04-18 08:10:45)
Offline
If you're using dhcpcd and no local DNS server, you'll likely be more interested in having obtained a lease (because your DNS server is either provided via dhcp or statically configured, but cannot be accessed before having a lease)?
You could loop ping in ExectStartPre until the desired host is reachable, https://bbs.archlinux.org/viewtopic.php … 7#p2090547
Offline
You could loop ping in ExectStartPre until the desired host is reachable, https://bbs.archlinux.org/viewtopic.php … 7#p2090547
I tried:
[Unit]
Description=Xwall spam filter
Requires=network-online.target clamav-daemon.socket
After=network.target network-online.target clamav-daemon.socket
[Service]
Type=simple
User=user
Group=user
ExecStartPre=/usr/bin/ping -qW 15 -c1 www.nu.nl
Environment="WINEDLLOVERRIDES=explorer.exe,services.exe=d"
ExecStart=/usr/sbin/wine "/home/user/mbserver.exe"
TimeoutStopSec=120
RestartSec=30
Restart=always
[Install]
WantedBy=multi-user.targetThe result seems a problem with the ExecStartPre "ping" command:
# systemctl status xwall.service
● xwall.service - Xwall spam filter
Loaded: loaded (/etc/systemd/system/xwall.service; enabled; preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Sat 2023-04-15 20:43:11 CEST; 23s ago
Process: 231 ExecStartPre=/usr/bin/ping -qW 15 -c1 www.nu.nl (code=exited, status=2)
CPU: 22ms
Apr 15 20:43:11 host.domain.tld systemd[1]: xwall.service: Control process exited, code=exited, status=2/INVALIDARGUMENT
Apr 15 20:43:11 host.domain.tld systemd[1]: xwall.service: Failed with result 'exit-code'.Offline
The domain can probably not be resolved at this point.
Either ping an IP or, if you really rely on late DNS, don't ping but loop "getent ahosts www.nu.nl" until it succeeds.
Offline
loop "getent ahosts www.nu.nl" until it succeeds.
For now I have chosen this getent loop:
ExecStartPre=/usr/bin/bash -c 'until /usr/sbin/getent ahosts test-for-dns-resolve.dataenter.co.at > /dev/null; do sleep 1; done'Offline