Solved How to install OPNSense under bhyve?

After doing quite a bit of reading, I decided that cbsd was probably the best jail/vm manager for me, so that's what I used to set up a bhyve VM. I used the cbsd script to automatically download the ISO for OPNSense 20.7 and boot the VM from that ISO. I used TigerVNC to connect to the VM with a GUI interface and chose the option to do a guided installation of OPNSense. Then the VM appeared to freeze with the bhyve process pegged at 100%.

I checked OPNSense's hardware requirements and thought that maybe it was just slow because it only had 1 GB RAM and 1 virtual CPU in the default configuration. So I gave it 4 GB RAM and 2 virtual CPUs. It still froze at the same point with the bhyve process pegged at 100%.

Since I kept getting the same result, I figured it wasn't a lack of resources allotted to the VM and is probably something else. Does OPNSense require some additional configuration to work under bhyve?

I tried a couple of other OSes for experimentation. Gentoo booted up fine, and so did Debian 10. But after installation and trying to boot Debian from the insalled OS rather than the DVD ISO, I just got a black screen when connecting with VNC. So I haven't had much success with bhyve so far.
 
It still froze at the same point with the bhyve process pegged at 100%.

Do you mean 'Guided installation' stage? Can you try to press 'Ctrl+C' (in VNC session) to abort and re-run installation process ? Its looks like OPNSense 20.7 issue
opnsense.png


But after installation and trying to boot Debian from the insalled OS rather than the DVD ISO

What Debian profile (or ISO) did you use?
 
PaddyMac BTW, at first glance, converting OPNSense to a cloud image is a simple task ( need an easy way to edit /conf/config.xml ).
I prepared one (tested a little): if you try to update profiles via 'cbsd bconstruct-tui' -> 'vm_os_profile' -> 'Update/GIT' then you can use it right now!
I recorded a short demo. Forget the installers ;-)

PS: I hope the OPNSense developers can create an official cloud image, this is relevant in the era of cloud hosting platforms. ?
 
I tried the profile you suggested and set up a VM. There are two problems I'm having.

1) I saw an error message. I don't know if it's important or not. It says "operation not supported" when converting the image.

cloud-init: enabled
vm_iso_path: cloud-OPNSense-20-RELEASE-amd64
No such media: /usr/jails/src/iso/cbsd-cloud-OPNSense-20-RELEASE-amd64.raw in /usr/jails/src/iso
Shall i download it from: https://mirror.bsdstore.ru/cloud/?
[yes(1) or no(0)]
1
Download to: /usr/jails/src/iso/cbsd-cloud-OPNSense-20-RELEASE-amd64.raw
Scanning for fastest mirror...
Mirror source: Bytes per 3sec:
* [ 1/5 ] http://cbsd.lifec0re.net/cloud/: 1069056
* [ 2/5 ] http://electrode.bsdstore.ru/cloud/: failed
* [ 3/5 ] https://clonos.ca.ircdriven.net/cloud/: 8531968
* [ 4/5 ] https://clonos.us.ircdriven.net/cloud/: 2764800
* [ 5/5 ] https://mirror.bsdstore.ru/cloud/: 405504
Winner: https://clonos.ca.ircdriven.net/cloud/
Processing: https://clonos.ca.ircdriven.net/cloud/OPNSense-20-RELEASE-amd64.raw.xz
retrieve OPNSense-20-RELEASE-amd64.raw.xz from clonos.ca.ircdriven.net, size: 396m
/usr/jails/src/iso/OPNSense-20-RELEASE-amd64.r 396 MB 12 MBps 33s
Checking CRC sum: 1069f64d97fd74c4c227db0475b77b167bc0f0c9c09383a6d9f6b2c6e49a9a16...Passed
Extracting...
+ cd /usr/jails/src/iso
+ nice -n 19 idprio 29 xz -d OPNSense-20-RELEASE-amd64.raw.xz
+ set +o xtrace
Automatically register iso as: cbsd-cloud-OPNSense-20-RELEASE-amd64.raw
Path already exist for: cloud-OPNSense-20-RELEASE-amd64
Original size: 4g, real referenced size/data: 663m
Converting /usr/jails/src/iso/cbsd-cloud-OPNSense-20-RELEASE-amd64.raw -> /dev/zvol/zroot/ROOT/default/cbsd-cloud-OPNSense-20-RELEASE-amd64.raw: 4g...
/usr/local/cbsd/sudoexec/bstart: cannot create /dev/zvol/zroot/ROOT/default/cbsd-cloud-OPNSense-20-RELEASE-amd64.raw: Operation not supported

cloud init image initialization..
Clone cloud image into first/system vm disk (dd method)
WIP: [0%...13%...17%...34%...39%...46%...58%...66%...77%...89%...99%...99%1024+0 records in
1024+0 records out

2) I kept the default and let the VM have an ip address of 10.0.03, but it seems to have no internet. I can't ping the VM, and I can't connect via a web browser. This doesn't seem to be an issue with just this instance but an issue I've had with every VM I've tried to set up. I can connect via VNC, but that's not really connecting to inside the VM.
 
It is interesting. The system tries to use zvol (/dev/zvol/zroot/ROOT/default/cbsd-cloud-OPNSense-20-RELEASE-amd64.raw), but the gold image uses 'dd' (dd method). Is your system based on ZFS? Can you check the zfsfeat settings in cbsd initenv-tui . It must be set to 1 (for ZFS) in which case the gold image will use snapshots and COW for the cloud image.
 
If zfsfeat is ok, most likely it is a bug #238112. CBSD does not handle zvol path/name length (it can be fixed). I have not noticed this problem due to the use of FreeBSD-13 CURRENT ;). In this case, you can choose 'imgtype' as 'md' instead of 'zvol' in cbsd bconstruct-tui (but you will lose ZFS features as COW, snapshots..)
 
I'm marking this thread as SOLVED because I found that this is actually a known issue with OPNsense. It occurs on other VMs such as Hyper-V also. It's as simple as hitting CONTROL-c once or twice when the installer appears to lock up. It will drop back to the login screen. Just log back in with the installer username, and it will work fine during the second logon.
 
Back
Top