海滨擎蟹

vagrant 启动 homestead 虚拟机报错:error could not rename the directory

Mac 下,按照 laravel-china 提供的 vagrant 和 virtualbox 部署本地开发环境。之前是配置好的,但 Mac 升级后之前的 virturalbox 5.2.12版本与新系统不兼容,无法继续使用,只能下载新版本。

官网下载,最新版本到达了 6.0.2,尝试下载安装。vagrant 虚拟机管理脚本报错,提示支持的 virtualbox 版本只到 5.2.x,vagrant 当前版本为 2.1.1。要么继续升级vagrant版本,要么尝试下载 5.2.12 ~ 6.x 中间的virtualbox 版本。看到有帖子说,5.2.20 版本可兼容新 Mac 系统,我便选择了后者,下了一个 6.x 之前 5.2.x 里的最新版本:5.2.24

安装后,倒入下载好的 lc.homestead.6.1.1 虚拟机到当前环境,下载并配置好 homestead 管理脚本,启动虚拟机( cd ~ && vagrant up )。启动报错:

JasondeMac-mini:Homestead jasonli$ vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Checking if box 'lc/homestead' is up to date...
==> homestead-7: Setting the name of the VM: homestead-7
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/jasonli/VirtualBox VMs/lt-settler_default_1536057652853_60940_1548435354863_58533' to '/Users/jasonli/VirtualBox VMs/homestead-7' 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 3123 of file VBoxManageModifyVM.cpp

将错误信息拿到,百度:VBoxManage: error: Could not rename the directory

找到并实验成功一个解决方案:vboxmanage.exe error could not rename the directory - Stack Overflow

I tried:

vagrant destroy -f
manually deleting the virtualboxes in their directory
restarting my machine
reinstalling both vagrant and virtualbox
downgrading vagrant and virtualbox
running with sudo
and nothing worked. The only thing that worked for me was opening Virtualbox interface and going to Preferences and changing the Default Machine Folder from VirtualBox VMs to just VMs

Wasted about 4 hours of my time on that problem. Hopefully someone with the same problem finds this post.

打开 virturalbox,选择偏好设置,修改默认的虚拟机文件夹,将之从 VirtualBox VMs 改为 VMs,就好了。

没理解原因,但方法确实简单有效。

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »