Vagrant2.2.6 和VirtualBox6.1.0不兼容解决

系统及软件版本

  • Win10 专业版
  • VirtualBox6.1.0
  • Vagrant2.2.6

问题描述

  • 新入手的电脑,安装了Vagrant和VirtualBox后准备安装CentOS系统,初始化成功后执行vagrant up命令抛出如下提示:
dduan@DESKTOP-FPSM25E MINGW64 /f/Develop/Vagrant/CentOS7_min
$ vagrant up
No usable default provider could be found for your system.

Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.

The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.

If you believe you already have a provider available, make sure it
is properly installed and configured. You can see more details about
why a particular provider isn't working by forcing usage with
`vagrant up --provider=PROVIDER`, which should give you a more specific
error message for that particular provider.

原因

  • 因为 vagrant 没有对 VirtualBox6.1支持

解决办法

注意:修改配置文件是需要管理员权限

  • 修改D:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\plugins\providers\virtualbox\plugin.rb文件,在61行左右,添加autoload :Version_6_1, File.expand_path("../driver/version_6_1", __FILE__)
    在这里插入图片描述
  • 修改D:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\ vagrant2.2.6\plugins\providers\virtualbox\driver\meta.rb文件,在66行左右增加"6.1" => Version_6_1,,修改后如下图:
    在这里插入图片描述
  • meta.rb文件同级目录下新建version_6_1.rb文件,文件内容如下:
require File.expand_path("../version_6_0", __FILE__)

module VagrantPlugins
  module ProviderVirtualBox
    module Driver
      # Driver for VirtualBox 6.1.x
      class Version_6_1 < Version_6_0
        def initialize(uuid)
          super

          @logger = Log4r::Logger.new("vagrant::provider::virtualbox_6_1")
        end
      end
    end
  end
end

验证

  • 完成上面操作之后,再次执行vagrant up 执行成功
    在这里插入图片描述
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dadeity

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值