[[!tag debian wishlist]]

It is Sunday, and I was bored, and wanted to experiment a bit with a possible future direction for piuparts. To do that, I needed to create a virtual machine image with Debian installed in it. I failed.

I failed, because I am not familiar with all the stuff I need to be to pull this off. More shame to me.

There's a lot of possible ways to do this, and I tried a few, but ran out of time before I could exhaust all opportunities. Somewhere out there is probably the magic rune I am looking for, and if so, please point it out to me. I might want to get back to this problem say day, and having a working rune would simplify things a lot.

Here are things I tried:

  • Create a base system with debootstrap, then convert that into a bootable image: create image with qemu-img, partition it with parted (so I can have a swap partition), create devices for the partitions with kpartx, create filesystem and copy chroot into the partition. Reason for failure: could not find a way to install kernel or bootloader into the image.
  • Live-helper, with various options. It wants to create a live CD, but I was told if I can build an image without the live-boot and live-config packages installed, it would be what I want. Reason for failure: --initramfs none either causes the image build to fail or the resulting image to not have a bootloader at all. I assume that is the right option, but don't know for sure. (#605255)
  • qemubuilder might do what I want, but failed to build anything at all, even after I worked around a bug by specifying architecture explicitly. (#440944, open since 2007)

I did not try running debian-installer with a pre-seed file under kvm. I might try that some day, but today I did not get there yet. Ideally, I would like to build the image without running things inside a VM, just so it is as independent of specific VM technologies as possible.

Quite a lot of people want to create virtual machine images easily. It would be really nifty to have a tool like this:

vmdebootstrap squeeze foo.img http://cdn.debian.net/debian 

It would be a fairly low-level tool, just like debootstrap is, but having just one place where all the trickiness to create the initial image happens would simplify the overall complexity of other tools.

Making it simple to use would allow other stuff to be easily built on top of the new tool. For example, piuparts could use it to create a VM image in which to run tests, rather than using chroot, which would allow more code paths to be tested.

But I'm not ready to write the tool today, alas.