Bhyve commands "$vm_enable is not set properly"

ajbrehm

Dabbler
Joined
Oct 17, 2020
Messages
20
When I try to use bhyve commands, TrueNAS informs me that

/usr/local/sbin/vm: WARNING: $vm_enable is not set properly - see rc.conf(5).
/usr/local/sbin/vm: ERROR: $vm_enable is not enabled in /etc/rc.conf!

When I configure vm_enable in rc.conf, the settings vanishes after a reboot (as the file threatens it would).

How can I configure vm_enable in TrueNAS and control bhyve VMs from the shell?
 

ajbrehm

Dabbler
Joined
Oct 17, 2020
Messages
20
Turns out this can be configured under System -> Tunables.

Now I have to figure out what value $vm_dir should have...
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Why don't you use the API?... that's what it's there for.

midclt call vm.query

Find the ID of your vm

midclt call vm.poweroff <ID> (for example, but you also have commands for all things VM... look under http://your.truenas/api/docs )
 
Last edited:

ajbrehm

Dabbler
Joined
Oct 17, 2020
Messages
20
Yes, thanks. I hadn't thought of that.

However, it doesn't solve my problem. I need to use common commands for TrueNAS and non-TrueNAS bhyve systems.

The API is useful, but how can I use the bhyve commands? $vm_dir is a mystery to me.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
I don't really know about using the byhve commands, so I can't tell you what's supposed to work, but I can get vm list to run and give me a list of no VMs, but show the headers for a list (and no errors) by using sysrc vm_dir="/mnt/tank/VM"

Where I have a VM which lives in /mnt/tank/VM/debian (which is a ZVOL, so it is actually located in /dev/zvol/tank/VM... but if I use that location instead, I get a bunch of errors about not being able to work with .config files in that location).

I suspect it's not designed to work with zvols.
 
Top