67
37

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Last updated at Posted at 2019-12-20

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.

何故だろうと調べていると英語の記事を発見

//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

67
37
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
67
37

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?