Bhyvemgrd exposes a JSON-based IPC interface over a UNIX domain socket, allowing the bhyvemgr client to request privileged operations required for bhyve virtual machines, execute system-level tasks, monitor VM process states, and receive asynchronous state notifications. Currently it supports amd64 and aarch64 on FreeBSD.
Almost all FreeBSD versions have a complete support for use mdo tool and mac_do. Bhyvemgrd uses mac_do/mdo or since 1.1.0 mac_do/setcred/exec_paths for execute commands with root credentials but it runs using an unpriviliged user. By default, bhyvemgrd port adds an user (bhyvemgrd/833) and group (bhyvemgrd/833) so it must be used to define the mac_do rules.
# kldload mac_do
# sysctl security.mac.do.rules="uid=833>uid=0,gid=0,+gid=*"If you want to do these settings persistent, add the following lines:
# ee /boot/loader.conf
mac_do_load=YES
# ee /etc/sysctl.conf
security.mac.do.rules="uid=833>uid=0,gid=0,+gid=*"If you want to do these settings persistent, add the following lines:
# ee /boot/loader.conf
mac_do_load=YES
# ee /etc/sysctl.conf
security.mac.do.rules="uid=833>uid=0,gid=0,+gid=*"Enable it editing daemon.conf file
# ee /usr/local/etc/bhyvemgrd/daemon.conf
root_mode=mdo# kldload mac_do
# sysctl security.mac.do.rules="uid=833>uid=0,gid=0,+gid=*"
# sysctl security.mac.do.exec_paths="/usr/bin/mdo:/usr/local/sbin/bhyvemgrd"If you want to do these settings persistent, add the following lines:
# ee /boot/loader.conf
mac_do_load=YES
# ee /etc/sysctl.conf
security.mac.do.rules="uid=833>uid=0,gid=0,+gid=*"
security.mac.do.exec_paths="/usr/bin/mdo:/usr/local/sbin/bhyvemgrd"Enable it editing daemon.conf file
# ee /usr/local/etc/bhyvemgrd/daemon.conf
root_mode=setcredThe vmm and nmdm modules are other dependencies, but these can be loaded by bhyvemgrd automatically if previous settings are defined. Otherwise, you can put the following lines in your /boot/loader.conf:
# ee /boot/loader.conf
vmm_load=YES
nmdm_load=YESor
# kldload vmm nmdm
Finally, the bhvemgrd needs two configuration files to run: daemon.conf and common.conf. The first is installed by bhyvemgrd port and the last one is created by bhyvemgr GUI on first time and it only contains vm_path setting. The vm_path defines the path where virtual machines files are stored in your system. Both files are stored at /usr/local/etc/bhyvemgrd directory.
# service bhyvemgrd enable
# service bhyvemgrd start- The bhyvemgrd daemon only can be used by bhyvemgr >= 2.0.0
- Start bhyvemgrd service only after bhyvemgr generated gui.conf and common.conf files. Othwerwise, it will not start. Look at /var/log/bhyvemgrd.log for the reason
- Changes in /usr/local/etc/bhyvmgrd/daemon.conf can be reload using service bhyvemgrd reload
- A service bhyvemgrd restart is not allowed if you have virtual machines running in that time
- Don't forget add the user that you use for run bhyvemgr GUI to bhyvemgrd group pw groupmod bhyvemgrd -m your_user