vagrant
VirtualBox

Vagrant - エラー別Tips

削除済の仮想マシンが$ vagrant global-statusで表示されてしまう

対応

  • --pruneオプションをつける
$ vagrant global-status --prune

ref: vagrant global-status --pruneでゾンビ仮想マシンを削除する

$ vagrant upできない

エラー内容

「同じ名前の仮想マシンがすでに存在します」というエラーが出る。

The name of your virtual machine couldn't be set because VirtualBox
is reporting another VM with that name already exists. Most of the
time, this is because of an error with VirtualBox not cleaning up
properly. To fix this, verify that no VMs with that name do exist
(by opening the VirtualBox GUI). If they don't, then look at the
folder in the error message from VirtualBox below and remove it
if there isn't any information you need in there.

VirtualBox error:

VBoxManage: error: Could not rename the directory '/Users/ユーザー名/VirtualBox VMs/box名_1462242910494_8413' to '/Users/ユーザー名/VirtualBox VMs/box名 to save the settings file (VERR_ALREADY_EXISTS)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "SaveSettings()" at line 3016 of file VBoxManageModifyVM.cpp

対応

  1. マシン名を指定して$ vagrant destroy
  2. $ vagrant box remove
  3. Boxディレクトリの削除

ref: vagrant upで A VirtualBox machine already exists.とでる解決方法