1

I have some custom service, which is relies on network-online.target

NetworkManager removed. chkconfing network on replaces it.

Service have

In journalctl -b I don't see network-online happen (as on Fedora 20 for example)

Jun 07 09:52:04 sssd[pam][822]: Starting up
Jun 07 09:52:04 sssd[nss][821]: Starting up
Jun 07 09:52:04 systemd-logind[846]: New seat seat0.
Jun 07 09:52:04 systemd-logind[846]: Watching system buttons on /dev/input/event0 (Power Button)
Jun 07 09:52:04 network[762]: Bringing up loopback interface:  [  OK  ]
Jun 07 09:52:04 systemd-networkd-wait-online[803]: ignore irrelevant link: lo
Jun 07 09:52:04 kernel: bnx2 0000:01:00.0 eno1: using MSIX
Jun 07 09:52:04 systemd-networkd-wait-online[803]: ignore irrelevant link: lo
Jun 07 09:52:04 systemd-networkd-wait-online[803]: ignore irrelevant link: lo
Jun 07 09:52:04 systemd-networkd-wait-online[803]: ignore irrelevant link: lo
Jun 07 09:52:08 kernel: bnx2 0000:01:00.0 eno1: NIC Copper Link is Up, 1000 Mbps full duplex
Jun 07 09:52:08 kernel:
Jun 07 09:52:08 systemd-networkd-wait-online[803]: ignore irrelevant link: lo
Jun 07 09:52:08 systemd-networkd[773]: eno1            : gained carrier
Jun 07 09:52:08 systemd-networkd-wait-online[803]: ignore irrelevant link: lo
Jun 07 09:52:08 systemd-networkd-wait-online[803]: ignore irrelevant link: lo
Jun 07 09:52:08 network[762]: Bringing up interface eno1:  [  OK  ]
Jun 07 09:52:08 kernel: sfc 0000:03:00.0 sfn0p1: link up at 10000Mbps full-duplex (MTU 1500)
Jun 07 09:52:08 network[762]: Bringing up interface sfn0p1:  [  OK  ]
Jun 07 09:52:08 kernel: sfc 0000:03:00.1 sfn0p2: link up at 10000Mbps full-duplex (MTU 1500)
Jun 07 09:52:09 network[762]: Bringing up interface sfn0p2:  [  OK  ]
Jun 07 09:52:09 kernel: 8021q: 802.1Q VLAN Support v1.8
Jun 07 09:52:09 systemd-networkd[773]: sfn0p1.1273     : gained carrier
Jun 07 09:52:09 systemd-networkd[773]: sfn0p1          : gained carrier
Jun 07 09:52:09 systemd-networkd[773]: sfn0p2          : gained carrier
Jun 07 09:52:13 network[762]: Bringing up interface sfn0p1.1273:  [  OK  ]
Jun 07 09:52:13 systemd-networkd[773]: sfn0p1.1373     : gained carrier
Jun 07 09:52:17 network[762]: Bringing up interface sfn0p1.1373:  [  OK  ]
Jun 07 09:52:17 systemd-networkd[773]: sfn0p2.2273     : gained carrier
Jun 07 09:52:21 network[762]: Bringing up interface sfn0p2.2273:  [  OK  ]
Jun 07 09:52:21 systemd-networkd[773]: sfn0p2.2373     : gained carrier
Jun 07 09:52:25 network[762]: Bringing up interface sfn0p2.2373:  [  OK  ]
Jun 07 09:52:25 sm-notify[1464]: Version 1.3.1 starting
Jun 07 09:52:25 crond[1487]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 27% if used.)
Jun 07 09:52:25 crond[1487]: (CRON) INFO (running with inotify support)
Jun 07 09:52:25 sshd[1465]: Server listening on 0.0.0.0 port 22.
Jun 07 09:52:33 ntpdate[1477]: Can't find host time.mycorp.co: Name or service not known (-2)

systemctl enable systemd-networkd-wait-online.service - enabled, no help. network-online.target - also

# systemctl status network-online.target
● network-online.target - Network is Online
   Loaded: loaded (/usr/lib/systemd/system/network-online.target; enabled)
   Active: active since Tue 2016-06-07 09:52:25 EDT; 13min ago
     Docs: man:systemd.special(7)
           http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget

Service file is located in /etc/systemd/system/ntpdate.service

[Unit]
Description=Set time via NTP
After=network-online.target
Before=time-sync.target ntpd.service
Requires=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/libexec/ntpdate-wrapper
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

How do I make this ntpdate start only when network is really available ? Because if it starts too early -

Jun 07 09:52:33 ntpdate[1477]: Can't find host time.mycorp.co: Name or service not known (-2)
Jun 07 09:52:33 ntpdate[1477]: no servers can be used, exiting
Jun 07 09:52:33 systemd[1]: ntpdate.service: main process exited, code=exited, status=1/FAILURE
Jun 07 09:52:33 systemd[1]: Failed to start Set time via NTP.
Jun 07 09:52:33 systemd[1]: Dependency failed for Network Time Service Daemon.
Jun 07 09:52:33 systemd[1]: Unit ntpdate.service entered failed state.
Jun 07 09:52:33 systemd[1]: ntpdate.service failed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.