LoginSignup
5
7

More than 3 years have passed since last update.

『vagrant up』時に『VERR_NEM_MISSING_KERNEL_API』が出て起動に失敗する

Posted at

はじめに

普段職場で検証環境にVirtual Boxとvagrantの組み合わせで使用しています。
Dockerと同時に使用することが出来ないと知らずにvagrant upでvmを起動することが出来なくなってしまいました。
起動出来るようにするまで少し時間がかかってしまったので、対策方法を残します。

エラー内容

vagrant up時に以下のエラーが出力され起動に失敗しました。

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "7ce0e735-1e0e-4f2f-a11d-b4938364d615", "--type", "headless"]

Stderr: VBoxManage.exe: error:  (VERR_NEM_MISSING_KERNEL_API).
VBoxManage.exe: error: VT-x is not available (VERR_VMX_NO_VMX)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole

対応策

1.Hyper-Vの無効化

コントロールパネル→プログラムと機能→Windowsの機能の有効化と無効化
以下の機能のチェックを外す

  • Hyper-V
  • Virtual Machine Platform
  • Windows Hypervisor platform
  • Container
  • Windows Defender Application

2.Virtualization Technology (VT-X)を有効にする

BIOSの設定を確認し、Virtualization Technology (VT-X)を有効にする 
手順はこちらのサイトを参考にしました。

3.hypervisorlaunchtypeをoffにする

コマンドプロンプトを管理者権限で起動し、bcdeditコマンドを実行します。

C:\Windows\system32>bcdedit

Windows ブート マネージャー
--------------------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume2
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  ja-JP
inherit                 {globalsettings}
badmemoryaccess         Yes
isolatedcontext         Yes
default                 {current}
resumeobject            {4f25b91c-7a97-11e9-bd51-805bb81bbcbd}
displayorder            {current}
toolsdisplayorder       {memdiag}
timeout                 30

Windows ブート ローダー
--------------------------------
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.efi
description             Windows 10
locale                  ja-JP
inherit                 {bootloadersettings}
recoverysequence        {4f25b924-7a97-11e9-bd51-805bb81bbcbd}
displaymessageoverride  Recovery
recoveryenabled         Yes
badmemoryaccess         Yes
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \Windows
resumeobject            {4f25b91c-7a97-11e9-bd51-805bb81bbcbd}
nx                      OptIn
bootmenupolicy          Standard
hypervisorlaunchtype    Auto

「hypervisorlaunchtype」が「Auto」になっていた場合、以下のコマンドを実行し、OFFにします。

bcdedit /set hypervisorlaunchtype off

ここまでやったら「vagrant up」をやってみます。

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "7ce0e735-1e0e-4f2f-a11d-b4938364d615", "--type", "headless"]

Stderr: VBoxManage.exe: error: The VM session was closed before any attempt to power it on
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component SessionMachine, interface ISession

結果が変わりました。

4.VMのストレージからCR-ROMを外す

VirtualBoxを起動し、設定のストレージからCD-ROMの情報を外す

「vagrant up」を再度試してみる。

・・・。
・・・。
・・・。
結果は変わらずでした。

5.困った時の・・

再起動

vagrant upでVMが正常に起動しました。

最後に

非常にめんどくさいですね。
仕事でVirtualBoxを使用しているのですが、VSCodeの「IBM Blockchain Platform」を使ってコントラクト開発をしたく、やってみたところハマってしまいました。
安全にHyper-VのON/OFFを切り替えられるようにしたほうが良さそうですね。

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