Terraform-provider-libvirt: [MAC-OS]: internal error: Cannot find suitable emulator for x86_64

Created on 2 Mar 2020  路  4Comments  路  Source: dmacvicar/terraform-provider-libvirt

System Information

OS distribution

macOS 10.15.2 Catalina

Terraform version

Terraform v0.12.21

Provider and libvirt versions

terraform-provider-libvirt 0.6.1
Compiled against library: libvirt 6.0.0
Using library: libvirt 6.0.0
2020/03/02 09:01:55 virError(Code=1, Domain=10, Message='internal error: Cannot find suitable emulator for x86_64')

Checklist

  • [X] Is it a bug or something that does not work as expected? Please make sure you fill the version information below:

Description of Issue/Question

Setup

No main.tf file as of yet. See _Provider and libvirt versions_.

Steps to Reproduce Issue

$ brew install terraform
...
$ terraform --version
Terraform v0.12.21
$ brew install terraform-provider-libvirt
==> Installing dependencies for terraform-provider-libvirt: libvirt
==> Installing terraform-provider-libvirt dependency: libvirt
...
To have launchd start libvirt now and restart at login:
  brew services start libvirt
Or, if you don't want/need a background service you can just run:
  libvirtd
$ brew services start libvirt
==> Successfully started `libvirt` (label: homebrew.mxcl.libvirt)
$ /usr/local/Cellar/libvirt/6.0.0/sbin/libvirtd --version
/usr/local/Cellar/libvirt/6.0.0/sbin/libvirtd (libvirt) 6.0.0
$ ln -s /usr/local/opt/terraform-provider-libvirt/bin/terraform-provider-libvirt ~/.terraform.d/plugins
$ cd ~/.terraform.d/plugins
$ ./terraform-provider-libvirt -version
./terraform-provider-libvirt 0.6.1
Compiled against library: libvirt 6.0.0
Using library: libvirt 6.0.0
2020/03/02 09:11:00 virError(Code=1, Domain=10, Message='internal error: Cannot find suitable emulator for x86_64')

Additional information:

Installed via homebrew. Cross-checking with homebrew devs as well.

No other special configurations enabled.

help wanted

All 4 comments

thx for issue. I don't have any mac. So help from people who use it welcome :rose:

FWIW: There's a Red Hat BZ referencing this error as well, which has the same wording... which suggests mayhaps it's originating in libvirt... ? https://bugzilla.redhat.com/show_bug.cgi?id=783038

Solved: It helps to brew install qemu! I mistakenly thought it was already installed as a dependency.

$ brew install qemu
==> Installing dependencies for qemu: jpeg, libpng, libssh, libusb, lzo, pixman and vde
...
$ ~/.terraform.d/plugins/terraform-provider-libvirt -version
/Users/jdandrea/.terraform.d/plugins/terraform-provider-libvirt 0.6.1
Compiled against library: libvirt 6.0.0
Using library: libvirt 6.0.0
Running hypervisor: QEMU 4.2.0
Running against daemon: 6.0.0

See also: https://discourse.brew.sh/t/on-terraform-provider-libvirt-and-qemu/7069

@jdandrea I wonder, do you actually have a working setup on macOS?

I'm running into multiple issues getting even the simplest test ("boot") to work.

My versions:

  • macOS Mojave 10.14.6
  • libvirt: stable 6.6.0 (bottled), HEAD
  • qemu: stable 5.1.0 (bottled), HEAD (with accel=hvf!)

Oddest thing I had to do - somewhere at some time testing with virsh- was to symlink all the libvirt .bundle-files to .so-files, to solve errors like this:

2020-08-26 11:35:59.435+0000: 4645819840: error : virModuleLoad:110 : Failed to find module '/usr/local/Cellar/libvirt/6.6.0/lib/libvirt/connection-driver/libvirt_driver_storage.so': No such file or directory

Next, to overrule this KVM issue (and use HVF instead)

Error: Error defining libvirt domain: virError(Code=8, Domain=10, Message='invalid argument: could not get preferred machine for /usr/local/bin/qemu-system-x86_64 type=kvm')

I added the emulator: emulator = "/usr/local/bin/qemu-system-x86_64 -M accel=hvf --cpu host"

but all of a sudden the binary is not found:

Error: Error defining libvirt domain: virError(Code=38, Domain=10, Message='Cannot check QEMU binary /usr/local/bin/qemu-system-x86_64 -M accel=hvf --cpu host: No such file or directory')

So if it is actually possible to run Terraform and this libvirt provider on macOS, what hoops and hurdles are there to take?
TIA!

UPDATE
I'm getting the impression that all this is not meant to run VMs on a Mac / macOS itself, but on a remote Linux KVM server instead.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lhw picture lhw  路  3Comments

james-crowley picture james-crowley  路  6Comments

prologic picture prologic  路  5Comments

klauserber picture klauserber  路  6Comments

will-code-for-pizza picture will-code-for-pizza  路  4Comments