I am trying to set up an automated testing environment for these Linux installer scripts using KVM/Qemu guests. Currently it only has end-to-end support for bootstrapping a Debian system from a Debian Live environment, but I am working on adding support all combinations for Archlinux, Fedora, Guix, etc. The end result would be that one can boot into whichever supported LiveCD environments, and can bootstrap whichever supported distros on a customized root filesystem/environment (combinations of LUKS, LVM, MDADM, ZFS, UEFI/BIOS, etc).
I am using KVM/Qemu for testing the scripts manually in a live environment. I would prefer to stick with KVM/Qemu, but if someone shows me that some other VM solution can do the job better, I'm up for it!
The great issue for me is automated testing, as the only way to test this currently is to:
- start up a Live CD environment
- clone the git repo (or mount it from a host directory or NFS)
- run the
init-instroot
script to configure the root filesystem - run the bootstrap script to bootstrap the new system (currently only Debian supported).
I would like to automate this process, to be able to run it automatically for all the different possible configurations of options for the init-instroot
script (e.g. using LVM or files for swap, using ZFS as root, UEFI or BIOS, etc.), and then to bootstrap different distros on the so configured root filesystem. Finally, reboot the freshly bootstrapped system, and somehow verify that shit works!
I've looked at the following posts so far, but they are either not really matching my situation, or weren't able to get them working:
- Install VM from command line with virt-install
- virt-install automatic Debian installation with preseed.cfg
- How to fully automate unattended virt-install?
- passing script to VM with KVM
- qemu guest automation
- Guest Automation with QEMU/KVM
I see lots of promise in the QEMU/KVM guest automation posts using expect
scripts. As my scripts are written in GNU Guile, which itself has a great expect library, this would be the natural direction to go. Unfortunately I've not been able to get a LiveCD guest environment run through the terminal even. Obviouly, I would expect to get a logged in Live prompt, at which point my expect script could start interacting with the guest environment.
I am trying to run virt-install
, with the commands below, but I can't interact with anything over the terminal, and nothing seem to really boot. This is the output:
Running text console command: virsh --connect qemu:///system console test
Connected to domain 'test'
Escape character is ^] (Ctrl + ])
I am trying to boot from the "standard" (command-line only) Dabian Live ISO, but using --cdrom
argument doesn't support --extra-args
for setting kernel parameters:
virt-install --name test --ram 4096 --vcpu 2 \
--disk path=disks/test.img,bus=virtio,size=4 \
--graphics none \
--cdrom /home/dadinn/Downloads/isos/debian-live-10.3.0-amd64-standard.iso
Instead of using --cdrom
argument, using --location
allows for kernel arguments using --extra-args
, but still nothing seems to happen:
virt-install --name test --ram 4096 --vcpu 2 \
--disk path=disks/test.img,bus=virtio,size=4 \
--graphics none \
--location http://ftp.us.debian.org/debian/dists/buster/main/installer-amd64/ \
--extra-args console=tty0,console=ttyS0,115200n8,serial
Maybe because the url is not pointing to a command-line only image. Also, I am not sure how theextra-args
with console=tty0,console=ttyS0
arguments would really work [1,2], just saw them in the above examples.