An error has occurred while trying to create a virtualbox host-only network interface.

An error has occurred while trying to create a virtualbox host-only network interface.

北渚007

An error has occurred while trying to create a virtualbox host-only network interface.
于 2020-08-03 11:16:25 发布
An error has occurred while trying to create a virtualbox host-only network interface.
4078
An error has occurred while trying to create a virtualbox host-only network interface.
收藏 2

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

创建RN项目时,想用Genymoiton新建一个Android模拟器,报错如下:An error has occurred while trying to create a virtualbox host-only network interface

原因是VirtualBox下载失败,重新下载,在系统偏好设置 -> 安全性与隐私 -> 通用中,选择允许Oracle下载App

参考官方文档:https://support.genymotion.com/hc/en-us/articles/360000990578–An-error-has-occurred-while-trying-to-create-a-virtualbox-host-only-network-interface-macOS-

Six years ago I set up a CentOS VM on a Win10 host, with mostly other people's knowledge - I was hanging on by a thread figuring out just enough to get it working. Now I'm moving all my stuff to a new computer (Win11). I installed VirtualBox and Vagrant, copied all the files I know of into the same paths as on the old machine, crossed my fingers, and gave it a shot. I got the following output:

PS C:\dev\7and7> vagrant up
Bringing machine '7and7' up with 'virtualbox' provider...
==> 7and7: Resuming suspended VM...
==> 7and7: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "797d2c9c-557c-4f5c-a988-502c3bcfae8e", "--type", "headless"]

Stderr: VBoxManage.exe: error: Nonexistent host networking interface, name 'VirtualBox Host-Only Ethernet Adapter #4' (VERR_INTERNAL_ERROR)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole

Hmm, so I guess I need to create "VirtualBox Host-Only Ethernet Adapter #4". In VirtualBox on my old machine, File -> Host Network Manager shows three such adapters - #2, #3, and #4. I don't remember whether I made them in VBox or by some other method. On the new machine there are none, but if I click "Create", it says "Creating host only network interface" for a couple seconds before ending with: "Failed to create a host network interface." The details say:

Failed to create a host network interface.

Assertion failed: [!aInterfaceName.isEmpty()] at 'F:\tinderbox\win-6.1\src\VBox\Main\src-server\HostNetworkInterfaceImpl.cpp' (76) in long __cdecl HostNetworkInterface::init(class com::Utf8Str,class com::Utf8Str,class com::Guid,enum __MIDL___MIDL_itf_VirtualBox_0000_0000_0046).

Please contact the product vendor!.

Result Code: E_FAIL (0x80004005)
Component: HostNetworkInterfaceWrap
Interface: IHostNetworkInterface {455f8c45-44a0-a470-ba20-27890b96dba9}

I don't understand most of that, but I know I don't have an F drive/partition (on either machine), and it's unclear what "tinderbox" could even be in this context (the internet thinks it's a note-taking tool). "Please contact the product vendor" - which product? Windows? VBox? Vagrant? My VM?

As you can probably tell, I'm way out of my league - can anyone point me in the right direction? I'm running VBox 6.1.36 and Vagrant 2.2.19.

EDIT: It occurred to me that the VM was suspended (not halted) when I copied it to the new host, so I halted it on the old machine and copied it again, and then tried to start it. This time I got different errors - first of all, Windows asked me no less that 5 times for permission for VirtualBox to access my hard drive - on the old machine it would never ask that at all when firing up my VM. Then the output was as follows:

PS C:\dev\7and7> vagrant up
Bringing machine '7and7' up with 'virtualbox' provider...
==> 7and7: Clearing any previously set forwarded ports...
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:

  https://www.virtualbox.org/manual/ch04.html#sharedfolders

This option can be disabled globally with an environment variable:

  VAGRANT_DISABLE_VBOXSYMLINKCREATE=1

or on a per folder basis within the Vagrantfile:

  config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> 7and7: 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: E_INVALIDARG
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Assertion failed: [!aInterfaceName.isEmpty()] at 'F:\tinderbox\win-6.1\src\VBox\Main\src-server\HostNetworkInterfaceImpl.cpp' (76) in long __cdecl HostNetworkInterface::init(class com::Utf8Str,class com::Utf8Str,class com::Guid,enum __MIDL___MIDL_itf_VirtualBox_0000_0000_0046).
VBoxManage.exe: error: Please contact the product vendor!
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreate(struct HandlerArg *)" at line 95 of file VBoxManageHostonly.cpp

So I guess it's Vagrant that is supposed to initiate the creation of the host-only adapter (when the VM is booted from powered-off state), rather than me doing it manually in VBox. Anyway, it's still not working.

How do I setup a VirtualBox host

Add a Host-Only Adapter to the Guest Machine.
Select the appropriate guest machine..
Click Settings > Network..
Under the Adapter 2 tab, input the following settings: Enable Network Adapter: Checked. Attached to: Host-Only Adapter. ... .
Click OK..

Why do I have VirtualBox host

Host-only Networking Description With host-only networking, virtual box doesn't try to use a physical network adapter on the host. Instead in VirtualBox you can create one or more (up to 8) virtual adapters for connections between the host and virtual machines created in VirtualBox on the host.

How do I use a network adapter in VirtualBox?

VirtualBox network adapter settings can be accessed in the virtual machine settings (select your VM, hit Settings and go to the Network section in the VM settings window). There you should see four adapter tabs. One virtual network adapter is enabled by default after virtual machine creation.