Skip to content

A Packer + Vagrant setup to learn about OpenBSD

Notifications You must be signed in to change notification settings

craig-m/openbsd-box

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenBSD-Box

alt text

An OpenBSD learning/dev VM to be built and run from your own desktop.

Created by Packer and run by Vagrant.

build OpenBSD VM

Packer will download the OpenBSD installation media, stable installXX.iso, and then handle the full install start to finish - all automatically - with the end result being a reusable image to create virtual machines from.

Check the packer HCL:

cd packer
packer validate openbsd.pkr.hcl
packer inspect openbsd.pkr.hcl

Debugging packer builds

Logging is set by changing this environment variable, if anything goes wrong verbosity can be increased.

Windows (powershell):

$env:PACKER_LOG=4

Mac, Linux, BSD:

export PACKER_LOG=4

You can use the env var PACKER_LOG_PATH=/tmp/packer.log to set a log file.

VirtualBox

VirtualBox build

packer build -only=openbsd-vb -force openbsd.pkr.hcl

HyperV

Hyper-V build on Windows desktops

packer build -only=openbsd-hv -force openbsd.pkr.hcl
Hyper-V notes

You can enable nesting on HyperV. On an existing shutdown Vagrant vm:

Set-VMProcessor -VMName openbsd -ExposeVirtualizationExtensions $true

You need to do this to use vmm, the OpenBSD hypervisor.

QEMU

QEMU is a generic and open source machine emulator and virtualizer.

QEMU build

packer build -only=openbsd-qu -force openbsd.pkr.hcl

You will need a VNC client to monitor progress.

VMWare

VMware build

packer build -only=openbsd-vw -force openbsd.pkr.hcl

Vmware needs testing still.

run OpenBSD VM

Vagrant is a tool for managing portable virtual machines, it's a wrapper on virtualization.

This imports the Box we just made with Packer and will then create a VM from it:

vagrant box add boxes/OpenBSD.box --name OpenBSD.box
cd ../vagrant
vagrant validate Vagrantfile
vagrant up

use

Login:

vagrant ssh
man intro

You might want to use vagrant rsync-auto in a separate shell.

clean up

Remove everything when finished:

exit
vagrant destroy
vagrant box remove OpenBSD.box

scripts

The steps above have been automated in build.{sh,ps1} and clean.{sh,ps1}.

./build.ps1
vagrant ssh
tmux
exit
./clean.ps1

For better or worse, you can install Powershell on MacOS and Linux.

Win 10 includes Windows Subsystem for Linux which Vagrant also supports WSL.

Doco

Useful documentation + code + guides

man afterboot
man security

OpenBSD Docs

About

A Packer + Vagrant setup to learn about OpenBSD

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published