← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~smoser/cloud-init:bug/1693361-apt-get-locks into cloud-init:master

 

Scott Moser has proposed merging ~smoser/cloud-init:bug/1693361-apt-get-locks into cloud-init:master.

Commit message:
systemd: make cloud-final.service run before apt daily services.

This is really just a work around for apt.  The solution here is to cause
cloud-init-final.service to run Before the processes that run daily and may
cause a lock on the apt database.

apt-daily-upgrade.service contains 'After=apt-daily.service'.
Per systemd man page:
  Timer units automatically gain a Before= dependency on the service
  they are supposed to activate.

Thus following order is enforced, so we can just be 'Before' the first.
   apt-daily.timer
   apt-daily.service
   apt-daily-upgrade.timer
   apt-daily-upgrade.service


Requested reviews:
  Steve Langasek (vorlon)
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1693361 in cloud-init: "cloud-init sometimes fails on dpkg lock due to concurrent apt-daily.service execution"
  https://bugs.launchpad.net/cloud-init/+bug/1693361

For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/325513
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:bug/1693361-apt-get-locks into cloud-init:master.
diff --git a/systemd/cloud-final.service b/systemd/cloud-final.service
index b8f69b7..4bda2ba 100644
--- a/systemd/cloud-final.service
+++ b/systemd/cloud-final.service
@@ -2,6 +2,7 @@
 Description=Execute cloud user/final scripts
 After=network-online.target cloud-config.service rc-local.service multi-user.target
 Wants=network-online.target cloud-config.service
+Before=apt-daily.timer
 
 [Service]
 Type=oneshot