Help us understand the problem. What is going on with this article?

[Mac] Vagrant 2.2.6 と Virtualbox 6.1でうまくvagrant up ができなかった時の対処法

Vagrant 2.2.6 と Virtualbox 6.1でうまくvagrant up ができなかった

vagrant2.2.6がVirtualbox 6.1(最新版)を認識してくれません。

Virtualboxはインストール済みですが下記のエラーが出てしまいます。

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.

何故だろうと調べていると英語の記事を発見
https://blogs.oracle.com/scoter/getting-vagrant-226-working-with-virtualbox-61-ga

なにやらvagrantがvirtualboxの最新版を認識してくれないとのこと。
設定ファイルを書き換えてvirtualbox6.1を認識してくれるようにする必要があります。

さて、ここからぽちぽちいじっていきます。

・編集するファイル
/opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver/meta.rb

version6.1の記述をdriver map listにしてあげる必要があります。


 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, //ここを追記

 }

version_6_1.rbファイルを作成

/opt/vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/providers/virtualbox/driver/version_6_1.rb

ファイルの中身はここのサイトにあります。
http://www.coter.net/upload/version_6_1.rb

次にplugin.rbを編集します。

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

これでvagrant up するとうまく起動するはずです。
すばらしい!

参考文献:
Getting Vagrant 2.2.6 working with VirtualBox 6.1 GA
Simon Coter
https://blogs.oracle.com/scoter/getting-vagrant-226-working-with-virtualbox-61-ga

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした