Bug#775076: adt-setup-vm: sets force-unsafe-io for host dpkg, not guest

Christian Kastner debian at kvr.at
Sun Jan 11 01:47:43 UTC 2015


On Sun, 11 Jan 2015 02:12:25 +0100 Christian Kastner <debian at kvr.at> wrote:
> adt-setup-vm creates /etc/dpkg/dpkg.cfg.d/autopkgtest on the host, 
> instead of in the guest, because the path is missing the $root
> prefix pointing to the directory where the guest's root is mounted.
> 
> This is very unfortunate, as that file sets force-unsafe-io for
> dpkg, so this puts the host at risk to data loss.

This was introduced by the following commit,

    Regards,commit 86c333020caa05bcd6f964ef5fdcf2c8594065a1
    Author: Martin Pitt <martin.pitt at ubuntu.com>
    Date:   Thu Oct 9 13:09:25 2014 +0200

    tools/adt-setup-vm: Add setup steps that adt-buildvm-ubuntu-cloud does
    
    So that vmdebootstrap generated VMs are functionally on par with the Ubuntu
    cloud images: Set up serial console, dpkg unsafe-io, install some additional
    packages, remove unnecessary packages, bump vmalloc on i386.

so it entered Jessie.

I have attached a debdiff for the version in Jessie which includes the
bugfix from my earlier patch, and adds a postinst in which the offending
file is removed.

If there's anything else I can do to help, please let me know.

Regards,
Christian
-------------- next part --------------
diff -Nru autopkgtest-3.6/debian/changelog autopkgtest-3.6+nmu1/debian/changelog
--- autopkgtest-3.6/debian/changelog	2014-10-16 16:36:18.000000000 +0200
+++ autopkgtest-3.6+nmu1/debian/changelog	2015-01-11 02:44:56.000000000 +0100
@@ -1,3 +1,16 @@
+autopkgtest (3.6+nmu1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * adt-setup-vm: Add the missing $root prefix (the mountpoint of the guest's
+    root directory) when creating /etc/dpkg/dpkg.cfg.d/autopkgtest, otherwise
+    it sets unforce-safe-io on the host instead, putting it at risk of data
+    loss. Closes: #775076.
+  * Create debian/postinst and remove the file /etc/dpkg/dpkg.cfg.d/autopkgtest
+    if its contents are just "force-unsafe-io", indicating that this file was
+    generated by the above bug.
+
+ -- Christian Kastner <debian at kvr.at>  Sun, 11 Jan 2015 02:04:19 +0100
+
 autopkgtest (3.6) unstable; urgency=medium
 
   [ Antonio Terceiro ]
diff -Nru autopkgtest-3.6/debian/postinst autopkgtest-3.6+nmu1/debian/postinst
--- autopkgtest-3.6/debian/postinst	1970-01-01 01:00:00.000000000 +0100
+++ autopkgtest-3.6+nmu1/debian/postinst	2015-01-11 02:34:02.000000000 +0100
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" != configure ]; then
+	exit 0
+fi
+
+# If this file exists and its only content is "force-unsafe-io", then it was
+# generated by #775076 and must be removed.
+if [ -e /etc/dpkg/dpkg.cfg.d/autopkgtest ]; then
+	if [ "`cat /etc/dpkg/dpkg.cfg.d/autopkgtest`" = "force-unsafe-io" ]; then
+		rm -f /etc/dpkg/dpkg.cfg.d/autopkgtest
+	fi
+fi
+
+#DEBHELPER#
diff -Nru autopkgtest-3.6/tools/adt-setup-vm autopkgtest-3.6+nmu1/tools/adt-setup-vm
--- autopkgtest-3.6/tools/adt-setup-vm	2014-10-16 16:36:18.000000000 +0200
+++ autopkgtest-3.6+nmu1/tools/adt-setup-vm	2015-01-11 01:58:38.000000000 +0100
@@ -74,7 +74,7 @@
 
 # go-faster apt/dpkg
 echo "Acquire::Languages \"none\";" > "$root"/etc/apt/apt.conf.d/90nolanguages
-echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/autopkgtest
+echo 'force-unsafe-io' > "$root"/etc/dpkg/dpkg.cfg.d/autopkgtest
 
 # auto-detect apt-cacher-ng
 if [ -z "${ADT_APT_PROXY:-}" ]; then


More information about the autopkgtest-devel mailing list