Recently, I had to restart my Vagrant to apply some changes. When I went to vagrant  up, a scary thing happened: vagrant started to download the entire box over again. Vagrant wasn’t detecting my existing box! Not only is this inconvenient if you have specific configurations you made to your Vagrant after the initial install, but it could be detrimental if you use Vagrant to hold your database and didn’t have a backup handy. Luckily, I was able to point Vagrant back in the right direction.

Problem Solving

I looked into my other Vagrants and saw that they had a number of files under:

.vagrant > machines > default > virtualbox > id

that my current box was missing all these files. I’m not sure how they got deleted, but they definitely weren’t there. I opened up the files in Sublime to see what was in there.

The Solution

To find out the ID of currently existing VMs, run the following in terminal:

$ VBoxManage list vms

You should see a list of all the VMs on your system. Find the one that matches the Vagrant you are trying to repair, and copy the ID from it. They will show in the following format: “name_of_vagrant” {id_of_vagrant_here} Now, create a new file called ‘id’ in your Vagrant directory under:

.vagrant > machines > default > virtualbox > id

and paste the ID of your VM into there. Finally, go back to terminal, run your vagrant up command and you should be good to go!


Discover more from zach wills

Subscribe to get the latest posts sent to your email.