VBoxManage:错误:无法创建仅主机适配器

174

我正在运行基于 Fedora 17 的机器上 vagrant 1.4 和 virtual box 4.3。当我执行 "vagrant up" 命令时,出现以下错误:

Bringing machine 'default' up with 'virtualbox' provider...                                                                            


[default] Clearing any previously set forwarded ports...                                                                                                                
[default] Clearing any previously set network interfaces...                                                                                                             
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: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: VBoxNetAdpCtl: ioctl failed for /dev/vboxnetctl: Inappropriate ioctl for devic
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterface, interface IHostNetworkInterface
VBoxManage: error: Context: "int handleCreate(HandlerArg*, int, int*)" at line 66 of file VBoxManageHostonly.cpp

你是在Fedora上运行Vagrant,还是你的Vagrant Box的操作系统是Fedora? - Jeff Sisson
我遇到了同样的问题,正在 OS X 上运行 Vagrant,这是 VirtualBox 的问题吗? - Yuan He
@adi,你能验证一下正确答案吗?谢谢。 - totophe
当你升级到MacOS Monterey时,你可能会遇到这个问题等。虽然被接受的答案无疑是主要问题,但MacOS升级可能不会复制你的安全和隐私设置,所以我也加入了这一点。我不知道为什么这个问题没有被简单地移动而不是关闭。 - Oliver Williams
37个回答

0

我来到这里,使用 kitchen-CI 工作并遇到了 vagrant 的问题。 在删除 "~/.kitchen" 目录后,kitchen converge 再次成功。


0

我在Windows 8.1、VirtualBox 5.1.18和Vagrant 1.9.3上遇到了这个问题。

从VirtualBox首选项(网络-->仅主机网络)中删除VirtualBox Hosts-only Ethernet Adapter可以解决这个问题,然后vagrant up就可以继续并启动虚拟机。


0
我的解决方案

系统偏好设置 -> 系统安全性与隐私 -> 允许 oracle.xxxx;然后重新安装 virtualBox。


0
在Opensuse 42.1上,对我有帮助的是从官方RPM安装VirtualBox和Vagrant,而不是从Opensuse存储库安装。

0

我在按照教程为Windows 10设置Laravel Homestead时遇到了同样的问题。教程提供了一个示例IP地址192.168.10.10用于服务器。他们示例IP的问题在于如果您已经设置了VirtualBox Host-Only Adapter,则您用于vagrant服务器的IP必须与当前适配器的IP地址的前三部分相同

您可以通过运行ipconfig(windows)ifconfig(mac/linux)来检查当前Virtualbox Host-Only Adapter IP地址,并查找VirtualBox Host-Only Adapter的IPv4地址。192.168.56.1是我的。通常,如果主机IP是192.168.56.1,则客户机IP将是192.168.56.101,因此我使用了192.168.56.102而不是示例IP。任何未被占用的192.168.56.*内的IP都应该可以工作

之后,homestead up对我来说完美地解决了问题。

TL;DR - 如果你当前的 VirtualBox Host-Only Adapter IP 是 192.168.56.1,请将你的 Vagrant 服务器 IP 设为 192.168.56.102。

0
有时候可以通过在 vagrant up 时对虚拟机进行配置来解决这个问题。
vagrant up --provision

第一次运行 vagrant up 通常会自动进行配置... 再次运行配置可能会导致一切混乱。配置通常不会被编写为可以运行两次(不幂等),因此它将再次执行操作。除非您已经编写了可以多次运行的所有内容,否则这总是非常危险的。 - Julesezaar

-1

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