LoginSignup
27
21

More than 5 years have passed since last update.

[vagrant][windows10]Windows + VirtualBox (+ vagrant) でvagrant upできなくなったとき

Posted at

vagrant.png

「昨日までvagrant upしていたのに急にできなくなった!!!!」

こんな経験がありませんか? ええありましたとも。

そう、Windows 10 Fall Creators Updateを終えたらね。

過去にいくつも事例がある

vagrant upができなくなったみたいな事例はググると無数に出てくる。

しかし、ピンポイントに解決に導いてくれる記事はみつけられなかった。

Windows 10 Fall Creators Updateが新しすぎるというのもあるかもしれないが、まず今時VagrantでVM立ち上げる人間がどれくらいいるのこんなBoot遅いのに(怒)って感じでやってる人が居ないんだとも思う。

結論:VirtualBoxのバージョンによるバグ説

WindowsのVirtualBoxバージョンが5.1.14だった。

これを5.1.30に上げることでなんとかvagrant upに漕ぎ着けた。

VirtualBoxは現在(10/31/2017)の時点で最新は5.2らしいが、Vagrant側がサポートしていないらしい。

C:\Users>vagrant up
The provider 'virtualbox' that was requested to back the machine
'server' 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.

しかしこれがハマる一つの原因にもなった。

5.2がだめで、現行の5.1もだめじゃあ、「VirtualBoxのバージョン違いじゃないか」というWEB記事は「参考にならん」と切り捨てることになったからだ。

しかし、5.1には5.1.30があるわけで。

それに気づくにもvirtualboxを起動したときの「最新版があるぞい」というポップアップを注意深く読まないと気づけなかった。

起きたこと・試したこと

まずこの事象に気づいてから試していったことを記載していくので、もし同じ状況の人がいたら確認していってみてほしい。

VM起動失敗

vagrant upを叩いて、まず出てきたのは以下のエラー。

C:\Users>vagrant up
Bringing machine 'server' up with 'virtualbox' provider...
==> server: Clearing any previously set forwarded ports...
==> server: Clearing any previously set network interfaces...
==> server: Preparing network interfaces based on configuration...
    server: Adapter 1: nat
    server: Adapter 2: hostonly
==> joins_server: Forwarding ports...
    server: 22 (guest) => 2210 (host) (adapter 1)
    server: 80 (guest) => 8010 (host) (adapter 1)
    server: 443 (guest) => 44310 (host) (adapter 1)
    server: 3306 (guest) => 33610 (host) (adapter 1)
==> server: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "xxxxxxxxxxxxx", "--type", "headless"]

Stderr: VBoxManage.exe: error: The virtual machine 'vagrant-server_xxxxx_xxxx' has terminated unexpectedly during startup with exit code 1 (0x1).  More details may be available in 'C:\Users\username\VirtualBox VMs\vagrant-server_xxxxx_xxxx\Logs\VBoxHardening.log'
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component MachineWrap, interface IMachine

Bootingまで行って、突然見知らぬエラーが吐かれた。

とりあえずこういうときはアップデートだろ?という雑な見解でVirtualBoxとVagrantに最新版がないか確認した。

  • VirtualBoxとVagrantの現行バージョンと最新版の確認

で、実際やったのは

  1. Vagrantのバージョンアップ
  2. VirtualBoxのバージョンアップ(5.1.14 -> 5.2)

すると、プラグインもアップデート、リペアしてねと指示されたので従ってみた。

C:\Users>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-global-status (> 0)'

リペアする。

C:\Users\vagrant plugin repair
Repairing currently installed plugins. This may take a few minutes...
Fetching: vagrant-global-status-0.1.4.gem (100%)
Fetching: vagrant-omnibus-1.5.0.gem (100%)
Fetching: vagrant-share-1.1.9.gem (100%)
Fetching: micromachine-2.0.0.gem (100%)
Fetching: vagrant-vbguest-0.15.0.gem (100%)
Installed plugins successfully repaired!

バージョン確認してみる。

C:\Users>vagrant --version
Vagrant 2.0.0

改めてvagrant up

C:\Users>vagrant up
The provider 'virtualbox' that was requested to back the machine
'server' 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.

冒頭で述べた通り、バージョン5.2はサポートしていないよと返ってきた。

仕方ないのでバージョンを5.1.14に戻し、vagrant up

C:\Users>vagrant up
Bringing machine 'server' up with 'virtualbox' provider...
==> server: Importing base box 'CentOS-6.7-x86_64-v20151108.box'...
==> server: Matching MAC address for NAT networking...
==> server: Setting the name of the VM: vagrant-server_xxxxxx_xxxxx
==> server: Clearing any previously set network interfaces...
==> server: Preparing network interfaces based on configuration...
    server: Adapter 1: nat
    server: Adapter 2: intnet
==> server: Forwarding ports...
    server: 22 (guest) => 2210 (host) (adapter 1)
    server: 80 (guest) => 8010 (host) (adapter 1)
    server: 443 (guest) => 44310 (host) (adapter 1)
    server: 3306 (guest) => 33610 (host) (adapter 1)
==> server: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "xxxxx-xxxxx-xxxxxxx", "--type", "headless"]

Stderr: VBoxManage.exe: error: The virtual machine 'vagrant-server_xxxxx_xxxx' has terminated unexpectedly during startup with exit code 1 (0x1).  More details may be available in 'C:\Users\username\VirtualBox VMs\vagrant-__server_xxxxx_xxxx\Logs\VBoxHardening.log'
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component MachineWrap, interface IMachine

VBox-Win10-fix-14040.exeを試す

OSSを触りながらつぶやく日記をみるとVBox-Win10-fix-14040.exeをダウンロードして、起動したままvagrant upするとうまくいくという。

しかしながら、こちらの記事のエラー文はadapterに関するものであり、正直藁をも掴む思いでやってみただけだった。

もちろんうまく行かず、だった。

詳細のエラーログを見てみる

エラーログに詳細残すから読んどいてってことなので見てみる。

1c5c.c08: supHardenedWinVerifyImageByHandle: -> 0 (\Device\HarddiskVolume3\Windows\System32\rsaenh.dll)
1c5c.c08: supR3HardenedWinVerifyCacheInsert: \Device\HarddiskVolume3\Windows\System32\rsaenh.dll
1c5c.c08: supR3HardenedWinVerifyCacheProcessImportTodos: Processing 'bcrypt.dll'...
1c5c.c08: supR3HardenedWinVerifyCacheProcessImportTodos: 'bcrypt.dll' -> '\Device\HarddiskVolume3\Windows\System32\bcrypt.dll' [rcNtRedir=0xc0150008]
1c5c.c08: supR3HardenedScreenImage/Imports: cache hit (Unknown Status -626 (0xfffffd8e)) on \Device\HarddiskVolume3\Windows\System32\bcrypt.dll [lacks WinVerifyTrust]
1c5c.c08: Error (rc=0):
1c5c.c08: supR3HardenedScreenImage/Imports: cached rc=Unknown Status -626 (0xfffffd8e) fImage=1 fProtect=0x0 fAccess=0x0 cHits=1 \Device\HarddiskVolume3\Windows\System32\bcrypt.dll
1c5c.c08: supR3HardenedMonitor_LdrLoadDll: pName=C:\WINDOWS\system32\rsaenh.dll (rcNtResolve=0xc0150008) *pfFlags=0x0 pwszSearchPath=0000000000000001:<flags> [calling]
1c5c.c08: supR3HardenedScreenImage/NtCreateSection: cache hit (VINF_SUCCESS) on \Device\HarddiskVolume3\Windows\System32\rsaenh.dll [lacks WinVerifyTrust]
1c5c.c08: supR3HardenedScreenImage/NtCreateSection: cache hit (Unknown Status -626 (0xfffffd8e)) on \Device\HarddiskVolume3\Windows\System32\bcrypt.dll [lacks WinVerifyTrust]
1c5c.c08: Error (rc=0):
1c5c.c08: supR3HardenedScreenImage/NtCreateSection: cached rc=Unknown Status -626 (0xfffffd8e) fImage=1 fProtect=0x10 fAccess=0xf cHits=2 \Device\HarddiskVolume3\Windows\System32\bcrypt.dll
1c5c.c08: supR3HardenedMonitor_LdrLoadDll: returns rcNt=0xc0000190 'C:\WINDOWS\system32\rsaenh.dll'
1c5c.c08: supR3HardNtViCallWinVerifyTrust: WinVerifyTrust failed with 0x8 (<NULL>) on '\Device\HarddiskVolume3\Program Files\Oracle\VirtualBox\VBoxHeadless.exe'
1c5c.c08: Error -22919 in VBoxHeadless! (enmWhat=1)
1c5c.c08: WinVerifyTrust failed on stub executable: WinVerifyTrust failed with hrc=Unknown Status 0x8 on '\Device\HarddiskVolume3\Program Files\Oracle\VirtualBox\VBoxHeadless.exe'
1fc8.974: supR3HardNtChildWaitFor[2]: Quitting: ExitCode=0x1 (rcNtWait=0x0, rcNt1=0x0, rcNt2=0x103, rcNt3=0x103, 100 ms, the end);
1f78.1c64: supR3HardNtChildWaitFor[1]: Quitting: ExitCode=0x1 (rcNtWait=0x0, rcNt1=0x0, rcNt2=0x103, rcNt3=0x103, 520 ms, the end);

このエラー文でググってもいい感じのは出てこなかった。

他のPCでもvagrant upしてみる

幸い他の社員さんにvagrantを実行してもらうことができたので、やってもらった。

もしかしてvagrantfileが悪いのか、なんてことも、ないことはない(vagrantfileが問題ならすぐわかるけどね)

実際にやってもらったが、同様のエラーが再現された。

ちなみにVirtualBoxは5.1.14とかで、5.1.30ではないことは確認していた。

また、他の社員さんのMacbookと自分のMacbookでも試したが問題なくvagrant upができた。

これで一気に切り分けが出来たという感じ。

つまりwindows特有の何かであると仮説が立った。

Windows 10 Fall Creators Update

最もありえるのはこのアップデートによる不具合。Windowsお得意の不安定さである。

調べていく中で、この記事が偶然にもヒットしたことはかなり幸運と言えた。

そうして、ググるワードを少し変えてみると、出るわ出るわ。

vagrant upができなかった時に取った対処法などなど。

しかし、これらの記事で解決することはできなかった。

ただ、この仮説はあっていると思ったので、他にも眺めていると一つの記事に出会った。

Windows + VirtualBox (+ vagrant) で仮想マシンが起動できない

「最新バージョンのVirtualBoxだと動かない場合があるよ、ダウングレードしてね」という内容。

まさかまさかだったが、5.2の手前の5.1.30を再インストールしてみることにした。

VirtualBox5.1.30のインストール

インストール後、vagrant up

C:\Users\>vagrant up
Bringing machine 'server' up with 'virtualbox' provider...
==> server: Clearing any previously set forwarded ports...
==> server: Clearing any previously set network interfaces...
==> server: Preparing network interfaces based on configuration...
    server: Adapter 1: nat
    server: Adapter 2: intnet
==> server: Forwarding ports...
    server: 22 (guest) => 2210 (host) (adapter 1)
    server: 80 (guest) => 8010 (host) (adapter 1)
    server: 443 (guest) => 44310 (host) (adapter 1)
    server: 3306 (guest) => 33610 (host) (adapter 1)
==> server: Booting VM...
==> server: Waiting for machine to boot. This may take a few minutes...
    server: SSH address: 127.0.0.1:2210
    server: SSH username: vagrant
    server: SSH auth method: private key

....省略

PLAY RECAP *********************************************************************
192.168.33.xx : ok=53 changed=42 unreachable=0 failed=0

できたぞ!! ansible_localまでばっちり動作し、Playbookの確からしさも確認できた!

まとめ

今回の原因はおそらくWindows 10 Fall Creators UpdateしたことによってVirtualBoxがイカれたって感じだろうか。

確認すべきポイントは以下の通りかなと。

  • VirtualBoxのバージョン
  • Windows updateが直近で発生していたか
  • vagrantfileやPlaybook、Cookbookは間違っていないか
  • 他のPCでも同様のエラーは再現するか
  • エラー内容をピンポイントでググれていてるか
  • VirtualBoxなどはダウングレードも試してみたか

これでだめなら、MacTypeが悪さしているという話もあったので確認してみること。

参考

Vagrant up error. #8501

VBoxManageコマンド

OSSを触りながらつぶやく日記

Windows + VirtualBox (+ vagrant) で仮想マシンが起動できない

フルスタックエンジニアを目指して

Vagrant up: There was an error while executing VBoxManage, a CLI used by Vagrant #1809

11月15日以降のWindows 8.1アップデート後のWinVerifyTrustの失敗

Test, Develop, and Demonstrate Across Multiple Platforms on one Machine

vagrant upができなかった時に取った対処法

VirtualBoxで起動エラーが出たらMacTypeを疑う

[vagrant][windows10]Windows + VirtualBox (+ vagrant) でvagrant upできなくなったとき

27
21
1

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