← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~smoser/cloud-init:bug/before-fsck into cloud-init:master


Scott Moser has proposed merging ~smoser/cloud-init:bug/before-fsck into cloud-init:master.

Commit message:
systemd: make systemd-fsck run after cloud-init.service

cloud-init.service may write filesystems (fs_setup) or re-partition
(disk_setup) disks.

If systemd-fsck is running on a device while that is occuring
then the partitioning or mkfs might fail due to the device being busy.
Alternatively, the fsck might fail and cause subsequent mount to fail.

LP: #1691489

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1691489 in cloud-init: "fstab entries written by cloud-config may not be mounted"

For more details, see:
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:bug/before-fsck into cloud-init:master.
diff --git a/setup.py b/setup.py
index 4616599..a61c24a 100755
--- a/setup.py
+++ b/setup.py
@@ -65,6 +65,7 @@ INITSYS_FILES = {
     'sysvinit_openrc': [f for f in glob('sysvinit/gentoo/*') if is_f(f)],
     'systemd': [f for f in (glob('systemd/*.service') +
                             glob('systemd/*.target')) if is_f(f)],
+    'systemd.fsck-dropin': ['systemd/systemd-fsck@.service.d/cloud-init.conf'],
     'systemd.generators': [f for f in glob('systemd/*-generator') if is_f(f)],
     'upstart': [f for f in glob('upstart/*') if is_f(f)],
@@ -76,6 +77,9 @@ INITSYS_ROOTS = {
     'systemd': pkg_config_read('systemd', 'systemdsystemunitdir'),
     'systemd.generators': pkg_config_read('systemd',
+    'systemd.fsck-dropin': (
+        os.path.sep.join([pkg_config_read('systemd', 'systemdsystemunitdir'),
+                          'systemd-fsck@.service.d'])),
     'upstart': '/etc/init/',
 INITSYS_TYPES = sorted([f.partition(".")[0] for f in INITSYS_ROOTS.keys()])
diff --git a/systemd/systemd-fsck@.service.d/cloud-init.conf b/systemd/systemd-fsck@.service.d/cloud-init.conf
new file mode 100644
index 0000000..0bfa465
--- /dev/null
+++ b/systemd/systemd-fsck@.service.d/cloud-init.conf
@@ -0,0 +1,2 @@