Vagrant Up 失败,因为名称已存在 [英] Vagrant Up failing because the name already exists

查看:36
本文介绍了Vagrant Up 失败,因为名称已存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始在本地 Wordpress 开发环境中使用 Virtualbox、Vagrant 和 VVV.它非常光滑.

I've recently started using Virtualbox, Vagrant and VVV for my local Wordpress development environment. It's very slick.

我遇到的一个问题是,在使用 'vagrant pause' 关闭后,下次我使用 'vagrant up' 开始时,我收到此错误:

One issue I've had is that after shutting things down with 'vagrant halt', the next time I start with 'vagrant up' I get this error:

==> default: Setting the name of the VM: vagrant-local 
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:\VirtualBox VMs\ubuntu-cloudimg-trusty-va
230_94704' to 'C:\VirtualBox VMs\vagrant-local' to save the settings file (VERR_ALREADY_EXISTS)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component SessionMachine, interface IMac
VBoxManage.exe: error: Context: "SaveSettings()" at line 3015 of file VBoxManageModifyVM.cpp

我访问了 C:\VirtualBox VMs\ 列出的位置,确实,该目录 'vagrant-local' 已经存在.如果我删除(或重命名)这个目录并再次运行vagrant up",机器就会启动.但是,它还执行完整的配置过程.当然,这需要很长时间.

I visit the location listed C:\VirtualBox VMs\ and indeed, that directory 'vagrant-local' already exists. If I delete (or rename) this directory and run 'vagrant up' again, the machine starts. But, it also performs the full provisioning process. Which, of course, takes a very long time.

我正在使用 VVV 和 Vagrant 开箱即用的所有默认配置.我应该怎么做才能帮助 VirtualBox正确清理"并认识到它不需要每次停止和重新启动时都重新创建 VM.

I'm using all the default configurations for VVV and Vagrant out-of-the-box. What should I do to help VirtualBox "clean up properly" and recognize that it doesn't need to recreate the VM every time I halt and restart.

或者,我只是错过了什么?

Or, am I just missing something?

如果不是首选,欢迎初学者级别"回复.我是这方面的初学者,非常感谢您的帮助!谢谢.

"Beginner level" responses are welcome, if not preferred. I'm a beginner in this area and I appreciate the help! Thanks.

当前状态:我已经从 C:\VirtualBox VMs\ 中删除了有问题的 VM;以管理员身份运行 Git Bash,我已经能够再次使用 vagrant up(发生完全配置)、vagranthaltvagrant up全部都有预期的结果(在第二个 up 上没有配置).截至目前,似乎一切正常.出现... :)

CURRENT STATUS: I've deleted the VM in question from C:\VirtualBox VMs\; Running Git Bash as administrator, I've been able to use vagrant up (full provision takes place), vagrant halt, and vagrant up again all with expected results (no provisioning on second up). As of now, it appears that everything is working. Appears... :)

推荐答案

嗯 .. 这是一个奇怪的问题.当你运行 vagrant Hamilton 时,它只是发送信号来终止 VM.

Hum .. This is a weird issue. when you run vagrant halt it just send signal to terminate the VM.

Vagrant 将所有配置保存在 .vagrant 目录下(至少对于 mac os 和 linux,不完全确定如果是 windows),你不应该删除这个目录,因为它包含对你的所有引用vm,所以当你下次运行vagrant up时,vagrant会从这个目录中搜索信息来启动对应的vm,它知道不需要重新创建VM和provisioning.

Vagrant keeps all the configuration under a .vagrant directory (at least for mac os and linux, not fully sure if windows) , you should never delete this directory as it has all the reference to your vm, so when you run vagrant up next time, vagrant will search for information from this directory to start the corresponding vm, and it knows it does not need to recreate the VM nor provisioning.

删除虚拟机信息的正确方法是运行vagrant destroy,它会删除所有的.vagrant 目录和虚拟机.

The correct way to remove information about your vm is to run vagrant destroy, it will delete all the .vagrant directory and the vm.

然后是从 .vagrant 和你的虚拟机再次建立这种联系的方法,但它有点棘手,不确定它们是否得到官方支持

The are then ways to make this linkage again from .vagrant and your vm but its a bit tricky and not sure they are officially supported

当你使用 vagrant 时,VirtualBox 应该变得(几乎)透明,你不需要启动它来使用你的 VM,一切都应该从 vagrant 运行(至少在初学者级别)

When you use vagrant, VirtualBox should become (almost) transparent, you should not need to start it to use your VM, everything should be run from vagrant (at least at beginner level)

注意:在windows上运行,以管理员身份运行应该没问题

Note : running on windows, you should be fine if you run as administrator

这篇关于Vagrant Up 失败,因为名称已存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆