Package: vmdebootstrap
Version: 1.5-1
Severity: normal
Tags: patch

I noticed that the images created by using --convert-qcow2 were
unbootable in most cases for me (maybe all, but I don't recall that
right now). Recreating them manually using qemu-img succeeded, however.

I then noticed that the conversion step is being called while the image
is still mounted. I thought that might be a problem, even though no
further writes seem to happen at that point, so I tried moving the
conversion step until after the image has been unmounted. This indeed
resolved the issue for me.

The attached patch against HEAD of master implements this.

Regards,
Christian

From abea99bd9ef4164e317ad25546c24d738d7da68b Mon Sep 17 00:00:00 2001
From: Christian Kastner <c...@kvr.at>
Date: Wed, 13 Jul 2016 20:29:56 +0200
Subject: [PATCH 3/4] Move qcow2 conversion to after system cleanup

Otherwise, the result might be a non-bootable image. As least, that has been
observed in the wild.
---
 bin/vmdebootstrap | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/vmdebootstrap b/bin/vmdebootstrap
index 859816e..93b65d9 100755
--- a/bin/vmdebootstrap
+++ b/bin/vmdebootstrap
@@ -313,7 +313,6 @@ class VmDebootstrap(cliapp.Application):  # pylint: disable=too-many-public-meth
             elif self.settings['squash']:
                 filesystem.squash_rootfs()
             filesystem.chown()
-            filesystem.convert_image_to_qcow2()
 
         except BaseException as e:
             base.message('EEEK! Something bad happened...')
@@ -330,6 +329,7 @@ class VmDebootstrap(cliapp.Application):  # pylint: disable=too-many-public-meth
             raise
         else:
             self.cleanup_system()
+            filesystem.convert_image_to_qcow2()
 
     def mkdtemp(self):
         dirname = tempfile.mkdtemp()
-- 
2.8.1

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to