vagrant - 无法创建仅主机适配器
问题描述
我的系统上有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
流浪者版本 2.2.0
主机操作系统 Win7 x64
来宾操作系统 Ubuntu-16.04.5-desktop-amd64
流浪文件
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
解决方案
我发现所有其他解决方案都不起作用,直到我发现这篇文章: Laravel Vagrant Up SSH Problems
在 YAML 文件的结束标记之前添加下一个代码就可以了
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
end
推荐阅读
- xcode - Xcode 间歇性地找不到 xcframework
- node.js - 玩笑测试不使用 dotenv 读取环境变量
- python - PySpark - 从数据框中删除第一行
- django - Heroku 设置默认站点
- java - 我们可以对 JPA 标准表达式进行左填充吗?
- pyspark - 如何使用pyspark进行数据转置,没有聚合,只是重塑
- c++ - C++ 中有没有办法将给定类的函数限制为仅另一个类(不使用继承,朋友)?
- php - MongoDB + PHP:错误“无法连接到 127.0.0.1:27017”
- html - 有没有办法在卡片中的 Material-UI Typography 元素中加粗一个单词而不改变渲染?
- python - 使用 setuptools 构建项目后,应用程序找不到文件路径