zoukankan      html  css  js  c++  java
  • Vagrant2.2.6 和VirtualBox6.1.0不兼容问题解决办法

    在安装完毕vagrant和virtualbox后,

    执行命令

    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.
    出现此错误提示未安装virtualbox,但实际已安装完毕。查资料发现存在版本兼容问题。但目前(今天2020.1.1)均是最新版本,后在github找到答案。

    原文地址:https://github.com/oracle/vagrant-boxes/issues/178

    需要修改三处:

    1、在/opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/plugin.rb的文件内新增红色部分

    module Driver
      autoload :Meta, File.expand_path("../driver/meta", __FILE__)
      autoload :Version_4_0, File.expand_path("../driver/version_4_0", __FILE__)
      autoload :Version_4_1, File.expand_path("../driver/version_4_1", __FILE__)
      autoload :Version_4_2, File.expand_path("../driver/version_4_2", __FILE__)
      autoload :Version_4_3, File.expand_path("../driver/version_4_3", __FILE__)
      autoload :Version_5_0, File.expand_path("../driver/version_5_0", __FILE__)
      autoload :Version_5_1, File.expand_path("../driver/version_5_1", __FILE__)
      autoload :Version_5_2, File.expand_path("../driver/version_5_2", __FILE__)
      autoload :Version_6_0, File.expand_path("../driver/version_6_0", __FILE__)
      autoload :Version_6_1, File.expand_path("../driver/version_6_1", __FILE__)
    end

    2、在/opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver/meta.rb的文件内新增红色部分

    driver_map   = {
      "4.0" => Version_4_0,
      "4.1" => Version_4_1,
      "4.2" => Version_4_2,
      "4.3" => Version_4_3,
      "5.0" => Version_5_0,
      "5.1" => Version_5_1,
      "5.2" => Version_5_2,
      "6.0" => Version_6_0,
      "6.1" => Version_6_1,
    }

    3、在/opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver文件夹内新创建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
    
    


    通过一系列修改后,可以正常执行。
  • 相关阅读:
    简单修改 MySQL 的 root 账号密码
    树莓派 Raspberry-Pi 折腾系列:系统安装及一些必要的配置
    [原创] JavaScript 图片放大镜插件 enlarge.js 以及移动版 enlarge.touch.js
    丢掉 WinPE,使用 DISKPART 来分区吧
    【原创】只用 HTML / CSS 画出一把 UKULELE(夏威夷四弦吉他)
    用网页模拟手机(安卓)通知列表中的「清除」效果
    关于 Google Chrome 中的全屏模式和 APP 模式
    简单好用的 AJAX 上传插件,还可以抛弃难看的 file 按钮哦~
    C# 操作 Excel 常见问题收集和整理(定期更新,欢迎交流)
    C++:几种callable实现方式的性能对比
  • 原文地址:https://www.cnblogs.com/gaosf/p/12517089.html
Copyright © 2011-2022 走看看