Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qemu fails building EC2 AMI: CPU model ‘host’ requires KVM #85394

Closed
anmonteiro opened this issue Apr 16, 2020 · 3 comments · Fixed by #95956
Closed

qemu fails building EC2 AMI: CPU model ‘host’ requires KVM #85394

anmonteiro opened this issue Apr 16, 2020 · 3 comments · Fixed by #95956

Comments

@anmonteiro
Copy link
Member

Describe the bug
When trying to generate an EC2 AMI, qemu fails with:

qemu-system-x86_64: CPU model ‘host’ requires KVM

This has been reported by someone else in the NixOS Discourse too: https://discourse.nixos.org/t/new-constraint-between-release-19-09-and-20-03-in-package-qemu/6297

I've tried reverting 2bd296a and it succeeds for me, noting that's the commit that introduced the problem.

To Reproduce
Steps to reproduce the behavior:

  1. Launch an EC2 instance
  2. Run the following:
$ export NIXOS=/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/
$ nix-build -A amazonImage.x86_64-linux $NIXOS/release.nix

Expected behavior
Qemu would succeed in creating a disk image

Notify maintainers
cc @volth who's the author of the referenced commit. I'm not sure what the right fix is here, so would appreciate some guidance.

@anmonteiro
Copy link
Member Author

Oh cool! I missed that. I suppose this can be closed then. Thanks for the link

@jpgu-epam
Copy link

I faced the same issue and reverting was the only option that worked. The proposed solution in #83920 didn't work. Still getting the same error message.

matthewbauer added a commit to matthewbauer/nixpkgs that referenced this issue Aug 22, 2020
This appears to avoid requiring KVM when it’s not available. This is
what I originally though -cpu host did. Unfortunately not much
documentation available from the QEMU side on this, but this appears
to square with help:

$ qemu-system-x86 -cpu help
...
x86 host                  KVM processor with all supported host features
x86 max                   Enables all features supported by the accelerator in the current host
...

Whether we actually want to support this not clear, since this only
happens when your CPU doesn’t have full KVM support. Some Nix builders
are lying about kvm support though. Things aren’t too slow without it
though.

Fixes NixOS#85394

Alternative to NixOS#83920
matthewbauer added a commit to matthewbauer/nixpkgs that referenced this issue Aug 22, 2020
This appears to avoid requiring KVM when it’s not available. This is
what I originally though -cpu host did. Unfortunately not much
documentation available from the QEMU side on this, but this appears
to square with help:

$ qemu-system-x86 -cpu help
...
x86 host                  KVM processor with all supported host features
x86 max                   Enables all features supported by the accelerator in the current host
...

Whether we actually want to support this not clear, since this only
happens when your CPU doesn’t have full KVM support. Some Nix builders
are lying about kvm support though. Things aren’t too slow without it
though.

Fixes NixOS#85394

Alternative to NixOS#83920
matthewbauer added a commit to matthewbauer/nixpkgs that referenced this issue Feb 25, 2021
This appears to avoid requiring KVM when it’s not available. This is
what I originally though -cpu host did. Unfortunately not much
documentation available from the QEMU side on this, but this appears
to square with help:

$ qemu-system-x86 -cpu help
...
x86 host                  KVM processor with all supported host features
x86 max                   Enables all features supported by the accelerator in the current host
...

Whether we actually want to support this not clear, since this only
happens when your CPU doesn’t have full KVM support. Some Nix builders
are lying about kvm support though. Things aren’t too slow without it
though.

Fixes NixOS#85394

Alternative to NixOS#83920

(cherry picked from commit 47b56e7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@anmonteiro @jpgu-epam and others