[Vmdebootstrap-devel] Bug#834413: vmdebootstrap: can't create images with swap

Simon McVittie smcv at debian.org
Mon Aug 15 12:22:29 UTC 2016


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

The code to create images with swap appears to have bit-rotted; it
looks for self.devices['swapdev'], but the Filesystem handler sets
self.devices['swap']:

    ERROR: In scenario "build a basic Debian 8 image with swap"
    step "WHEN the user runs vmdebootstrap --sparse --extlinux --roottype ext3 --swap=256M" failed,
    with exit code 1:
    Standard output from shell command:
    Standard error from shell command:
        + [ -e /tmp/tmpQstkMI/build_a_basic_Debian_8_image_with_swap/datadir/settings.sh ]
        + . /tmp/tmpQstkMI/build_a_basic_Debian_8_image_with_swap/datadir/settings.sh
        + IMAGE=FOO.img
        + IMAGE_SIZE=2147483648
        + cd /tmp/tmpQstkMI/build_a_basic_Debian_8_image_with_swap/datadir
        + PYTHONPATH=/home/user/vmdebootstrap /home/user/vmdebootstrap/bin/vmdebootstrap --image FOO.img --mirror http://httpredir.debian.org/debian/ --size 2147483648 --sparse --extlinux --roottype ext3 --swap=256M
        Traceback (most recent call last):
          File "/usr/lib/python2.7/dist-packages/cliapp/app.py", line 189, in _run
            self.process_args(args)
          File "/home/user/vmdebootstrap/bin/vmdebootstrap", line 213, in process_args
            self.start_ops()
          File "/home/user/vmdebootstrap/bin/vmdebootstrap", line 303, in start_ops
            self._image_preparations()
          File "/home/user/vmdebootstrap/bin/vmdebootstrap", line 230, in _image_preparations
            runcmd(['mkswap', filesystem.devices['swapdev']])
          File "/home/user/vmdebootstrap/vmdebootstrap/base.py", line 38, in runcmd
            env=env, **kwargs)
          File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
            errread, errwrite)
          File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
            raise child_exception
        TypeError: execv() arg 2 must contain only strings

Additionally, when preparing a UEFI image, the swap partition index is
never set up in the kpartx setup code:

    ERROR: In scenario "build a Debian 8 image with uefi and swap"
    step "WHEN the user runs vmdebootstrap --grub --use-uefi --swap=256M" failed,
    with exit code 1:
    Standard output from shell command:
    Standard error from shell command:
        + [ -e /tmp/tmpeR2KE5/build_a_Debian_8_image_with_uefi_and_swap/datadir/settings.sh ]
        + . /tmp/tmpeR2KE5/build_a_Debian_8_image_with_uefi_and_swap/datadir/settings.sh
        + IMAGE=FOO.img
        + IMAGE_SIZE=2147483648
        + cd /tmp/tmpeR2KE5/build_a_Debian_8_image_with_uefi_and_swap/datadir
        + PYTHONPATH=/home/user/vmdebootstrap /home/user/vmdebootstrap/bin/vmdebootstrap --image FOO.img --mirror http://httpredir.debian.org/debian/ --size 2147483648 --grub --use-uefi --swap=256M
        ERROR: Surprising number of partitions 3:2- check output of losetup -a

I attach proposed patches, containing regression tests reproducing these
issues.

As a follow-up for these fixes, I'm part way through converting the
partition/device handling to be based on a list of named partitions,
so that Filesystem doesn't have to second-guess how the disk would
have been partitioned for a particular combination of options. This
should hopefully make it more robust.

Regards,
    S

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.6.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages vmdebootstrap depends on:
ii  debootstrap         1.0.81
ii  kpartx              0.6.2-2
ii  libjs-sphinxdoc     1.4.5-1
ii  parted              3.2-15
ii  python-cliapp       1.20160724-1
ii  python-distro-info  0.14
ii  python2.7           2.7.12-2
pn  python:any          <none>
ii  qemu-utils          1:2.6+dfsg-3

Versions of packages vmdebootstrap recommends:
ii  dosfstools        4.0-2
ii  extlinux          3:6.03+dfsg-14
ii  grub2-common      2.02~beta2-36
ii  python-guestfs    1:1.32.7-1
ii  qemu-system       1:2.6+dfsg-3
ii  qemu-user-static  1:2.6+dfsg-3
ii  squashfs-tools    1:4.3-3

Versions of packages vmdebootstrap suggests:
ii  cmdtest       0.26-1
ii  mbr           1.1.11-5+b1
ii  pandoc        1.17.0.3~dfsg-2+b3
pn  u-boot:armhf  <none>

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Filesystem-fix-support-for-creating-swap-partition.patch
Type: text/x-diff
Size: 2001 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/vmdebootstrap-devel/attachments/20160815/f764c7b9/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Filesystem-allow-swap-partition-to-be-combined-with-.patch
Type: text/x-diff
Size: 2458 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/vmdebootstrap-devel/attachments/20160815/f764c7b9/attachment-0001.patch>


More information about the Vmdebootstrap-devel mailing list