Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vagrant up is not starting the vm in .vagrant\machines\default\virtualbox\id

Tags:

vagrant

When I run vagrant up, a new virtualbox machine is created rather than running the virtualmachine identified in .vagrant\machines\default\virtualbox\id. The id of the new virtual machine is then written to the id file.

My VMs:

C:\Users\Chris>vboxmanage  list vms
"MyVM_1373377014" {177aef6c-b9ec-4a85-adad-76c70f80fa62}

Next:

C:\Users\Chris>echo 177aef6c-b9ec-4a85-adad-76c70f80fa62 > .vagrant\machines\default\virtualbox\id

Followed by:

C:\Users\Chris>vagrant up

Results in a new VM:

C:\Users\Chris>vboxmanage  list vms
"MyVM_1373377014" {177aef6c-b9ec-4a85-adad-76c70f80fa62}
"MyVM_1373566342" {4fedb342-cc0b-40fd-a8d1-403049065274}

And the id containing the new VM id:

C:\Users\Chris>type .vagrant\machines\default\virtualbox\id
4fedb342-cc0b-40fd-a8d1-403049065274

So a new VM is created for some reason rather than starting the existing one.

I'm running Vagrant version 1.2.3

like image 240
Chris Snow Avatar asked Jul 11 '13 18:07

Chris Snow


1 Answers

Make sure a newline isn't added to the ID. Therefore, instead of this:

echo "177aef6c-b9ec-4a85-adad-76c70f80fa62" > .vagrant/machines/default/virtualbox/id

I had to do this:

echo -n "177aef6c-b9ec-4a85-adad-76c70f80fa62" > .vagrant/machines/default/virtualbox/id

Note the -n switch to the echo command.

Sources:

  • https://github.com/mitchellh/vagrant/issues/1755
  • How do I associate a Vagrant project directory with an existing VirtualBox VM?
like image 71
Chris Snow Avatar answered Oct 13 '22 15:10

Chris Snow