Virtualbox无法连接,可能是由于Windows防火墙问题,Vagrant无法启动。

3

我有一个Ubuntu 14.04的Vagrant虚拟机,想在Windows 10上使用。

虚拟机本身没有问题,在其他系统上可以正常使用。

我的Virtualbox版本目前是5.1.28,我尝试了最新版本,但出现了问题,因此我回滚到了5.1.28,但问题仍未解决。

我的Vagrant版本是2.0.0。

当我运行vagrant up时,会得到以下输出:

λ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'dev_box'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: Dev_default_1512943736797_96012
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: bridged
==> default: Forwarding ports...
    default: 3000 (guest) => 3000 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'unknown' state. Please verify everything is configured
properly and try again.

If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.

The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.

我认为这可能是防火墙的问题,所以我禁用了防火墙,但仍然看到相同的问题。

如何在Windows 10上让Virtualbox / Vagrant工作?

编辑:问题是Windows防火墙关闭了之前在我的系统上打开的端口,特别是在这种情况下的22端口。我创建了一个例外来允许该端口22通过,现在它像预期的那样工作。

2个回答

2

0

我认为您的BIOS未启用虚拟化功能。

请在任务管理器中检查:性能选项卡>虚拟化 或通过CMD中的systeminfo命令。

如果未启用

根据您的硬件制造商,查看如何从BIOS启用它。

如果已启用

然后尝试从“添加或删除Windows功能”中禁用“Hyper-V”。

您还可以尝试手动从Virtualbox启动64位虚拟机,这可能会告诉您机器处于“未知状态”的原因。

此外,尝试使用以下配置创建Vagrant文件(使用32位操作系统):

Vagrant.configure(2) do |config|
  config.vm.box = "hashicorp/precise32"
  config.vm.box_download_insecure = true #true just to bypass ssl validation error (strict no for production)
end

尝试从相同的目录中运行vagrant up


1
我刚刚找到了问题的根源。在安装秋季创作者更新之前,Windows防火墙关闭了先前在我的系统上打开的端口。我为SSH打开了22号端口,现在它可以正常工作了。 - NeyLive

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接