FS#50441 - [keepalived] Starts before the network is running
Attached to Project:
Community Packages
Opened by Bill Mair (red-lichtie) - Friday, 19 August 2016, 00:45 GMT
Last edited by Sébastien Luttringer (seblu) - Sunday, 27 November 2016, 03:23 GMT
Opened by Bill Mair (red-lichtie) - Friday, 19 August 2016, 00:45 GMT
Last edited by Sébastien Luttringer (seblu) - Sunday, 27 November 2016, 03:23 GMT
|
Details
Description:
The keepalived.service is started before the network is up. The Unit declaration "After=network.target" isn't sufficient. I changed the default behaviour using "systemctl edit keepalived.service" and added: [Unit] Requires=network-online.target After=network-online.target I think that this change should be the default requirement in "/usr/lib/systemd/system/keepalived.service" |
This task depends upon
Closed by Sébastien Luttringer (seblu)
Sunday, 27 November 2016, 03:23 GMT
Reason for closing: Fixed
Additional comments about closing: keepalived-1.3.2-1
Sunday, 27 November 2016, 03:23 GMT
Reason for closing: Fixed
Additional comments about closing: keepalived-1.3.2-1
The same applies to shutdown, without networking it can't shutdown and handoff any services and VIPs that it is managing if the devices are taken offline before it is stopped.
Networking has to be a "Required" service.
Debian also has networking as a requirement:
# Required-Start: $syslog $network $remote_fs
# Required-Stop: $syslog $network $remote_fs
The network adapter configuration hasn't completed before keepalived is started.
I removed my change to get the exact error message:
Aug 23 11:03:48 cluster-node2 Keepalived_vrrp[295]: (VI_PUB): Cannot find an IP address to use for interface eth0
I am using DHCP to configure the cluster nodes and the adapters get their addresses later, this means that the VIP(s) can not be assigned.
------------------------------------------------------------
[Unit]
After=network-online.target remote-fs.target
------------------------------------------------------------
I actually think that "After=remote-fs.target" might be sufficient as remote-fs.target implies "After=network-online.target" according to the systemd documentation:
"By default all remote mounts defined in /etc/fstab pull this service in, in order to make sure the network is up before it is attempted to connect to a network share."
Please see: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
>Sep 21 22:18:04 lb02 systemd[1]: Starting Network Service...
Sep 21 22:18:04 lb02 systemd-networkd[178]: Enumeration completed
Sep 21 22:18:04 lb02 systemd[1]: Started Network Service.
Sep 21 22:18:04 lb02 systemd[1]: Started Keepalive Daemon.
Sep 21 22:18:04 lb02 Keepalived[179]: Starting Keepalived v1.2.24 (09/17,2016)
Sep 21 22:18:04 lb02 Keepalived[179]: Opening file '/etc/keepalived/keepalived.conf'.
Sep 21 22:18:04 lb02 Keepalived_vrrp[187]: Cant find interface ens3 for vrrp_instance VI_1 !!!
Sep 21 22:18:04 lb02 Keepalived_vrrp[187]: VRRP_Instance(VI_1) Unknown interface !
Sep 21 22:18:05 lb02 systemd-networkd[178]: eth0: Renamed to ens3
Sep 21 22:18:05 lb02 systemd-networkd[178]: ens3: Gained carrier
Sep 21 22:18:05 lb02 Keepalived[179]: pid 187 exited with permanent error CONFIG. Terminating
Sep 21 22:18:05 lb02 Keepalived[179]: Stopping
Sep 21 22:18:07 lb02 systemd-networkd[178]: ens3: Gained IPv6LL
Sep 21 22:18:20 lb02 systemd-networkd[178]: ens3: Configured
Altering the After= line to the above suggestions didn't correct the issue.
One of the following has to be enabled:
systemd-networkd --> systemctl enable systemd-networkd-wait-online.service
NetworkManager --> systemctl enable NetworkManager-wait-online.service
See: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/#cutthecraphowdoimakenetwork.targetworkforme