From 80f5ec4be0f781b26eca51d90d51abfab396b3f6 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 19 Sep 2016 11:48:54 -0400 Subject: Adjust mounts and disk configuration for systemd. The end result of all of these changes is to get mounts managed by cloud-init to occur only after cloud-init.service is done. We need to do that so that filesystems that are set up by cloud-init (in disk_setup) do not get mounted by stale entries in /etc/fstab before the setup occurs. This can occur in 2 ways: a.) new instance with old /etc/fstab b.) same instance where disk needs adjusting (Azure resize will re-format the ephemeral disk). The list of changes here is: - move mounts and disk_setup module to cloud-init.service rather than config. cloud-init.service runs earlier in boot so it can get those mount points done earlier. - on systemd add 'x-systemd.requires=cloud-init.service' to fstab options - cloud-init-local.service: add Before=basic.target - cloud-init.service: - extend After, Before, and Wants to multiple lines rather than one long line. - sort consistently with cloud-init-local.service - add DefaultDependencies=no - add Before=default.target - add Conflicts=shutdown.target LP: #1611074 --- systemd/cloud-init-local.service | 3 ++- systemd/cloud-init.service | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'systemd') diff --git a/systemd/cloud-init-local.service b/systemd/cloud-init-local.service index b19eeaee..bc2db60e 100644 --- a/systemd/cloud-init-local.service +++ b/systemd/cloud-init-local.service @@ -4,9 +4,10 @@ DefaultDependencies=no Wants=local-fs.target Wants=network-pre.target After=local-fs.target -Conflicts=shutdown.target +Before=basic.target Before=network-pre.target Before=shutdown.target +Conflicts=shutdown.target [Service] Type=oneshot diff --git a/systemd/cloud-init.service b/systemd/cloud-init.service index 6fb655e6..1e392a39 100644 --- a/systemd/cloud-init.service +++ b/systemd/cloud-init.service @@ -1,9 +1,19 @@ [Unit] Description=Initial cloud-init job (metadata service crawler) -After=cloud-init-local.service networking.service -Before=network-online.target sshd.service sshd-keygen.service systemd-user-sessions.service +DefaultDependencies=no +Wants=cloud-init-local.service +Wants=local-fs.target +Wants=sshd-keygen.service +Wants=sshd.service +After=cloud-init-local.service +After=networking.service Requires=networking.service -Wants=local-fs.target cloud-init-local.service sshd.service sshd-keygen.service +Before=basic.target +Before=network-online.target +Before=sshd-keygen.service +Before=sshd.service +Before=systemd-user-sessions.service +Conflicts=shutdown.target [Service] Type=oneshot -- cgit v1.2.3 From 1b71b474c0fc06e67aab8676268fd83d99091910 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Tue, 20 Sep 2016 14:13:25 -0700 Subject: systemd: Ensure that cloud-init-local happens before NetworkManager --- systemd/cloud-init-local.service | 1 + 1 file changed, 1 insertion(+) (limited to 'systemd') diff --git a/systemd/cloud-init-local.service b/systemd/cloud-init-local.service index bc2db60e..55834ba4 100644 --- a/systemd/cloud-init-local.service +++ b/systemd/cloud-init-local.service @@ -5,6 +5,7 @@ Wants=local-fs.target Wants=network-pre.target After=local-fs.target Before=basic.target +Before=NetworkManager.service Before=network-pre.target Before=shutdown.target Conflicts=shutdown.target -- cgit v1.2.3 From 94fd35eeb3f53bc82fb9ddcad60c1e605890fd53 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 4 Oct 2016 16:40:12 -0400 Subject: systemd: run cloud-init.service Before dbus.service This is the best work around we have for an issue seen when dns is used during cloud-init.service on a system that is configured in nsswitch to use systemd-resolved. The problem is that cloud-init.service was blocking basic.target, and dbus would not be available until after cloud-init.service finished. LP: #1629797 --- systemd/cloud-init.service | 1 + 1 file changed, 1 insertion(+) (limited to 'systemd') diff --git a/systemd/cloud-init.service b/systemd/cloud-init.service index 1e392a39..bbddb2da 100644 --- a/systemd/cloud-init.service +++ b/systemd/cloud-init.service @@ -9,6 +9,7 @@ After=cloud-init-local.service After=networking.service Requires=networking.service Before=basic.target +Before=dbus.target Before=network-online.target Before=sshd-keygen.service Before=sshd.service -- cgit v1.2.3 From 6e45ffb21e9622780585b4fe15890f009ca8fa71 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Fri, 7 Oct 2016 11:33:48 +0100 Subject: systemd: Run cloud-init.service Before dbus.socket not dbus.target The change reported to fix bug 1629797 was incorrect. It added: Before=dbus.target and its commit message referenced dbus.service. dbus.target does not exist, and dbus.service would not solve the problem. The change did not fix the problem nor actually make any difference. The fix here is just to use Before=dbus.socket. LP: #1629797 --- systemd/cloud-init.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'systemd') diff --git a/systemd/cloud-init.service b/systemd/cloud-init.service index bbddb2da..5c71b213 100644 --- a/systemd/cloud-init.service +++ b/systemd/cloud-init.service @@ -9,7 +9,7 @@ After=cloud-init-local.service After=networking.service Requires=networking.service Before=basic.target -Before=dbus.target +Before=dbus.socket Before=network-online.target Before=sshd-keygen.service Before=sshd.service -- cgit v1.2.3