2

I'm trying to build vagrant boxes with concourse. I'm using the concourse/buildbox-ci image which is used in concourse's own build pipeline to build the concourse-lite vagrant box.

Before running packer I'm creating the virtualbox devices so they match the hosts devices. Nevertheless the packer build fails with:

==> virtualbox-iso: Error starting VM: VBoxManage error: VBoxManage: error: The virtual machine 'packer-virtualbox-iso-1488205144' has terminated unexpectedly during startup with exit code 1 (0x1)
==> virtualbox-iso: VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine
  • Has somebody got this working?
  • Is the concourse hetzner worker configuration accessible anywhere?

Additional configuration info:

in the concourse job container:

# ls -al /dev/vboxdrv /dev/vboxdrvu /dev/vboxnetctl
crw------- 1 root root 10, 53 Feb 27 14:19 /dev/vboxdrv
crw------- 1 root root 10, 52 Feb 27 14:19 /dev/vboxdrvu
crw------- 1 root root 10, 51 Feb 27 14:19 /dev/vboxnetctl

on the worker host:

# ls -al /dev/vbox*
crw------- 1 root root 10, 53 Feb 24 09:40 /dev/vboxdrv
crw------- 1 root root 10, 52 Feb 24 09:40 /dev/vboxdrvu
crw------- 1 root root 10, 51 Feb 24 09:40 /dev/vboxnetctl

concourse job:

jobs:
  - name: mpf
    serial_groups: [build]
    plan:
      - get: vagrant
        trigger: true
      - get: version
        resource: version-mpf
      - task: build
        privileged: true
        file: vagrant/ci/tasks/build.yml
        tags: [vm-builder]
        params:
          TEMPLATE_FILE: virtualbox-mpf.json

vagrant/ci/scripts/build.sh:

#!/bin/bash -ex

mknod -m 0600 /dev/vboxdrv c 10 53
mknod -m 0600 /dev/vboxdrvu c 10 52
mknod -m 0600 /dev/vboxnetctl c 10 51

for name in $(VBoxManage list hostonlyifs | grep '^Name:' | awk '{print $NF}'); do
    VBoxManage hostonlyif remove $name
done

VERSION=$(cat version/version)

packer build -var 'version=${VERSION}' vagrant/packer/${TEMPLATE_FILE}

vagrant/ci/tasks/build.yml:

---
platform: linux

image_resource:
  type: docker-image
  source: {repository: concourse/buildbox-ci}

inputs:
  - name: vagrant
  - name: version

outputs:
  - name: build

run:
  path: vagrant/ci/scripts/build.sh
Christoph Winkler
  • 6,278
  • 1
  • 18
  • 18

1 Answers1

2

Unfortunately the Hetzner worker configuration is basically just us periodically upgrading VirtualBox and fixing things when it falls over. (edit: we also make sure to use the same OS distro in the host and in the container - in our case, Arch Linux).

Make sure your VirtualBox version matches the version in the container - down to the patch version.

The device IDs (10,53 and 10,52 and 10,51) also must match those found on the host - these vary from version to version of VirtualBox.

We also make sure to use a special backend that does not perform any network namespacing, which is important if you're spinning up VMs that need a host-only network.

This whole thing's tricky. :/

Alex Suraci
  • 841
  • 5
  • 9
  • Currently I'm running Ubuntu 16.04 on the Host and in the Container but this doesn't work either. I'll try to set this up again on arch if I find time. Until then I'll tinker something with ssh/scp'ing around files. Thank you for your response, and thank you for concourse. Love it! – Christoph Winkler Mar 06 '17 at 10:30