NixOS Test: qemu issues on CentOS 7

I’m playing around with NixOS test infrastructure on CentOS 7 and I’m having some issues. Does anyone have experience of this working on non-NixOSes?

What I’ve Tested

When I run a test it works to the point it boots and connects (as far as output shows me). But sending commands fails with broken pipe. Running the test interactively I get:

starting VDE switch for network 1
>>> start_all()
starting all VMs
machine: starting vm
machine # Formatting '/tmp/vm-state-machine/machine.qcow2', fmt=qcow2 size=536870912 cluster_size=65536 lazy_refcounts=off refcount_bits=16
machine: QEMU running (pid 20932)
(2.80 seconds)

machine # qemu-system-x86_64: CPU model 'host' requires KVM
>>> machine.succeed("echo foo")
machine: must succeed: echo foo
machine: waiting for the VM to finish booting
machine: connected to guest root shell
machine: (connecting took 0.00 seconds)
(0.00 seconds)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/r7c3cavf7g1i4jyxrva56cq94wb736cq-nixos-test-driver/bin/.nixos-test-driver-wrapped", line 412, in succeed
    (status, out) = self.execute(command)
  File "/nix/store/r7c3cavf7g1i4jyxrva56cq94wb736cq-nixos-test-driver/bin/.nixos-test-driver-wrapped", line 393, in execute
    self.shell.send(out_command.encode())
BrokenPipeError: [Errno 32] Broken pipe

[Errno 32] Broken pipe

>>>

Using the perl based test instead:

$ ./result/bin/nixos-test-driver
starting VDE switch for network 1
> startAll
starting all VMs
machine: starting vm
machine: QEMU running (pid 7332)
(2.38 seconds)
> machine# qemu-system-x86_64: CPU model 'host' requires KVM

> $machine->waitForUnit("multi-user.target");
machine: waiting for unit ‘multi-user.target’
machine: running command: systemctl --no-pager show "multi-user.target"
machine: waiting for the VM to finish booting
(0.00 seconds)
(0.00 seconds)
(0.00 seconds)
the VM quit before connecting
>

Checking the pid 7332 at this point reveals that it is defunct:

me 7332  0.0  0.0      0     0 pts/0    Z+   10:19   0:00 [qemu-system-x86] <defunct>

Executing test with or without DISPLAY makes no difference. I also spent some time adding options to get something from qemu, but it doesn’t log anything AFAICT.

To verify basic qemu functionality I tested booting a Debian image from Index of /~aurel32/qemu/amd64. It didn’t boot in graphics-mode (getting stuck in iPXE). In curses mode however it works fine:

$ nix-shell '<nixpkgs>' -A qemu-tools
$ qemu-system-x86_64 -curses -hda debian_squeeze_amd64_standard.qcow2

My kernel:

$ uname -srvm
Linux 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64

If anyone has any pointers I’d appreciate it very much.