Chris Snow
Chris Snow

Reputation: 24588

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

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

Upvotes: 13

Views: 7038

Answers (1)

Chris Snow
Chris Snow

Reputation: 24588

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:

Upvotes: 16

Related Questions