OpenBSD Journal

Using OpenBSD With Vagrant and Veewee

Contributed by jcr on from the yo-dawg-I-heard-you-like-clouds dept.

Stefan Cocora (stefan.cocora<at>gmail) wrote in to tell us about using OpenBSD with vagrant and veewee.

Vagrant is a ruby-based open source programmatic management interface on top of virtualization (currently works with virtualbox, with planned support for kvm and others in future versions). Vagrant integrates with automated provisioning tools like puppet and chef to help you bring up the VM consistently every time (same package versions, same config files). If you mess up your OpenBSD VM beyond repair, then just destroy the instance and bring the VM back up again. It's great for learning, and allows you to make mistakes without having to reinstall OpenBSD.

site: www.vagrantup.com
code: github.com/mitchellh/vagrant

Vagrant Requirements:

  • ruby
  • virtualbox (from what I know OpenBSD doesn't support installing virtualbox, so you may need to run something else as the primary/host OS)
  • vagrant
  • an OpenBSD "base box" (Virtual Machine image)
  • a directory (typically named "./vagrant") containing a "./vagrant/Vagrantfile" configuration file with the following info (the below file is bundled with my OpenBSD base box for either amd64 or i386 on github)

Vagrant::Config.run do |config|
    config.vm.customize ["modifyvm", :id, "--memory", "256", "--name", "openbsd50_amd64"]
    config.vm.box="openbsd50_amd64"
    config.vm.guest=:openbsd
    config.vm.boot_mode = :gui
    config.ssh.timeout    = 300
    config.ssh.max_tries  = 50
end

You can invoke vagrant with the "vagrant up" command. Vagrant reads the "Vagrantfile" to know where to get the base box from (see docs) and then uses the virtualbox API to create your VM with the specified ram, cpu, networking, and other settings.

Example Usage:

Create and start the Virtual Machine

# vagrant up
Shut down the VM (may error with OpenBSD but will shutdown the VM)
# vagrant halt
Destroy the VM, but not the contents of your vagrant/ directory
# vagrant destroy

You can download OpenBSD base box images for vagrant from my github repository (specifically amd64 and i386), and you can find many other VM images contributed by others on the vagrantbox.es site. Vagrant doesn't always work perfectly with OpenBSD, please test it and if you find bugs submit them to the main vagrant github repository tracker.

Delving deeper to a complete OS installation from scratch, veewee behaves like installing your preferred operating system from a PXE installation, but does it programmatically (hence repeatably), without the need to set up DNS/tftp which are typically required for PXE installations. Everything happens on your desktop/laptop.

code: github.com/jedi4ever/veewee

With veewee you can create your own custom OS installation to use with vagrant or other forms of virtualization and avoid trusting the OS base boxes (images) created by others. The veewee README has the details, but all you need for veewee to work is ruby and the veewee ruby gem. Then you can list the templates bundled with veewee or create your own definitions from the provided templates. You'll find two templates for OpenBSD, one for i386 and another for amd64.

Why did I contribute to vagrant and veewee?

I like OpenBSD and I wanted an easier way of learning and breaking an OpenBSD installation, without installing it on a piece of hardware. These days, hardware is fast enough to accommodate multiple VMs running side by side with the primary OS.

(Comments are closed)


Comments
  1. By Philipp (pb) on

    The author of vagrant also offers a "box" creator: www.packer.io

    I cannot identify box downloads in your github? The linked veewee templates dont install via PXE but from an ISO. I am currently into the PXE installations and it's a bit hairy to say the least.

    One addition to the Vagrantfile reduces the need to install bash:
    config.ssh.shell = "/bin/ksh -l"

    Comments
    1. By jcr (jcr) on http://designtools.org

      > The author of vagrant also offers a "box" creator: www.packer.io
      >
      > I cannot identify box downloads in your github? The linked veewee templates dont install via PXE but from an ISO. I am currently into the PXE installations and it's a bit hairy to say the least.
      >
      > One addition to the Vagrantfile reduces the need to install bash:
      > config.ssh.shell = "/bin/ksh -l"
      >

      The 5.3 boxes are at http://www.vagrantbox.es/ but I'm not sure if they support PXE installs.

      Comments
      1. By stefan (94.11.4.14) on

        > > The author of vagrant also offers a "box" creator: www.packer.io
        > >
        > > I cannot identify box downloads in your github? The linked veewee templates dont install via PXE but from an ISO. I am currently into the PXE installations and it's a bit hairy to say the least.
        > >
        > > One addition to the Vagrantfile reduces the need to install bash:
        > > config.ssh.shell = "/bin/ksh -l"
        > >
        >
        > The 5.3 boxes are at http://www.vagrantbox.es/ but I'm not sure if they support PXE installs.

        Vagrant by default doesn't support installing from PXE. It is made to be used with an base "image" - basically the base of the OS.
        Then you install whatever else you need on top of that with configuration management tools or just shell(bash,ksh,...)

  2. By Carlos Valiente (81.168.12.40) carlos@pepelabs.net on

    Since shared folders are not supported for OpenBSD (as of VirtualBox 3.1.14 at least), adding the following snippet to the Vagrantfile makes "vagrant up" succeed:
      config.vm.synced_folder ".", "/vagrant", disabled: true
    

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]