From d801e2eca1e2acc42da9358fefcb5b3dd6f6aa51 Mon Sep 17 00:00:00 2001 From: Bob Potter Date: Fri, 22 Nov 2013 00:11:40 -0600 Subject: [PATCH] website: document chroot running process gotcha --- .../docs/builders/amazon-chroot.html.markdown | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/website/source/docs/builders/amazon-chroot.html.markdown b/website/source/docs/builders/amazon-chroot.html.markdown index b3096a171..3ea0e456c 100644 --- a/website/source/docs/builders/amazon-chroot.html.markdown +++ b/website/source/docs/builders/amazon-chroot.html.markdown @@ -184,6 +184,33 @@ out of your AMI builds. Packer properly obtains a process lock for the parallelism-sensitive parts of its internals such as finding an available device. +## Gotchas + +One of the difficulties with using the chroot builder is that your provisioning +scripts must not leave any processes running or packer will be unable to unmount +the filesystem. + +For debian based distributions you can setup a [policy-rc.d](http://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt) file which will +prevent packages installed by your provisioners from starting services: + +
+{
+  "type": "shell",
+  "inline": [
+    "echo '#!/bin/sh' > /usr/sbin/policy-rc.d",
+    "echo 'exit 101' >> /usr/sbin/policy-rc.d",
+    "chmod a+x /usr/sbin/policy-rc.d"
+  ]
+},
+# ...
+{
+  "type": "shell",
+  "inline": [
+    "rm -f /usr/sbin/policy-rc.d"
+  ]
+}
+
+ ## Using an IAM Instance Profile If AWS keys are not specified in the template or through environment variables