无法创建Host-only适配器

4
我在我的系统上使用vagrant up时遇到了问题。我有一个错误,如下所示。我尝试重新安装VBox、Vagrant、关闭防火墙、检查VBox网络驱动程序并重启主机系统,但都无法解决。
谢谢大家的帮助。
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: SetupDiCallClassInstaller (DIF_INSTALLDEVICE) failed 
(0x00000002)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component 
HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdeclhandleCreate(struct 
HandlerArg *)" at line 94 of file VBoxManageHostonly.cpp

VBox 版本 5.2.22

Vagrant 版本 2.2.0

主机操作系统 Win7 x64

客户操作系统 Ubuntu-16.04.5-desktop-amd64

Vagrantfile 文件

dir = File.dirname(File.expand_path(__FILE__))

require 'yaml'
require "#{dir}/puphpet/ruby/deep_merge.rb"
require "#{dir}/puphpet/ruby/to_bool.rb"

configValues = YAML.load_file("#{dir}/puphpet/config.yaml")

provider = ENV['VAGRANT_DEFAULT_PROVIDER'] ? ENV['VAGRANT_DEFAULT_PROVIDER'] : 'local'
if File.file?("#{dir}/puphpet/config-#{provider}.yaml")
  custom = YAML.load_file("#{dir}/puphpet/config-#{provider}.yaml")
  configValues.deep_merge!(custom)
end

if File.file?("#{dir}/puphpet/config-custom.yaml")
  custom = YAML.load_file("#{dir}/puphpet/config-custom.yaml")
  configValues.deep_merge!(custom)
end

data = configValues['vagrantfile']

Vagrant.require_version '>= 1.8.1'

Vagrant.configure('2') do |config|
  eval File.read("#{dir}/puphpet/vagrant/Vagrantfile-#{data['target']}")
end
6个回答

1

1
谢谢回答,但是它对我没有帮助。但是我似乎明白了问题所在。在 Network Connections Windows 中,我没有 VirtualBox 主机唯一适配器。VirtualBox NDIS6 Bridged Networking 驱动程序仅在“Remote NDIS based Internet Sharing Device”的属性中拥有。http://joxi.ru/Dr8Bj8gC46OVP2.jpg - AndrewLunew
同时,我无法在“仅主机网络”(VirtualBox GUI)中创建此主机适配器,错误提示为SetupDiCallClassInstaller(DIF_INSTALLDEVICE)失败(0x00000002)。 - AndrewLunew

0

我遇到了与 vagrant version v2.3.2 和 VirtualBox 版本 7.0.2macOS Ventura 上类似的问题。在我的情况下,通过执行以下步骤解决了该问题:

# 1
sudo su
csrutil clear

#2
Then uninstall VirtualBox using the official uninstaller after that reboot the system.

#3
After the reboot install VirtualBox again using:

brew install --cask virtualbox

#4 
Add this line to your Vagrantfile:
virtualbox__intnet: true

#5
vagrant up

请允许任何扩展,如果系统提示,请前往“系统偏好设置-隐私-通用”并接受扩展。

0

这两天我被这个问题搞得疯了。最终找到了解决方案。

1.杀毒软件是导致问题的原因

2.您需要在Windows系统上禁用杀毒软件服务(您需要管理员访问权限或从公司IT人员处获得帮助)

3.重新安装Docker工具箱并启动它(管理员模式) 这有效。


0

这个帖子已经三年了,但是时间向前推进,我也遇到了Windows 10的类似问题。让我来告诉你我是如何解决它的。

打开虚拟机 -> 文件 -> 主机网络管理器 主机网络管理器

一旦您选择该选项,一个框将打开,其中包含您可以启用/禁用的适配器。

对于我来说,默认情况下适配器2被禁用,一旦我启用它,我就可以毫无问题地运行vagrant up。

adapters


0

在我的主机上运行了vagrant up

经过多次尝试,我重新安装了Windows。需要安装虚拟机主机驱动程序(Windows Networking中的VirtualBox Host-Only Ethernet Adapter)只能在“干净”的系统上进行安装,这对我来说非常奇怪。

Vagrant还需要Windows PowerShell版本早于3,但Win7默认使用2。您需要更新Windows Net Framework以在Win7上安装3和更早版本。

祝好运!


0

我发现其他所有的解决方案都不起作用,直到我找到了这篇文章:Laravel Vagrant Up SSH Problems

在 YAML 文件的结束标签之前添加下面的代码就可以解决问题了。

 config.vm.provider "virtualbox" do |vb|
        vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
    end

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