Skip to content

Instantly share code, notes, and snippets.

@ClaesBas
Last active June 18, 2024 20:11
Show Gist options
  • Save ClaesBas/42426e177ec563aab5520eadf0c5773b to your computer and use it in GitHub Desktop.
Save ClaesBas/42426e177ec563aab5520eadf0c5773b to your computer and use it in GitHub Desktop.
How to install OpenBSD on SmartOS with bhyve hypervisor (OpenBSD65 and SmartOS 20190424)
How to install OpenBSD with bhyve-vm on SmartOS (20190424):
tl;dr:
Create a bhyve vm with an empty disk, where you put an install image with dd afterwards.
"bhyve_extra_opts": "-w"
"bootrom": "uefi"
"vcpus": 1 (is needed too, some say..)
Change to serial console when booting the install image
Do it like this:
I've my json manifests stored in /opt/manifests, so I can reuse them.
Create a manifest like below with values matching your environment and resources.
# cat openbsd65.json
{
"alias": "OpenBSD",
"autoboot": false,
"brand": "bhyve",
"hostname": "obsd",
"resolvers": [
"8.8.8.8",
"8.8.4.4"
],
"ram": 1024,
"vcpus": 1,
"nics": [
{
"interface": "net0",
"model": "virtio",
"nic_tag": "admin",
"ip": "172.34.56.78",
"gateway": "172.34.56.1",
"netmask": "255.255.255.0",
"primary": true
}
],
"disks": [
{
"boot": true,
"model": "virtio",
"size": 16384,
"compression": "on"
}
],
"bootrom": "uefi",
"bhyve_extra_opts": "-w"
}
#--------------
# Create the bhyve machine (with at least one empty disk):
vmadm create < openbsd65.json
#--------------
# Get the uuid for this new bhyve machine:
uuid=`vmadm list -p -o uuid alias=OpenBSD`
#--------------
# If not autoboot=false, stop the vm:
vmadm stop $uuid -F
#--------------
# Download an install image:
cd /var/tmp
wget http://cdn.openbsd.org/pub/OpenBSD/6.5/amd64/install65.fs
# ------------
# Prepare the disk with the install image:
dd if=install65.fs of=/dev/zvol/rdsk/zones/$uuid/disk0 bs=1M
# ------------
# Open one more SSH-session and start a console to this machine from within
# This is possible even if the vm is not running.
# We need this to fix serial console (soon)
zlogin -C `vmadm list -p -o uuid alias=OpenBSD`
# ------------
# Get back to original session with the console session visible,
# and boot up the vm
vmadm start $uuid
# ------------
# In the "console", when boot prompt shows up, enable serial console and boot:
set tty com0
boot
# ------------
# Install it (on the same disk as you booted from).
# Everything is "normal" from here
# That's all folks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment