summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2018-04-28 12:48:06 +0300
committerTuomas Tynkkynen <tuomas@tuxera.com>2018-04-28 12:48:06 +0300
commitdda74d9e50dbd8a412de743a53e9cfd585407342 (patch)
treefc0fc8620b69fe1376e43a57337bb7b5e56b073c /nixos
parent6078f01969e8e704f44965a97730f95634887ca2 (diff)
downloadnixpkgs-dda74d9e50dbd8a412de743a53e9cfd585407342.tar
nixpkgs-dda74d9e50dbd8a412de743a53e9cfd585407342.tar.gz
nixpkgs-dda74d9e50dbd8a412de743a53e9cfd585407342.tar.bz2
nixpkgs-dda74d9e50dbd8a412de743a53e9cfd585407342.tar.lz
nixpkgs-dda74d9e50dbd8a412de743a53e9cfd585407342.tar.xz
nixpkgs-dda74d9e50dbd8a412de743a53e9cfd585407342.tar.zst
nixpkgs-dda74d9e50dbd8a412de743a53e9cfd585407342.zip
nixos/qemu-vm: Always add a virtio RNG device to the quest
mke2fs has this annoying property that it uses getrandom() to get random
numbers (for whatever purposes) which blocks until the kernel's secure
RNG has sufficient entropy, which it usually doesn't in the early boot
(except if your CPU supports RDRAND) where we may need to create the
root disk.

So let's give the VM a virtio RNG to avoid the boot getting stuck at
mke2fs.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/virtualisation/qemu-vm.nix1
1 files changed, 1 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index 2b78276fcde..3d4bd315f81 100644
--- a/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixos/modules/virtualisation/qemu-vm.nix
@@ -77,6 +77,7 @@ let
           -name ${vmName} \
           -m ${toString config.virtualisation.memorySize} \
           -smp ${toString config.virtualisation.cores} \
+          -device virtio-rng-pci \
           ${concatStringsSep " " config.virtualisation.qemu.networkingOptions} \
           -virtfs local,path=/nix/store,security_model=none,mount_tag=store \
           -virtfs local,path=$TMPDIR/xchg,security_model=none,mount_tag=xchg \