LoginSignup
82
86

More than 5 years have passed since last update.

Vagrant 事始め 番外編 01 - Virtualbox が起動しない

Last updated at Posted at 2018-04-12

Windows で Virtualbox が起動しないので、原因を調べたところ、Virtualbox は Hyper-V が有効になっていると、起動できないと言うことがわかりました。
正確に述べると、Virtualbox が利用する VT-X と Hyper-V は共存できないということです。

> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'centos/7' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: 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", "a8bf9a84-7c2e-415d-8521-3ed9155b5499", "--type", "headless"]

Stderr: VBoxManage.exe: error: Raw-mode is unavailable courtesy of Hyper-V. (VERR_SUPDRV_NO_RAW_MODE_HYPER_V_ROOT)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole

VT-X と Hyper-V は共存できない

Because when hyper-V is installed on Windows 8 Pro, the hypervisor is running all the time underneath the host OS, and only one thing can control the VT hardware at a time for stability. The hypervisor blocks all other calls to the VT hardware..

Hyper-V の状態を確認する

管理者権限でコマンドプロンプトを起動して、確認します。

> bcdedit
Windows ブート マネージャー
--------------------------------
...

Windows ブート ローダー
--------------------------------
...
hypervisorlaunchtype    Auto

hypervisorlaunchtype Auto となっており、Hyper-V が必要とされるときに自動的に有効化される設定になっています。

Hyper-V を無効化する

管理者権限で起動したコマンドプロンプトで bcdedit /set hypervisorlaunchtype off を実行して、再起動をします。

> bcdedit /set hypervisorlaunchtype off

再起動をして、再度 Hyper-V の状態を確認すると無効化されています。

> bcdedit
Windows ブート マネージャー
--------------------------------
...

Windows ブート ローダー
--------------------------------
...
hypervisorlaunchtype    None

有効化する場合は bcdedit /set hypervisorlaunchtype auto (もしくは bcdedit /set hypervisorlaunchtype on) と実行した後に再起動をすれば、有効化されています。

注: bcdedit コマンドで設定を変更した場合、ふたたび設定を変更するには同コマンドの実行が必要になります。
(コントロールパネルや Powershell からでは変更が反映されないということ)

> bcdedit /set hypervisorlaunchtype auto

Hyper-V が無効になっていると

Hyper-V が無効になっていると、ハイパーバイザーを利用するアプリケーションが利用できなくなります。

例えば、Docker とか。

2018-04-12_15h20_50.png

Virtulbox と Docker を同時に利用することができませんが、回避策はあります。それは、Hyper-V が使用できない Windows 用の Docker Toolbox for Windows を利用すれば、同時に稼働はできると思います(未確認……)

82
86
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
82
86