Scripting to debootstrap a qemu raw image with set up for ISO building.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ralph Rönnquist f3b94e01c7 removed spurious space 1 year ago
README.adoc minor editorial 1 year ago handle empty settings 1 year ago unhook the automatic run 1 year ago
bootstrap-help.txt slight cleanup and automatic postboot at first run 1 year ago added bootlogd to default exclusions 1 year ago
build-ascii-amd64-target slight rework to allow for 2 stage debootstrap 1 year ago
build-ascii-i386-target slight rework to allow for 2 stage debootstrap 1 year ago
build-beowulf-amd64-target slight rework to allow for 2 stage debootstrap 1 year ago
build-beowulf-arm64-target fixup for arm64 building and running 1 year ago
build-beowulf-armhf-target added armhf variant 1 year ago
build-beowulf-i386-target removed spurious space 1 year ago
build-unstable-i386-target added dialog for clean-disk, and various tuning 1 year ago added dialog for clean-disk, and various tuning 1 year ago added dialog for clean-disk, and various tuning 1 year ago increased ram 1 year ago


Build an ISO build VM

2021-01-22 12:05:52

This project holds some scripting that I use for making a QEMU virtual machine in which to build Devuan distribution ISOs for the VM machine architure. My host is an amd64 machine with Devuan ASCII plus some carious additions for other purposes, and it’s not a clean environment for building distribution ISOs even for amd64 distributions. But it serves well as host for ISO building VMs especially for i386 and amd64, and possibly some generic arm variants.

A command to make an ISO builder VM, and start it would be

$ ./ ascii i386
$ ./ i386 ascii-i386.img

Upon the first start, login as root:toor to run ./ to complete the OS set up, and then finalizing the set up for debian-installer.

Do su - ralph to become the non-root user, and then go cd debian-installer/build to go crazy with ISO building.

Host Set Up

The host is set up with

+ a VDE networking solution for the QEMU VMs
+ a dnsmasq server for DHCP and DNS forwarding
+ an apt-cacher-ng for caching packages
+ an NFS server for a debian-installer workspace tree

The last is done so that all configurations and residue of ISO building is actually held outside of the VM image, allowing them to be 2G disk images that merely provide the target architecture build system.

VDE Set Up

The VDE networking solution includes setting up a tap with an IP address, and iptables rules to provide traffic forwarding.

vde hands-on

$ sudo ip tuntap add tap0 mode tap user ralph
$ sudo iptables -t nat -A POSTROUTING -j MASQUERADE
$ vde_switch -daemon

dnsmasq Set Up

Since dnsmasq is quite versatile, it needs a fair number of parameters in it’s set up:

dnsmasq hands-on

$ sudo ip tuntap add tap0 mode tap user ralph
$ sudo ip link set tap0 up
$ sudo ip address add dev tap0
$ sudo dnsmasq -i tap0 -a -I lo -I wlan0 -I eth0 \
  -K -D -N -b --dhcp-sequential-ip \

Note: if that dnsmasq starts to compete about port 53 with some other local DNS service, you may need to move tap0 with the vde_switch and dnsmasq as well as the apt-cacher-ng service into a network namespace. That might of course require virtual cabling out of the namespace as well, since at least apt-cacher-ng and dnsmasq will need outward network access.

apt-cacher-ng Set Up

The apt-cacher-ng set up is a bit more involved, and I’ll leave out the details from here. In my set up it services port 3142.

nfs Set Up

The host is nfs server, providing access to the $SHARE directory, which for me is /home/ralph/kvm/ISO/share on the host.

The QEMU VM is nfs client, mounting the directory as /nfs/share. Then ~ralph in the VM has a link to /nfs/share/debian-installer, which is duly set up on the host.

Note: the debian-installer workspace is managed on the host, in particular checking out the building branch appropriately. The VMs are only used for preparing the ISOs.


The VM is firstly set up with an OS of the targeted distribution by running the host’s debootstrap with configurations geared towards the targeted distribution. There available ${dist}-${arch} configurations are held as supporting files, such as build-ascii-i386-target. The configuration is loaded before running debootstrap, with the $INCLUDE packages included in that run, and the $EXTRA packages added into a generated /root/ script in the VM image.

The debootstrap run is followed by some "finalizations" to make the VM image bootable (with extlinux), to import the build user’s ssh key for the VM root user, and lastly to pass the script into a target chroot for some further finalization steps with that file system.

The steps are performed by the host kernel, but "confined" to the target chroot.

Last updated 2021-01-22 12:05:52 UTC