I want to use ubuntu/xenial64
box to create two separate VMs for two separate projects. I defined Vagrantfile in two separate project directories and added the line
I found that it is simpler to edit the original box's Vagrantfile
(located ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/<VERSTION>/virtualbox/Vagrantfile
) rather than thinking about unique VM names each time.
Working config of Vagrantfile (box!):
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)
Vagrant.configure("2") do |config|
config.vm.base_mac = "0223C61ABA59"
config.ssh.username = "ubuntu"
config.ssh.password = "86f7d0e04910475d8789aa8f"
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.provider "virtualbox" do |vb|
vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
end
end
You dont need to delete the other VM and indeed you can certainly have many VMs from the same box.
your error might have to do with the VirtualBox Name of the VM created in VirtualBox, If you have override a property to set this name and its the same name on your 2 projects then there will be a collision, see this answer to see the different ways to define the name of the VM
so either leave vagrant define the name of the VM or make sure you have unique VM name in your different project and it will run just fine
UPDATE I check this particular box and it contains the following Vagrantfile
Vagrant.configure("2") do |config|
config.vm.base_mac = "02101FC67BA9"
config.ssh.username = "ubuntu"
config.ssh.password = "c1580f876b655137c6c35b69"
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
so make sure in your Vagrantfile to override this property
config.vm.provider "virtualbox" do |vb|
vb.name = "your specific project name"
and change the vb.name
to be unique for each of your projects.