Vagrant: Can't create second ubuntu/xenial64 instance

Created on 3 Jun 2016  路  5Comments  路  Source: hashicorp/vagrant

Vagrant version

Vagrant 1.8.1

Host operating system

MacOS El Capitan 10.11.5

Guest operating system

Ubuntu 16.04 LTS

Vagrantfile

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/xenial64"
end

Debug output

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/xenial64' is up to date...
A VirtualBox machine with the name 'ubuntu-xenial-16.04-cloudimg' already exists.
Please use another name or delete the machine with the existing
name, and try again.

Expected behavior

Second virtual machine with ubuntu 16.04 is created.

Actual behavior

Second virtual machine with ubuntu 16.04 is not created.

Steps to reproduce

  1. mkdir node1 node2
  2. cd node1
  3. vagrant init ubuntu/xenial64
  4. vagrant up
  5. cd ../node2
  6. vagrant init ubuntu/xenial64
  7. vagrant up
waiting-reply

Most helpful comment

Hi @zhdanovartur

Thank you for that. I spent about an hour tracing down this issue, and, unfortunately, it is actually an issue with that base box. For a little bit of background - base boxes can package their own Vagrantfile that gets merged with _your_ Vagrantfile to define some common configuration and settings.

Here is the Vagrantfile that the ubuntu/xenial64 box is loading (you can find this in ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20160531.0.0/virtualbox/Vagrantfile):

Vagrant.configure("2") do |config|
  config.vm.base_mac = "0227536041F1"
  config.ssh.username = "ubuntu"
  config.ssh.password = "ef360fd092f03db9cc3f8aa0"
  config.vm.synced_folder '.', '/vagrant', disabled: true

  config.vm.provider "virtualbox" do |vb|
     vb.name = "ubuntu-xenial-16.04-cloudimg"
     vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
     vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "%s-console.log" % vb.name) ]
  end
end

Virtualbox requires that machine names are unique, and Vagrant has special code to set the name to a unique value. However, as you may notice, that code only runs if the provider was not given a specific name. If the user wants to give the box a name, we have to respect that configuration.

We will bring this to the attention of the box creator, but please note that Atlas (formerly VagrantCloud) is structured similar to GitHub; there are no "official" boxes. The boxes published under the ubuntu namespace are merely owned by that organization - they are not the official boxes. I would recommend giving the boxes under the bento namespace a try. Many users have traditionally had more success with those. Thanks and sorry! 馃槃

All 5 comments

Hi @zhdanovartur

Can you please share the complete debug output from both vagrant up commands?

Hi @zhdanovartur

Thank you for that. I spent about an hour tracing down this issue, and, unfortunately, it is actually an issue with that base box. For a little bit of background - base boxes can package their own Vagrantfile that gets merged with _your_ Vagrantfile to define some common configuration and settings.

Here is the Vagrantfile that the ubuntu/xenial64 box is loading (you can find this in ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20160531.0.0/virtualbox/Vagrantfile):

Vagrant.configure("2") do |config|
  config.vm.base_mac = "0227536041F1"
  config.ssh.username = "ubuntu"
  config.ssh.password = "ef360fd092f03db9cc3f8aa0"
  config.vm.synced_folder '.', '/vagrant', disabled: true

  config.vm.provider "virtualbox" do |vb|
     vb.name = "ubuntu-xenial-16.04-cloudimg"
     vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
     vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "%s-console.log" % vb.name) ]
  end
end

Virtualbox requires that machine names are unique, and Vagrant has special code to set the name to a unique value. However, as you may notice, that code only runs if the provider was not given a specific name. If the user wants to give the box a name, we have to respect that configuration.

We will bring this to the attention of the box creator, but please note that Atlas (formerly VagrantCloud) is structured similar to GitHub; there are no "official" boxes. The boxes published under the ubuntu namespace are merely owned by that organization - they are not the official boxes. I would recommend giving the boxes under the bento namespace a try. Many users have traditionally had more success with those. Thanks and sorry! 馃槃

@sethvargo thanks!

vagrant init bento/ubuntu-16.04

works fine for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lebogan picture lebogan  路  3Comments

barkingfoodog picture barkingfoodog  路  3Comments

RobertSwirsky picture RobertSwirsky  路  3Comments

janw-me picture janw-me  路  3Comments

StefanScherer picture StefanScherer  路  3Comments