无法创建仅主机适配器 - windows 10、docker、virtualbox

2024-02-11

我最近在使用 docker toolbox 一段时间没有问题后遇到了这个问题。

Windows 更新后开始出现这种情况?

Windows 10 家庭版 - 64

卸载并重新安装Docker工具箱

卸载并重新安装各个版本的 VirtualBox

仍然遇到同样的错误

Running pre-create checks...
Creating machine...
(default) Copying C:\Users\me\.docker\machine\cache\boot2docker.iso to C:\Users\me\.docker\machine\machines\default\boot2docker.iso...
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Windows might ask for the permission to create a network adapter. Sometimes, such confirmation window is minimized in the taskbar.
(default) Creating a new host-only adapter produced an error: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe hostonlyif create failed:
(default) 0%...
(default) Progress state: E_FAIL
(default) VBoxManage.exe: error: Failed to create the host-only adapter
(default) VBoxManage.exe: error: Querying NetCfgInstanceId failed (0x00000002)
(default) VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
(default) VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreate(struct HandlerArg *)" at line 71 of file VBoxManageHostonly.cpp
(default)
(default) This is a known VirtualBox bug. Let's try to recover anyway...
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is is supposed to fix this issue
Looks like something went wrong in step ´Checking if machine default exists´... Press any key to continue...

这个答案与 Docker 没有具体关系,但这是最近的 Stack Overflow 搜索结果之一(与this https://stackoverflow.com/questions/33725779/failed-to-open-create-the-internal-network-vagrant-on-windows10问题)在 Google 上搜索时“无法创建仅主机适配器”来自 VirtualBox 的错误消息,我将其留在这里,希望对其他人有所帮助。

作为旁注,如果您can,我建议你使用适用于 Windows 的 Docker https://www.docker.com/docker-windows而不是 Docker Toolbox 在 Windows 上运行 Docker(需要 Windows 10 Professional 或 Enterprise 64 位)。


我的场景:

  • Windows 10 专业版 1709
  • 我尽可能使用 Hyper-V 来运行虚拟机,但需要运行以 Windows XP 作为来宾操作系统的旧 VirtualBox VM
  • VirtualBox 5.2.4-119785(Windows 仅支持单个虚拟机管理程序 - 我可以推荐这种方法 http://www.hanselman.com/blog/SwitchEasilyBetweenVirtualBoxAndHyperVWithABCDEditBootEntryInWindows81.aspx如果您需要在 Hyper-V 和 VirtualBox 之间切换)
  • VirtualBox 在安装时未(或未能)创建仅主机适配器

当尝试使用主机网络管理器 GUI 创建仅主机适配器时,我收到了可怕的“无法创建仅主机适配器”错误消息,详细信息为:“查询 NetCfgInstanceId 失败 (0x00000002)”.

因为我使用 Hyper-V,所以除了实际的物理适配器之外,我还有许多 Hyper-V 虚拟以太网适配器。

查看物理适配器的属性,Hyper-V 关闭除“Hyper-V 可扩展虚拟交换机”之外的所有协议驱动程序似乎是正常的。然后,Windows 通过其中一个虚拟适配器获取网络连接,在我的例子中,它称为“外部虚拟交换机”,并且在那里启用一组常用的协议驱动程序(TCP/IPv4 等)。

然后我注意到 VirtualBox 似乎(想要)以类似的方式工作,因为它已成功安装并启用了一个名为“VirtualBox NDIS6 桥接网络驱动程序”的新协议驱动程序。

当我检查其他虚拟适配器的属性时,我注意到所有适配器上都启用了“VirtualBox NDIS6 桥接网络驱动程序”,但“Hyper-V 可扩展虚拟交换机”未启用。奇怪的是在 Hyper-V 虚拟适配器上启用 VirtualBox 驱动程序,所以我在所有适配器上禁用了它,但在物理适配器上启用了它。

我认为在这个阶段我为了好运而进行了一次良好的旧重启,尽管我怀疑这是否真的有必要。当我随后再次尝试创建 VirtualBox 仅主机适配器时,它成功了! (实际上,我从 VirtualBox 收到一条错误消息,在我必须在任务栏上找到的模式中,有关已使用的适配器名称。但是,在 Windows 网络连接下出现了一个新的“VirtualBox 仅主机以太网适配器”,当我关闭并重新打开 VirtualBox Host Network Manager 窗口,适配器也出现在那里。)

TL;DR;

我的理论是,VirtualBox 由于某种原因无法确定哪个适配器是实际的物理网络适配器,并且以相当热心的方式继续启用其“VirtualBox NDIS6 桥接网络驱动程序”every它找到的适配器。

此外,它似乎无法确定需要为哪个适配器创建其虚拟“包装适配器”并且失败。

即使您不使用/没有 Hyper-V,您也可能拥有多个适配器,包括虚拟适配器(例如,许多 VPN 软件也安装虚拟适配器)。

您可以尝试在除实际物理网络适配器之外的所有适配器上禁用“VirtualBox NDIS6 桥接网络驱动程序”,然后再尝试再次创建 VirtualBox 仅主机适配器。


对于 VirtualBox 来说,这当然不是一个新问题,从其公共 bugtracker 和其他地方的大量相关票证来看,其中一些票证已有 2 年多了。我有一种感觉,对于很多人来说,问题可能与我上面描述的内容有关,所以希望这对他们有帮助。


编辑 01/15

嗯,回想起来,我不确定 Windows 使用 Hyper-V“外部虚拟交换机”进行网络连接是否正常。如果我没记错的话,Hyper-V 创建并通过 NAT 为来宾提供连接的“默认”开关是一个相对较新的事物,之前有必要添加和使用“外部”开关......在我的家用电脑上,没有对于“外部”交换机,普通(TCP/IPv4 等)协议驱动程序在物理网络适配器上保持启用状态,而“Hyper-V 可扩展虚拟交换机”在物理和虚拟适配器上均被禁用。我还没有机会测试在这种情况下添加新的“外部虚拟交换机”会发生什么。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法创建仅主机适配器 - windows 10、docker、virtualbox 的相关文章

随机推荐