LoginSignup
4
2

More than 5 years have passed since last update.

vagrant up が出来なかったときの対応

Posted at

Mac OS を High Sierra から Mojave に上げたらvagrant up出来なくなったので何とかした。
最終的にVirtualBoxとVagrantのアップデートをすることでvagrant up出来るようになった。

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 94 of file VBoxManageHostonly.cpp

VirtualBoxが古いのが原因らしいので公式サイトから最新版をダウンロードしてApplication内のVirtualBoxを5.1.22 -> 5.2.20に上げる
https://www.virtualbox.org/wiki/Downloads

$ vagrant up
The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:

Vagrant has detected that you have a version of VirtualBox installed
that is not supported by this version of Vagrant. Please install one of
the supported versions listed below to use Vagrant:

4.0, 4.1, 4.2, 4.3, 5.0, 5.1

A Vagrant update may also be available that adds support for the version
you specified. Please check www.vagrantup.com/downloads.html to download
the latest version.

気づいたらvagrantも古かったので公式サイトから最新版をダウンロードしてきてアップデートする
https://www.vagrantup.com/downloads.html

アップデート前
$ vagrant -v
Vagrant 1.9.5

アップデート後
$ vagrant -v
Vagrant 2.2.0

vagrantのバージョンを上げたのでプラグインも対処を求められる、

$ vagrant up
Vagrant failed to initialize at a very early stage:

The plugins failed to initialize correctly. This may be due to manual
modifications made within the Vagrant home directory. Vagrant can
attempt to automatically correct this issue by running:

  vagrant plugin repair

If Vagrant was recently updated, this error may be due to incompatible
versions of dependencies. To fix this problem please remove and re-install
all plugins. Vagrant can attempt to do this automatically by running:

  vagrant plugin expunge --reinstall

Or you may want to try updating the installed plugins to their latest
versions:

  vagrant plugin update

Error message given during initialization: Unable to resolve dependency: user requested 'vagrant-hostsupdater (= 1.0.2)'

試しにrepairしてみる

$ vagrant plugin repair
Repairing currently installed global plugins. This may take a few minutes...
Fetching: vagrant-hostsupdater-1.1.1.160.gem (100%)
Failed to automatically repair installed Vagrant plugins. To fix this
problem remove all user installed plugins and reinstall. Vagrant can
do this for you automatically by running the following command:

  vagrant plugin expunge --reinstall

Failure message received during repair:

Unable to resolve dependency: user requested 'vagrant-hostsupdater (= 1.0.2)'

だめだったのでplugin再インストール

$ vagrant plugin expunge --reinstall

This command permanently deletes all currently installed user plugins. It
should only be used when a repair command is unable to properly fix the
system.

Continue? [N]: y

All user installed plugins have been removed from this Vagrant environment!

Vagrant will now attempt to reinstall user plugins that were removed.
Installing the 'vagrant-hostsupdater' plugin. This can take a few minutes...
Fetching: vagrant-hostsupdater-1.1.1.160.gem (100%)
Installed the plugin 'vagrant-hostsupdater (1.1.1.160)'!

これでvagrant upできるようになった。

4
2
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
4
2