# Kvm version too old

**URL:** https://discourse.nixos.org/t/kvm-version-too-old/14839
**Category:** Uncategorized
**Created:** [September 3, 2021, 12:41am UTC](https://discourse.nixos.org/t/kvm-version-too-old/14839 "2021-09-03T00:41:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tsj](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tsj](https://discourse.nixos.org/u/tsj)
#### Post date: [September 3, 2021, 12:41am UTC](https://discourse.nixos.org/t/kvm-version-too-old/14839/1 "2021-09-03T00:41:05Z")

</div>

I want to build an image using `make-disk-image.nix` for `aarch64-linux`, I picked what seemed to be the simplest derivation `nixos/modules/virtualisation/hyperv-image.nix` just as a test, with the following simple patch:

```auto
37c37
< system.build.hypervImage = import ../../lib/make-disk-image.nix {
---
> system.build.hypervImage = import <nixpkgs/nixos/lib/make-disk-image.nix> {
39,42d38
< postVM = ''
< ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -o subformat=dynamic -O vhdx $diskImage $out/${cfg.vmFileName}
< rm $diskImage
< '';
69d64
< virtualisation.hypervGuest.enable = true;

```

I try to build it like `nix-build --argstr system aarch64-linux '<nixpkgs/nixos>' -I nixos-config=./default.nix -A config.system.build.hypervImage --show-trace`.

Eventually I get to the vm booting but then something happens:

```auto
[1.710327] Run /init as init process
[1.757031] EXT4-fs (vda2): mounted filesystem with ordered data mode. Opts:
[2.080044] random: fast init done
[5.591459] random: crng init done
[60.658328] reboot: Restarting system
WARNING: Image format was not specified for 'nixos.raw' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
kvm version too old
.qemu-system-aarch64-wrapped: failed to initialize kvm: Function not implemented
builder for '/nix/store/4g391kv25kwh6nc5vzc66x93ri5lzy5z-nixos-hyperv-21.11pre312229.08ef0f28e3a-aarch64-linux.drv' failed with exit code 1
error: build of '/nix/store/4g391kv25kwh6nc5vzc66x93ri5lzy5z-nixos-hyperv-21.11pre312229.08ef0f28e3a-aarch64-linux.drv' failed

```

I have no idea what to do. I should note I am running this not on NixOS, but on Arch with Nix installed. I had to install `qemu-user-static` on my host os to get this far. KVM seems to work otherwise, I have been able to make and launch a VirtualBox-based guest with KVM as well as a “hello world” KVM application found on github. Any ideas?

---

<div class="post-metadata">

### Author: ![pinpox](https://discourse.nixos.org/user_avatar/discourse.nixos.org/pinpox/32/3026_2.png) [@pinpox](https://discourse.nixos.org/u/pinpox)
#### Post date: [November 18, 2021, 11:17am UTC](https://discourse.nixos.org/t/kvm-version-too-old/14839/2 "2021-11-18T11:17:38Z")

</div>

Can confirm the issue on NixOS aswell. @tsj have you opened an issue on nixpkgs for this already?

```auto
error: builder for '/nix/store/i5r4xy3c4d1hhvi6rbmcfl0cc3zyf8qr-base-image.drv' failed with exit code 1;
       last 10 log lines:
       > [1.908530] Run /init as init process
       > [1.992662] EXT4-fs (vda1): mounted filesystem with ordered data mode. Opts:
       > [2.345883] random: fast init done
       > [9.185599] random: crng init done
       > [82.020042] reboot: Restarting system
       > WARNING: Image format was not specified for 'nixos.raw' and probing guessed raw.
       > Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
       > Specify the 'raw' format explicitly to remove the restrictions.
       > kvm version too old
       > .qemu-system-aarch64-wrapped: failed to initialize kvm: Function not implemented
       For full logs, run 'nix log /nix/store/i5r4xy3c4d1hhvi6rbmcfl0cc3zyf8qr-base-image.drv'.

```

---

<div class="post-metadata">

### Author: ![tsj](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/t/8797f3/32.png) [@tsj](https://discourse.nixos.org/u/tsj)
#### Post date: [November 18, 2021, 12:41pm UTC](https://discourse.nixos.org/t/kvm-version-too-old/14839/3 "2021-11-18T12:41:20Z")

</div>

Hi @pinpox I never did open an issue. Go for it
