Vagrant: Stderr: VBoxManage.exe: error: Could not rename the directory

Created on 13 Jan 2014  ·  17Comments  ·  Source: hashicorp/vagrant

Hello, so I am experiencing the same problem now with Win7 64 bit and Vagrant 1.4.3 and VBox 4.3.6. I see a lot of people do, too(Google helps to find them).

I've read the issues #1198, #1809 and #1817 which are related but all of them are closed. Is there any way to solve the problem? Just in case somebody is interested to help I paste the full output below:

HP@akhabibullina /cygdrive/c/work/js-sprint
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Setting the name of the VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["modifyvm", "2c7dff7f-3a05-4d7f-913f-bb903b999ae6", "--name", "js-vagrant"]

Stderr: VBoxManage.exe: error: Could not rename the directory 'C:\Users\HP\VirtualBox VMs\js-vagrant_1389604969925_48693' to 'C:\Users\HP\VirtualBox VMs\js-vagrant' to save the settings file (VERR_ALREADY_EXISTS)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component SessionMachine, interface IMachine, callee IUnknown
VBoxManage.exe: error: Context: "SaveSettings()" at line 2711 of file VBoxManageModifyVM.cpp

The name of VM is set explicitly as shown below and it doesn't help:

  config.vm.provider :virtualbox do |vb|
    vb.name = "js-vagrant"
  end

I also tried

vagrant up
vagrant halt
vagranth up

Which didn't help too.

I'd appreciate any help,
Anna.

Most helpful comment

Something that helped me:

  • Run shell as administrator
  • Run vagrant destroy
  • Start Virtual Box and make sure there are no VM related to the error in the list of VMs
  • Go to "C:\Users\ \VirtualBox VMs" and remove all of the VMs related to the error
  • In shell as an admin run vagrant up

The problem seem to lie in the fact the was already a VM that couldn't be modified b/c of lack of permissions/privileges.

I got the other problem though(#1622). If somebody has the other point of view, I'd be glad to know.

All 17 comments

Something that helped me:

  • Run shell as administrator
  • Run vagrant destroy
  • Start Virtual Box and make sure there are no VM related to the error in the list of VMs
  • Go to "C:\Users\ \VirtualBox VMs" and remove all of the VMs related to the error
  • In shell as an admin run vagrant up

The problem seem to lie in the fact the was already a VM that couldn't be modified b/c of lack of permissions/privileges.

I got the other problem though(#1622). If somebody has the other point of view, I'd be glad to know.

Thanks for info! I also had to run destroy and up again, but for me it didn´t work running the windows shell as administrator. I couldn´t find out what´s the concrete problem is, but therefor i am using vagrant :-P

I usually have this problem when I reboot my computer w/o stopping vagrant-powered virtual box machines. The machine actually exists in virtualbox VM list, but vagrant tries to create new one upon vagrant up, with the same name. This leads to the error mentioned above. This is annoying, because my provisioning process takes a lot of time (it imports large database dump). I have the same problem at 2 different laptops, both with Windows 7.

UPDATE: I've fixed the problem by changing machine ID in .vagrant/machines/default/virtualbox/id file to the one of existing VM. Last one can be found in .vbox file, e.g.

@gerkirill : i can't find the file you mentioned (.vagrant/machines/default/virtualbox/id) on my Win7 computer... Can you give me a hint?
I want to start the same vbox-vagrant-image from an external drive on 2 differetn Win7 PCs, but actually it doesn't work. Maybe using the same id helps...

if you want to do that, you need 2 things to happen at the same time.

  1. On both pcs have the external drive as the same letter/folder
    on both pcs set virtualbox to have the default folder for vms on the
    same external drive letter/folder
  2. have the same vagrant home.

this is not a bug, nor a feature request.. you can make this work as you
need,.. please sent an email to the mailing list and we can review it there

github issues are more for bugs..

thanks
alvaro.

On Thu, Aug 21, 2014 at 6:57 AM, Muckinger [email protected] wrote:

@gerkirill https://github.com/gerkirill : i can't find the file you
mentioned (.vagrant/machines/default/virtualbox/id) on my Win7 computer...
Can you give me a hint?
I want to start the same vbox-vagrant-image from an external drive on 2
differetn Win7 PCs, but actually it doesn't work. Maybe using the same id
helps...


Reply to this email directly or view it on GitHub
https://github.com/mitchellh/vagrant/issues/2813#issuecomment-52825626.

@muckinger : ".vagrant" folder I mentioned is located in your project directory (directory with Vagrantfile). Also - try to open the virtual machine in your VirtualBox GUI - just to make sure VirtualBox is aware of it.

In my case I narrowed these cases down to trying to provision boxes with a same "name", from 2 different accounts (think admin and your user account). The rename step will fail second time around for the box started with a different user account, since the directory vagrant is trying to rename to already exists, as it was created by the other account...

For me, I destroyed the box with the user account and the issue was gone when I tried to run it as admin!

Hello ,
In my case just delete folders in ~/VirtualBox VMs
if after you run vagrant up, this message "Your VM has become "inaccessible." Unfortunately, ..." appears
simply remove .vagrant from HOMESATED folder and type vagrant up again.

Hope this help :)

In my case, re-installation on oracle vm manager is work for me.

Thanks @mkharoub that worked for me. It fixed my problem.

I deleted the boxes on virtual box gui and that fixed it.

I ran into this error when I deleted a chef gem dependency (never again) and had to reinstall chefdk again.

Steps I had taken
1.) Going into the .VirtualBox directory

2.) make sure Virtualbox is not running, restart computer if confused.

3.) Edit Virtualbox.xml line 59 (well for me) change the location to a new directory, I just placed it in a directory within my Documents folder. Save. Save copy of previous xml file somewhere else for safety purposes.

4.) go to .vagrant.d\boxes --- you can delete past boxes that have been used before. Not sure if required.

5.) Turn on VirtualBox. you'll know if you didn't turn off VirtualBox because your xml file will be overwritten.

I've tried all the suggestions above but this was the only real solution. Good Luck!

I cannot find .VirtualBox directory, neither Virtualbox.xml. I am on a macOS Sierra.

Thank you

@mkharoub
thankq very much i stuked with this from last 20 days.
but now problem has been solved

thanks

Thanks so much @mkharoub, worked for me too.

In windows I removed the box using the Virtual Box Gui (kept the files) and then went into the "Virtual Box VMs" directory in the active Users directory (C:/users/[Active User]/Virtual Box Vms) and renamed the directory in question to ..._old (in my case sites_8bb48533874 > sites_8bb48533874_old). Ran vagrant up as admin and the environment came right up as usual.

I'm not sure if the initial step of removing the box was necessary...but these two steps worked nonetheless.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings