VM has become 'inaccessible' - Vagrant no longer working
Asked Answered
M

13

52

For some reason this morning when I run 'vagrant up' I get the following error (this has worked absolutely fine for over a year)

Your VM has become "inaccessible". Unfortunately, this is a critical error with VirtualBox that Vagrant can not cleanly recover from. Please open VirtualBox and clear out your inaccessible virtual machines or find a way to fix them.

I could try removing my existing .vagrant folder and doing a vagrant up but that will take forever on our very slow internet speeds - can anyone suggest how to fix this quickly?

Macneil answered 5/6, 2015 at 9:15 Comment(1)
Possible duplicate of Oracle virtual box inaccessibleAfrica
M
18

This worked for me

After some digging through the debug output, I discovered that even though the actual VM is intact (I can load and run it from the VirtualBox GUI app), somewhere in its guts, VirtualBox flagged this VM as "". Vagrant, rightly believing what it's told, spits out the error message.

After looking at VBoxManage's help, I found that one its commands, list vms, unsurprisingly lists all of the VMs registered with VirtualBox:

$ /cygdrive/c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe list vms
"precise64" {3613de48-6295-4a91-81fd-36e936beda4b}
"<inaccessible>" {2568227e-e73d-4056-978e-9ae8596493d9}
"<inaccessible>" {0fb42965-61cb-4388-89c4-de572d4ea7fc}
"<inaccessible>" {c65b1456-5771-4617-a6fb-869dffebeddd}
"<inaccessible>" {9709d3d5-ce4d-42b9-ad5e-07726823fd02}

One of those VMs flagged as inaccessible is my lost VM! Time to fix VBoxManage's wagon, by unregistering the VM as inaccessible, then re-registering it with the correct name:

  1. Open the configuration file for your lost VM. Mine was saved to C:\cygwin\home\Philip\VirtualBox VMs\rails-vm-v2\rails-vm-v2.vbox
  2. Find and copy the value of the uuid attribute of the Machine node. Mine was 9709d3d5-ce4d-42b9-ad5e-07726823fd02.
  3. In a Windows command prompt (or Cygwin terminal), unregister the VM with the unregistervm command, using the [uuid] value from step 2:

    $ C:\Program Files\Oracle\VirtualBox\VBoxManage.exe unregistervm [uuid]
    
  4. Now register the VM using the registervm command, with the path to the VM configuration file:

    $ C:\Program Files\Oracle\VirtualBox\VBoxManage.exe registervm C:\cygwin\home\Philip\Virtual VMs\rails-vm-v2\rails-vm-v2.vbox
    

    Now you should be able to start the VM as expected.

Source : http://www.psteiner.com/2013/04/vagrant-how-to-fix-vm-inaccessible-error.html

Macneil answered 9/6, 2015 at 13:4 Comment(1)
this worked also in linux when used with vboxmanage command instead of VBoxManager.exe which obviously is not present in linuxFortnightly
T
157

this works for me:

In my "C:\Users{user}\VirtualBox VMs{vm-id}" folder are two files

  • {vm-id}.vbox-prev
  • {vm-id}.vbox-tmp

Renaming from "{vm-id}.vbox-tmp" to "{vm-id}.vbox" solved my problem and i can call "vagrant up"

Tenorite answered 13/8, 2015 at 12:50 Comment(6)
This works like a charm :) doodlebobbers.com/vagrant-error-your-vm-has-become-inaccessibleSarmentum
Try this one first, this answer is better than the accepted one as it is way simpler (IF it works for you that is). Worked like a charm for me too :)Markusmarl
Thanks, this was my case and how I solved it, but I chose to rename the {vm-id}.vbox-prev as .vbox and not the -tmp on the assumption that it could be corrupt. I did not have the time to diff them. I am (alas) on a windows 7 laptop.Mikey
Work on Win10 as well. Saved me a lot of time Thanks!Mezzosoprano
This works perfectly than building your VM again from the scratch. Simple and most relevant solution to the problem!Hymenium
In my case i had .vbox and a .vbox-prev, I renamed .vbox to .vbox-backup and .vbox-prev to .vbox. then it worked again. Same applies for Homestead/laravel as was my original reason for searching.Cornelison
S
41

You can simply delete the .vagrant folder from your project folder and run vagrant up again.

Soup answered 16/10, 2015 at 14:23 Comment(2)
Deleting the .vagrant folder might cause vagrant to re-create the VM from scratch. If you need to repair the VM that is broken, this is probably not the right way to go. If the VM is totally disposable and re-creatable, then this is an easy way to go to fix the problem.Devaluation
This worked for me, remove the .vagrant file and delete the folder C:\Users\{username}\VirtualBox VMs\{yourVM} and then reboot.Production
M
18

This worked for me

After some digging through the debug output, I discovered that even though the actual VM is intact (I can load and run it from the VirtualBox GUI app), somewhere in its guts, VirtualBox flagged this VM as "". Vagrant, rightly believing what it's told, spits out the error message.

After looking at VBoxManage's help, I found that one its commands, list vms, unsurprisingly lists all of the VMs registered with VirtualBox:

$ /cygdrive/c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe list vms
"precise64" {3613de48-6295-4a91-81fd-36e936beda4b}
"<inaccessible>" {2568227e-e73d-4056-978e-9ae8596493d9}
"<inaccessible>" {0fb42965-61cb-4388-89c4-de572d4ea7fc}
"<inaccessible>" {c65b1456-5771-4617-a6fb-869dffebeddd}
"<inaccessible>" {9709d3d5-ce4d-42b9-ad5e-07726823fd02}

One of those VMs flagged as inaccessible is my lost VM! Time to fix VBoxManage's wagon, by unregistering the VM as inaccessible, then re-registering it with the correct name:

  1. Open the configuration file for your lost VM. Mine was saved to C:\cygwin\home\Philip\VirtualBox VMs\rails-vm-v2\rails-vm-v2.vbox
  2. Find and copy the value of the uuid attribute of the Machine node. Mine was 9709d3d5-ce4d-42b9-ad5e-07726823fd02.
  3. In a Windows command prompt (or Cygwin terminal), unregister the VM with the unregistervm command, using the [uuid] value from step 2:

    $ C:\Program Files\Oracle\VirtualBox\VBoxManage.exe unregistervm [uuid]
    
  4. Now register the VM using the registervm command, with the path to the VM configuration file:

    $ C:\Program Files\Oracle\VirtualBox\VBoxManage.exe registervm C:\cygwin\home\Philip\Virtual VMs\rails-vm-v2\rails-vm-v2.vbox
    

    Now you should be able to start the VM as expected.

Source : http://www.psteiner.com/2013/04/vagrant-how-to-fix-vm-inaccessible-error.html

Macneil answered 9/6, 2015 at 13:4 Comment(1)
this worked also in linux when used with vboxmanage command instead of VBoxManager.exe which obviously is not present in linuxFortnightly
S
9

Nothing here worked for me.

  1. I deleted (or renamed see first comment) all files from

C:\Users[YourNameHere].VirtualBox

  1. Run vagrant again:

    vagrant up

Now it's up.

Soloma answered 24/1, 2017 at 18:34 Comment(2)
This worked for me, renamed my .VirtualBox just incase and run homestead up/vagrant up.Snack
i'll add this to my solution tySoloma
B
6

VirtualBox Manager will likely give you a bit more useful information, for example in my case it reported that the .vbox file did not exist.

After taking a look the problem was indeed that the file didn't exist - something had renamed it to x.vbox-tmp (shutting the PC down with the VM still running maybe?)

I copied the x.vbox-prev file to x.vbox and tried booting the VM again and everything worked fine.

Bolt answered 12/7, 2017 at 8:19 Comment(4)
I picked the other file, the homestead-7.vbox-tmp and renamed that back to homestead-7.vbox and again it worked.Saporous
I also chose .vbox-prev over x.vbox-tmp, with the thinking that the temp one might have inconsistencies from unexpected termination. (Thank you windows update.)Bubo
The reason for my case is indeed shutting the PC down with the VM still runnning. ThanksAbide
It worked for me too... Perhaps caused by a system crash.. For quick reference: the vbox file can be found at "<User Directory>\VirtualBox VMs" for Windows.Dozier
P
5

Find the one which is inaccessible with one of the following commands:

$ vagrant global-status

or:

$ VBoxManage list vms

Then note the GUID, and remove it from VirtualBox.xml file (OS X: ~/Library/VirtualBox/VirtualBox.xml, Windows: %HOME%/.VirtualBox).

Alternatively remove .vagrant folder from the folder where is your VM and start from scratch (vagrant up).

See also: Cannot Delete "Inaccessible" virtual machines from Virtualbox GUI at VirtualBox

Perak answered 27/2, 2016 at 22:6 Comment(0)
F
4

By chance if someone deletes your vm from VirtualBox VMs folder manually, also in this case your vm would become inaccessible. However, you will not be able to get your machine back but vagrant will still show your vm in the list. To remove it completely from the vm list, go to

\.vagrant.d\data\machine-index 

and open index file. Delete the reference of inaccessible machine. Next time when you run below command, it will not show your inaccessible machine.

vagrant global-status --prune
Footless answered 22/1, 2018 at 8:56 Comment(1)
Thanks! It is used to deleted the cache created earlier, so it sows the latest status.Footless
D
2

My problem was the same, but the fix was quite different... my VMs are stored on a network drive, accessible by NFS share. The remote drive had failed to come up after a reboot, so the VMs weren't accessible. Took me a while to realise the reason, and meantime hunted all over SO without a solution.

Then I realised, facepalmed, mounted the paths, and it all worked.

So in a nutshell, it was a path issue.

I felt I should include it here in case it helps someone in the same boat.

Dextroglucose answered 1/5, 2017 at 6:23 Comment(0)
S
2

By using command line, you can remove all inaccessible boxes by using an one-liner:

VBoxManage list vms |grep inaccessible |cut -d "{" -f2 |cut -d "}" -f1 |xargs -L1 VBoxManage unregistervm 

See https://phz.fi/?p=8422

Squatter answered 25/7, 2020 at 10:9 Comment(0)
O
1

I had to rename [vm-id].vbox-tmp (on VirtualBox VMs) to [vm-id].vbox. After that, without delete the .vagrant folder, I could run vagrant up and it worked very well.

Obtund answered 4/1, 2018 at 22:13 Comment(1)
This seems like the same solution as described in the answer of @Danny Wheeler and the suggestions in its comments.Pinkeye
L
1

On Linux the following will unregister the machines:

VBoxManage list vms
VBoxManage unregistervm <inaccessible machine UID>

After that you may want to restart VB services:

sudo /sbin/vboxconfig

Deleting .vagrant folder may help but you had to rebuild the machines.

Leanaleanard answered 21/4, 2020 at 20:41 Comment(0)
N
0

I also had this problem. when change directory of virtualBox after restart macOS virtualbox get inaccessible to all vms.

my solution worked.

just move virtual box to default directory. remove all inaccesible vms from gui, then register vms from default path next run it.

or

vagrant up
Nefarious answered 19/11, 2020 at 20:10 Comment(0)
M
0

Try deleting from oracle VM manager. You can see inaccessible boxes, by removing them it should fix it. worked for me.

oracle VM box

Myramyrah answered 1/3, 2023 at 4:6 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Unctuous

© 2022 - 2024 — McMap. All rights reserved.