给定名称的主机网络接口无法找到。

16

我正在运行Windows 10、VirtualBox 5和Vagrant 1.7.4,并尝试运行openedx平台。

当我运行vagrant up时,我得到了以下结果:

Bringing machine 'default' up with 'virtualbox' provider...
==> 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", "ipconfig", "VirtualBox Host-Only Ethernet Adapter #25", "--ip", "192.168.33.1", "--netmask", "255.255.255.0"]

Stderr: VBoxManage.exe: error: The host network interface with the given name could not be found
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component HostWrap, interface IHost, callee IUnknown
VBoxManage.exe: error: Context: "FindHostNetworkInterfaceByName(Bstr(pszName).raw(), hif.asOutParam())" at line 204 of file VBoxManageHostonly.cpp

Vagrant文件:

Vagrant.require_version ">= 1.5.3"

VAGRANTFILE_API_VERSION = "2"

MEMORY = 4096
CPU_COUNT = 2

# map the name of the git branch that we use for a release
# to a name and a file path, which are used for retrieving
# a Vagrant box from the internet.
openedx_releases = {
  "openedx/rc/aspen-2014-09-10" => {
    :name => "aspen-fullstack-rc1", :file => "20141010-aspen-fullstack-rc1.box",
  },
  "aspen.1" => {
    :name => "aspen-fullstack-1", :file => "20141028-aspen-fullstack-1.box",
  },
  "named-release/aspen" => {
    :name => "aspen-fullstack-1", :file => "20141028-aspen-fullstack-1.box",
  },
  "named-release/birch.rc1" => {
    :name => "birch-fullstack-rc1", :file => "20150204-birch-fullstack-rc1.box"
  },
  "named-release/birch.rc2" => {
    :name => "birch-fullstack-rc2", :file => "20150211-birch-fullstack-rc2.box"
  },
  "named-release/birch.rc3" => {
    :name => "birch-fullstack-rc3", :file => "20150213-birch-fullstack-rc3.box"
  },
  "named-release/birch" => {
    :name => "birch-fullstack", :file => "20150224-birch-fullstack.box",
  },
  "named-release/birch.1" => {
    :name => "birch-fullstack-1", :file => "birch-1-fullstack.box",
  },
}
openedx_releases.default = {
  :name => "kifli-fullstack", :file => "20140826-kifli-fullstack.box"
}
openedx_releases_vmware = {
  "named-release/birch" => {
    :name => "birch-fullstack-vmware", :file => "20150610-birch-fullstack-vmware.box",
  },
}
openedx_releases_vmware.default = {
  :name => "kifli-fullstack-vmware", :file => "20140829-kifli-fullstack-vmware.box",
}
rel = ENV['OPENEDX_RELEASE']

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  # Creates an edX fullstack VM from an official release
  config.vm.box     = openedx_releases[rel][:name]
  config.vm.box_url = "http://files.edx.org/vagrant-images/#{openedx_releases[rel][:file]}"

  config.vm.synced_folder  ".", "/vagrant", disabled: true
  config.ssh.insert_key = true

  config.vm.network :private_network, ip: "192.168.33.10"
  config.hostsupdater.aliases = ["preview.localhost"]

  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--memory", MEMORY.to_s]
    vb.customize ["modifyvm", :id, "--cpus", CPU_COUNT.to_s]

    # Allow DNS to work for Ubuntu 12.10 host
    # http://askubuntu.com/questions/238040/how-do-i-fix-name-service-for-vagrant-client
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end

  config.vm.provider :virtualbox do |v, override|
  v.gui=true
  end

  ["vmware_fusion", "vmware_workstation"].each do |vmware_provider|
    config.vm.provider vmware_provider do |v, override|
      override.vm.box     = openedx_releases_vmware[rel][:name]
      override.vm.box_url = "http://files.edx.org/vagrant-images/#{openedx_releases_vmware[rel][:file]}"
      v.vmx["memsize"] = MEMORY.to_s
      v.vmx["numvcpus"] = CPU_COUNT.to_s
    end
  end
end

当我注释掉这行代码时,一切都顺利了

config.vm.network :private_network, ip: "192.168.33.10"

但是我无法访问LMS和CMS页面(因为我当然注释了这一行)

任何建议将不胜感激!


你有检查过这是否与该开放问题不同吗:... https://github.com/mitchellh/vagrant/issues/4970 - mproffitt
是的,我检查了一下,但是建议的解决方案不起作用(我只有一个版本的Oracle Virtualbox驱动程序)。 - Bilal
一个愚蠢的建议,但从理论上讲可能会有所帮助:尝试打开VirtualBox管理GUI,并检查您正在尝试启动的虚拟机中是否有该名称的网络适配器。如果没有,请尝试将其重命名为Vagrant想要的任何名称(例如,在您的情况下为“VirtualBox Host-Only Ethernet Adapter#25”)。 - J0HN
谢谢@J0HN提供的建议,不幸的是它并没有起作用。当我创建一个新的网络适配器(例如VirtualBox Host-Only Ethernet Adapter #25)时,我得到了以下信息:Command: ["hostonlyif", "ipconfig", "VirtualBox Host-Only Ethernet Adapter #25", "--ip", "192.168.33.1", "--netmask", "255.255.255.0"] - Bilal
4个回答

17

终于成功了!这里是解决方案:

1- 以管理员身份运行VBox-Win10-fix-14040.exe(详见此讨论

2- 以管理员身份运行VirtualBox.exe+与Windows 7兼容模式

3- 然后Vagrant up :)

就是这样了!


1
它确实有帮助!直接下载文件:https://www.virtualbox.org/attachment/ticket/14040/VBox-Win10-fix-14040.exe - Aistis
1
即使按照上述步骤操作,仍然存在相同的问题 :( - Monk789
2
太棒了!在Windows 10上工作没有问题。 - prog_24

1
简单解决方案:从VirtualBox首选项中删除已创建的(默认)Host only以太网适配器,然后运行sh launch.sh(如果您在安装Mirantis Openstack包时收到错误消息)。
附注:我不认为这种方法不适用于Vagrant。

0
如果您在尝试在Virtualbox上设置Mirantis Openstack包时遇到以下类似的错误:
VBoxManage.exe: error: The host network interface name 'VirtualBox Host-Only Et' could not be foundVBoxManage.exe: error: The host network interface named 'VirtualBox Host-Only Et' could not be found
请打开network.sh脚本,在| egrep之前添加| sed 's/\r$//',如下所示: local found_iface=(execute VBoxManage list hostonlyifs | sed 's/\r$//'| egrep "Name: + $name\$" | awk '/Name/ { $1 = ""; print substr($0, 2) }') local new_name=(execute VBoxManage list hostonlyifs | sed 's/\r$//' | egrep -A9 "Name: + $name\$" | awk '/Name/ { $1 = ""; print substr($0, 2) }') local new_ip=(execute VBoxManage list hostonlyifs | sed 's/\r$//'| egrep -A9 "Name: + $name\$" | awk '/IPAddress:/ { print $2 }')

本地新掩码=(执行VBoxManage list hostonlyifs | sed 's/\r$//'| egrep -A9 "Name: + $name\$" | awk '/NetworkMask:/ { print $2 }')

本地新DHCP=(执行VBoxManage list hostonlyifs | sed 's/\r$//'| egrep -A9 "Name: + $name\$" | awk '/DHCP:/ { print $2 }')

本地ID=执行VBoxManage hostonlyif create | sed 's/\r$//'| sed "s/'/_/g" | cut -d "_" -f2 | sed 's/\r$//'| sed "s/^_//" | sed "s/_$//"


0

对于 Windows 7 x86,也许您的虚拟机更新到了最新版本。尝试回退到版本4。可以选择2014年3月或9月发布的版本。


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