执行:vagrant up 时报错:The name of your virtual machine couldn’t be set because VirtualBox is reporting another VM with that name already exists.

1、执行:vagrant up 时报错:The name of your virtual machine couldn’t be set because VirtualBox
is reporting another VM with that name already exists.。如图1

图1

Lenovo@DESKTOP-QLPK8QM MINGW64 ~/Homestead (v12.1.0)
$ vagrant up
Bringing machine 'homestead' up with 'virtualbox' provider...
==> homestead: Importing base box 'lc/homestead'...
==> homestead: Matching MAC address for NAT networking...
==> homestead: Checking if box 'lc/homestead' version '11.0.0' is up to date...
==> homestead: Setting the name of the VM: homestead
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.exe: error: Could not rename the directory 'C:\Users\Lenovo\VirtualBox VMs\lt-settler_default_1614481073061_45587_1661751471272_95685' to 'C:\Users\Lenovo\VirtualBox VMs\homestead' 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 3265 of file VBoxManageModifyVM.cpp

2、删除 vagrant 后,再打开 VirtualBox GUI,确认是否存在,如果存在,再手动删除掉虚拟机。如图2

图2

Lenovo@DESKTOP-QLPK8QM MINGW64 ~/Homestead (v12.1.0)
$ vagrant destroy
    homestead: Are you sure you want to destroy the 'homestead' VM? [y/N] y
==> homestead: Destroying VM and associated drives...


3、基于提示,删除掉目录:C:\Users\Lenovo\VirtualBox VMs\homestead。如图3

图3

4、再次执行:vagrant up。不再报错。如图4

图4

Lenovo@DESKTOP-QLPK8QM MINGW64 ~/Homestead (v12.1.0)
$ vagrant up
Bringing machine 'homestead' up with 'virtualbox' provider...
==> homestead: Checking if box 'lc/homestead' version '11.0.0' is up to date...
==> homestead: Running provisioner: file...
Guest-specific operations were attempted on a machine that is not
ready for guest communication. This should not happen and a bug
should be reported.

永夜