LoginSignup
21
23

More than 5 years have passed since last update.

Vagrant1.8.4でVirtualBox5.1を利用する

Last updated at Posted at 2016-07-16

VirtualBox5.1がリリースされました。

Oracle VM VirtualBox 5.1.0 is now available!

しかし現状、Vagrant1.8.4ではVirtualBox5.1は動きません。

※ 追記 : 既にVagrant1.8.5がrelease済みで、VirtualBox5.1に対応済みなので、そちらを使いましょう。
…と思ったら、バグがあってまともに動かないようなので、現状は1.8.6待ちか1.8.4でこの対処を行うかのどちらかのようですね。1

$ vagrant up
==>  Provider 'virtualbox' not found. We'll automatically install it now...
     The installation process will start below. Human interaction may be
     required at some points. If you're uncomfortable with automatically
     installing this provider, you can safely Ctrl-C this process and install
     it manually.
==>  Downloading VirtualBox 5.0.10...
     This may not be the latest version of VirtualBox, but it is a version
     that is known to work well. Over time, we'll update the version that
     is installed.
==>  Installing VirtualBox. This will take a few minutes...
     You may be asked for your administrator password during this time.
     If you're uncomfortable entering your password here, please install
     VirtualBox manually.

この後、VirtualBox5.0系をダウンロードしようとします。
また、vagrant statusなどのコマンドを実行しても、Providerがないとしてエラーになります。

$ vagrant status
There are errors in the configuration of this machine. Please fix
the following errors and try again:

AWS Provider:
* An access key ID must be specified via "access_key_id"
* A secret access key is required via "secret_access_key"
* vagrant_aws.config.ami_required

ここにissueが挙がっていますが、現時点ではコードの書き換えを行う必要がありそうです。

以下はMacの場合:

/opt/vagrant/embedded/gems/gems/vagrant-1.8.4/plugins/providers/virtualbox/driver/meta.rb
            "4.3" => Version_4_3,
            "5.0" => Version_5_0,
            "5.1" => Version_5_1,  # 64行目 この行を足す
          }
/opt/vagrant/embedded/gems/gems/vagrant-1.8.4/plugins/providers/virtualbox/plugin.rb
      autoload :Version_5_0, File.expand_path("../driver/version_5_0", __FILE__)
      autoload :Version_5_1, File.expand_path("../driver/version_5_1", __FILE__) # 59行目 この行を足す
    end
sudo cp -p /opt/vagrant/embedded/gems/gems/vagrant-1.8.4/plugins/providers/virtualbox/driver/version_5_0.rb \
/opt/vagrant/embedded/gems/gems/vagrant-1.8.4/plugins/providers/virtualbox/driver/version_5_1.rb
/opt/vagrant/embedded/gems/gems/vagrant-1.8.4/plugins/providers/virtualbox/driver/version_5_1.rb
      # Driver for VirtualBox 5.0.x
      class Version_5_1 < Base # 11行目 Version_5_0 -> Version_5_1へ書き換え
        def initialize(uuid)

また、Windowsの場合にも /opt/vagrant の部分を C:\HashiCorp\Vagrant に読み替えて、同様に対応することが可能です。

そのうち対応されるはずなので、待てる方は待ちましょう。

21
23
0

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
21
23