Start an osx virtualbox from ubuntu using vagrant


I am using Ubuntu 20.04 LTS, and am managing multiple VMs on it using Vagrant (with the purpose of using them as slaves in a Jenkins instance). I have successfully set several Ubuntu, Fedora and CentOs VMs (using images from Vagrant Cloud) without any problem. However, I am unable to launch any osx box. I am consistently getting the following error :

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ramsey/macos-catalina'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ramsey/macos-catalina' version '1.0.0' is up to date...
==> default: Setting the name of the VM: exa-test-osx_default_1611737556427_94915
==> default: Fixed port collision for 22 => 2222. Now on port 2202.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2202 (host) (adapter 1)
==> default: Resized disk: old 65536 MB, req 102400 MB, new 102400 MB
==> default: You may need to resize the filesystem from within the guest.
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "8ae463d5-7930-4f6b-88b4-667028240125", "--type", "headless"]

Stderr: VBoxManage: error: The virtual machine 'exa-test-osx_default_1611737556427_94915' has terminated unexpectedly during startup with exit code 1 (0x1)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine

Here is my Vagrantfile file :

$install = <<SCRIPT
sudo sysadminctl -addUser jenkins -shell /bin/bash -home /home/jenkins
echo 'jenkins:jenkins' | sudo chpasswd jenkins
sudo su -s /bin/bash jenkins
mkdir /home/jenkins/.ssh
echo 'jenkins' | sudo chown -R jenkins:jenkins /home/jenkins/.ssh
echo 'jenkins' | sudo chmod 755 /home/jenkins/.ssh

brew install git cmake openmpi emacs
brew cask install java

Vagrant.configure("2") do |config| = "ramsey/macos-catalina"
  config.vm.box_version = "1.0.0"
  config.vm.hostname = "exa-test-osx"
  config.disksize.size = "100GB" :private_network, ip: ""
  config.ssh.forward_agent = true
  config.vm.provision "shell", inline: $install
  ssh_pub_key = File.readlines("#{Dir.home}/.ssh/").first.strip
  config.vm.provision 'shell', inline: "echo #{ssh_pub_key} >> /Users/jenkins/.ssh/authorized_keys"
  config.vm.provision 'shell', inline: "echo 'jenkins' | sudo chmod 644 /Users/jenkins/.ssh/authorized_keys"

I am using Vagrant 2.2.9 with virtualbox 6.1.16.

asked on Stack Overflow Jan 27, 2021 by Scrimbibete

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0