You are not logged in.

#1 2019-01-22 16:26:05

no-cheating
Member
From: Poland
Registered: 2016-04-26
Posts: 61

network-online.target fired too early using netctl-auto

I'm trying to run a service reflector.service on a weekly basis (with timer). It needs to be run after internet connection is established, so the service requires network-online.target. My internet connection is managed by netctl. I'm connecting to one of the few configured wireless connections (profiles) using netctl-auto. I've enabled netctl-wait-online.service, expecting that it'll handle providing network-online.target in a proper moment - after any of nectl-auto profiles is successfully started.

Still it doesn't work like I expect it to, because reflector.service is fired before any of the wireless connections is established and returns an error.

Do you know how to fix that make reflector.service run correctly?

reflector.service
[Unit]
Description=Pacman mirrorlist update
Documentation=https://wiki.archlinux.org/index.php/Reflector
Requires=network-online.target
After=network-online.target

[Service]
Type=oneshot
EnvironmentFile=/usr/share/reflector-timer/reflector.conf
EnvironmentFile=-/etc/conf.d/reflector.conf
ExecStart=/usr/bin/reflector --age "$AGE" --country "${COUNTRY}" --latest "$LATEST" --number "$NUMBER" --sort "$SORT" --save /etc/pacman.d/mirrorlist "$PROTOCOL1" "$PROTOCOL2" "$PROTOCOL3"
reflector.timer
[Unit]
Description=Weekly pacman mirrorlist refresh

[Timer]
OnCalendar=weekly
Persistent=true
AccuracySec=1us
RandomizedDelaySec=12h

[Install]
WantedBy=timers.target
$ journalctl -b | egrep -i "wpa|network|netctl|mirrorlist|reflector"
ene 22 09:54:57 undostres-laptop systemd[1]: Created slice system-netctl\x2dauto.slice.
ene 22 09:54:57 undostres-laptop systemd[1]: Started Weekly pacman mirrorlist refresh.
ene 22 09:54:57 undostres-laptop systemd[1]: Starting Automatic wireless network connection using netctl profiles...
ene 22 09:54:57 undostres-laptop netctl-auto[521]: Included profile 'phone'
ene 22 09:54:57 undostres-laptop netctl-auto[521]: Included profile 'montse-2.4'
ene 22 09:54:57 undostres-laptop netctl-auto[521]: Included profile 'home'
ene 22 09:54:57 undostres-laptop netctl-auto[521]: Included profile 'montse-5'
ene 22 09:54:57 undostres-laptop netctl-auto[521]: Included profile 'undostres'
ene 22 09:54:58 undostres-laptop wpa_actiond[555]: Starting wpa_actiond session for interface 'wlp3s0'
ene 22 09:54:58 undostres-laptop audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=netctl-auto@wlp3s0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
ene 22 09:54:58 undostres-laptop systemd[1]: Started Automatic wireless network connection using netctl profiles.
ene 22 09:54:58 undostres-laptop systemd[1]: Reached target Network.
ene 22 09:54:58 undostres-laptop systemd[1]: Starting Wait for the enabled netctl profiles to come online...
ene 22 09:54:58 undostres-laptop systemd[1]: Started Wait for the enabled netctl profiles to come online.
ene 22 09:54:58 undostres-laptop audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=netctl-wait-online comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
ene 22 09:54:58 undostres-laptop systemd[1]: Reached target Network is Online.
ene 22 09:54:58 undostres-laptop systemd[1]: Starting Pacman mirrorlist update...
ene 22 09:54:58 undostres-laptop reflector[576]: error: failed to retrieve mirror data: (<urlopen error [Errno -3] Temporary failure in name resolution>)
ene 22 09:54:58 undostres-laptop systemd[1]: reflector.service: Main process exited, code=exited, status=1/FAILURE
ene 22 09:54:58 undostres-laptop systemd[1]: reflector.service: Failed with result 'exit-code'.
ene 22 09:54:58 undostres-laptop systemd[1]: Failed to start Pacman mirrorlist update.
ene 22 09:54:58 undostres-laptop audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=reflector comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
ene 22 09:55:02 undostres-laptop wpa_actiond[555]: Interface 'wlp3s0' connected to network 'CLICKONERO'

Last edited by no-cheating (2019-02-05 17:34:55)

Offline

Board footer

Powered by FluxBB