Skip to content

systemd does not serialize/deserialize the ExecStart= or ExecStartPre= line number across daemon reloads #518

@antoineco

Description

@antoineco

(systemd 220)

I use a systemd unit to load and start fleet units inside a CoreOS cluster. The unit is pretty straightforward but I observe strange behaviours with successive ExecStart directives:

[Unit]
Description=Deploy Kubernetes units via fleet
Requires=fleet.service
After=fleet.service

[Service]
ExecStart=/usr/bin/bash -c '/usr/bin/fleetctl load /opt/fleet/*.service'
ExecStart=/usr/bin/fleetctl start \
    kube-apiserver.service \
    kube-scheduler.service \
    kube-controller-manager.service \
    kubelet.service \
    kube-proxy.service
Type=oneshot
RemainAfterExit=true

The first ExecStart exits in 2-3s but the second ExecStart is not executed, the unit simply exits after the first command:

# systemctl status kube-fleet
● kube-fleet.service - Deploy Kubernetes units via fleet
   Loaded: loaded (/etc/systemd/system/kube-fleet.service; static; vendor preset: disabled)
   Active: active (exited) since Wed 2015-07-08 14:01:23 UTC; 2s ago
 Main PID: 1230 (code=exited, status=0/SUCCESS)

Jul 08 14:01:21 ip-10-0-21-132.eu-west-1.compute.internal bash[1230]: Triggered global unit kubelet.service load
Jul 08 14:01:21 ip-10-0-21-132.eu-west-1.compute.internal bash[1230]: Triggered global unit provision-k8s-secrets.service load
Jul 08 14:01:23 ip-10-0-21-132.eu-west-1.compute.internal bash[1230]: Unit kube-scheduler.service loaded on 3d5044dd.../10.0.21.132
Jul 08 14:01:23 ip-10-0-21-132.eu-west-1.compute.internal bash[1230]: Unit kube-controller-manager.service loaded on 3d5044dd.../10.0.21.132
Jul 08 14:01:23 ip-10-0-21-132.eu-west-1.compute.internal bash[1230]: Unit generate-k8s-certs.service loaded on 3d5044dd.../10.0.21.132
Jul 08 14:01:23 ip-10-0-21-132.eu-west-1.compute.internal bash[1230]: Unit generate-k8s-tokens.service loaded on 3d5044dd.../10.0.21.132
Jul 08 14:01:23 ip-10-0-21-132.eu-west-1.compute.internal bash[1230]: Unit kube-addons.service loaded on 3d5044dd.../10.0.21.132
Jul 08 14:01:23 ip-10-0-21-132.eu-west-1.compute.internal bash[1230]: Unit kube-apiserver.service loaded on 3d5044dd.../10.0.21.132
Jul 08 14:01:23 ip-10-0-21-132.eu-west-1.compute.internal bash[1230]: Unit get-kubectl.service loaded on 3d5044dd.../10.0.21.132
Jul 08 14:01:23 ip-10-0-21-132.eu-west-1.compute.internal systemd[1]: Started Deploy Kubernetes units via fleet.

It works if I replace the first ExecStart directive with ExecStartPre:

# systemctl status kube-fleet
● kube-fleet.service - Deploy Kubernetes units via fleet
   Loaded: loaded (/etc/systemd/system/kube-fleet.service; static; vendor preset: disabled)
   Active: active (exited) since Wed 2015-07-08 14:04:43 UTC; 2s ago
  Process: 1416 ExecStart=/usr/bin/fleetctl start kube-apiserver.service kube-scheduler.service kube-controller-manager.service kubelet.service kube-proxy.service (code=exited, status=0/SUCCESS)
  Process: 1392 ExecStartPre=/usr/bin/bash -c /usr/bin/fleetctl load /opt/fleet/*.service (code=exited, status=0/SUCCESS)
 Main PID: 1416 (code=exited, status=0/SUCCESS)

Jul 08 14:04:41 ip-10-0-21-132.eu-west-1.compute.internal bash[1392]: Unit kube-scheduler.service loaded on 3d5044dd.../10.0.21.132
Jul 08 14:04:41 ip-10-0-21-132.eu-west-1.compute.internal bash[1392]: Unit kube-apiserver.service loaded on 3d5044dd.../10.0.21.132
Jul 08 14:04:41 ip-10-0-21-132.eu-west-1.compute.internal bash[1392]: Unit generate-k8s-tokens.service loaded on 3d5044dd.../10.0.21.132
Jul 08 14:04:41 ip-10-0-21-132.eu-west-1.compute.internal bash[1392]: Unit kube-addons.service loaded on 3d5044dd.../10.0.21.132
Jul 08 14:04:41 ip-10-0-21-132.eu-west-1.compute.internal fleetctl[1416]: Triggered global unit kubelet.service start
Jul 08 14:04:41 ip-10-0-21-132.eu-west-1.compute.internal fleetctl[1416]: Triggered global unit kube-proxy.service start
Jul 08 14:04:43 ip-10-0-21-132.eu-west-1.compute.internal fleetctl[1416]: Unit kube-apiserver.service launched on 3d5044dd.../10.0.21.132
Jul 08 14:04:43 ip-10-0-21-132.eu-west-1.compute.internal fleetctl[1416]: Unit kube-controller-manager.service launched on 3d5044dd.../10.0.21.132
Jul 08 14:04:43 ip-10-0-21-132.eu-west-1.compute.internal fleetctl[1416]: Unit kube-scheduler.service launched on 3d5044dd.../10.0.21.132
Jul 08 14:04:43 ip-10-0-21-132.eu-west-1.compute.internal systemd[1]: Started Deploy Kubernetes units via fleet.

From my understanding of the documentation both directives should behave the same way as long as the Service type is oneshot.

Another confusing detail: if I replace the first ExecStart by another, faster to execute, bash command like bash -c 'echo hello' both commands are executed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Programming errors, that need preferential fixingpid1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions