← Back to team overview

cloud-init team mailing list archive

Re: Still struggling with systemd cycle

 

On Sat, 29 Oct 2016, Robert Schweikert wrote:

> Hi,
>
> All the cloud-init*.services use
>
> [Install]
> WantedBy=cloud-init.target
>
> This implies that cloud-final.service needs to run before
> cloud-init.target is completed.

That is correct.

> However, in the latest version in master we have for cloud-final.service
>
> After=multi-user.target

This was added / changed because of
 https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1576692
Basically, installation of packages that have non-"trivial" service
dependencies fail during systemd boot. It doesnt seem like it is
specifically a Ubuntu bug as any package installation could install
systemd service files and the goal is to start the service at that point.
(although i realize that might not be the case for rpm based distros)

> But in cloud-init.service we for example have
>
> Before=network-online.target
>
> and cloud-init.service is also part of the cloud-init.target as is
> cloud-final.service. Thus the cloud-init.target has a requirement to run
> before multi-user.target is reached (network-online.target is part of
> multi-user.target) while also having a requirement to run after
> multi-user.target is reached.

I do not think that is correct. cloud-init.service is WantedBy
cloud-init.target.  But that just means if cloud-init.target is trying to
be reached, that it will also try to start the cloud-init.service.  It
does not imply any other ordering.

> It appears to me that the systemd complaint is correct.
>
> Given that rc-local.service is a direct dependency for
> multi-user.target, as shown in the diagram below (hoping that mail
> servers and clients will not make too big of a mess with it) and we
> already have
>
> After=rc-local.service
>
> and rc-local.service is probably one of the last things to run before
> multi-user.target is reached it is probably save to drop
>
> After=multi-user.target
>
> from cloud-final.service.

I dont think it is.  It was really a pain.  Systemd ordering is painful.

I'm pretty sure nothing is actually *wrong* as cloud-init boots correctly
and journalctl shows no broken loops on 16.04 and 16.10 at the moment.

I'm not saying its perfect. Just that I don't think its actually wrong.

Scott


>
> Thoughts?
>
> Thanks,
> Robert
>
> multi-user.target
> ● ├─after-local.service
> ● ├─auditd.service
> ● ├─cron.service
> ● ├─dbus.service
> ● ├─irqbalance.service
> ● ├─nscd.service
> ● ├─purge-kernels.service
> ● ├─rc-local.service
> ● ├─sshd.service
> ● ├─systemd-logind.service
> ● ├─systemd-update-utmp-runlevel.service
> ● ├─systemd-user-sessions.service
> ● ├─wicked.service
> ● ├─basic.target
> ● │ ├─paths.target
> ● │ ├─slices.target
> ● │ │ ├─-.slice
> ● │ │ └─system.slice
> ● │ ├─sockets.target
> ● │ │ ├─dbus.socket
> ● │ │ ├─iscsid.socket
> ● │ │ ├─systemd-initctl.socket
> ● │ │ ├─systemd-journald.socket
> ● │ │ ├─systemd-shutdownd.socket
> ● │ │ ├─systemd-udevd-control.socket
> ● │ │ └─systemd-udevd-kernel.socket
> ● │ ├─sysinit.target
> ● │ │ ├─apparmor.service
> ● │ │ ├─dev-hugepages.mount
> ● │ │ ├─dev-mqueue.mount
> ● │ │ ├─haveged.service
> ● │ │ ├─kmod-static-nodes.service
> ● │ │ ├─lvm2-lvmetad.socket
> ● │ │ ├─proc-sys-fs-binfmt_misc.automount
> ● │ │ ├─sys-fs-fuse-connections.mount
> ● │ │ ├─sys-kernel-config.mount
> ● │ │ ├─sys-kernel-debug.mount
> ● │ │ ├─systemd-ask-password-console.path
> ● │ │ ├─systemd-binfmt.service
> ● │ │ ├─systemd-firstboot.service
> ● │ │ ├─systemd-journal-flush.service
> ● │ │ ├─systemd-journald.service
> ● │ │ ├─systemd-modules-load.service
> ● │ │ ├─systemd-random-seed.service
> ● │ │ ├─systemd-sysctl.service
> ● │ │ ├─systemd-tmpfiles-setup-dev.service
> ● │ │ ├─systemd-tmpfiles-setup.service
> ● │ │ ├─systemd-udev-root-symlink.service
> ● │ │ ├─systemd-udev-trigger.service
> ● │ │ ├─systemd-udevd.service
> ● │ │ ├─systemd-update-utmp.service
> ● │ │ ├─systemd-vconsole-setup.service
> ● │ │ ├─cryptsetup.target
> ● │ │ ├─local-fs.target
> ● │ │ │ ├─-.mount
> ● │ │ │ ├─systemd-fsck-root.service
> ● │ │ │ ├─systemd-remount-fs.service
> ● │ │ │ ├─var-lock.mount
> ● │ │ │ └─var-run.mount
> ● │ │ └─swap.target
> ● │ └─timers.target
> ● │   └─systemd-tmpfiles-clean.timer
> ● ├─cloud-init.target
> ● │ ├─cloud-config.service
> ● │ ├─cloud-final.service
> ● │ ├─cloud-init-local.service
> ● │ └─cloud-init.service
> ● ├─getty.target
> ● │ ├─getty@tty1.service
> ● │ └─serial-getty@ttyS0.service
> ● └─remote-fs.target
> ●   ├─iscsi.service
> ●   └─remote-fs-pre.target
>
>
>
> --
> Robert Schweikert                   MAY THE SOURCE BE WITH YOU
> Public Cloud Architect                         LINUX
> rjschwei@xxxxxxxx
> IRC: robjo
>
>

Follow ups

References