1

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:

  1. start up a Live CD environment
  2. clone the git repo (or mount it from a host directory or NFS)
  3. run the init-instroot script to configure the root filesystem
  4. 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:

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.

1 Answer 1

0

I think you need to choose either VGA/USB console (tty0) or Serial console (ttyS0). I don't believe you can use both together.

Also, IIRC, most bistros have a no-graphical-installer argument you can pass.

For example, this page for Debian may be useful: https://www.debian.org/releases/stable/amd64/apbs02.en.html#preseed-bootparms

And includes an fb= variable for setting the framebuffer passed to the installer.

6
  • Apologies, I think my question wasn't clear that my main intention is to run a LiveCD environment (using Debian standard image, which is console only), and inside the VM execute commands via expect scripting. To achieve this I would need to be able to communicate with the VM via console IO. Your answer seems a good way to configure the Debian installer via kernel arguments, but unfortunately that wouldn't solve my problem. May 9, 2021 at 12:19
  • It should actually do what you want... There's no difference in the console settings for live vs. for installer... The kernel will still take the same arguments and allow you to specify the console to use either the VGA/USB (which is different for VMs, but KVM provides some form of interface for that, I'm not super familiar) or Serial (should be very easy to integrate into Expect assuming the host OS can get on the opposite side of the Guest OS virtualized Serial Port). May 11, 2021 at 8:56
  • The only way to use a Live CD is via the --cdrom option, which doesn't support kernel arguments with --extra-args. For that the --location option is needed, which should actually support ISO files, but it doesn't seem to work: askubuntu.com/q/789358/21665 May 11, 2021 at 11:58
  • Couldn't you extract the ISO files and put them into a "USB stick" ext4 image and achieve the same effect as a live CD? May 12, 2021 at 20:54
  • I am not sure I understand what you mean by "extracting ISO files and putting them into a USB stick ext4 image". Also, if I had a "USB stick" ext4 image (whatever that means), how would I boot a Qemu/KVM guest from it? Where is the boot partition BIOS/MBR stored on this ext4 image? May 17, 2021 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.