2024/08/05追記
Windows11 23H2(osビルド22631.3880)の別マシンで、デタッチモードで(Vagrantfileにvb.gui = trueを指定せずに)起動したところ、問題なく起動できた。やはりWindowsのバージョンに起因する問題の可能性が高い?
問題
VirtualBoxをバックエンドとしてVagrantを使用しているのだが、vagrant up時にエラーが出る。
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component MachineWrap, interface IMachine
エラーメッセージからしてVirtualBoxの問題っぽいので確認してみたところ、VirtualBox側で仮想マシンをヘッドレス起動 or デタッチモード起動するとエラーが出て起動できないことがわかった。
The virtual machine (略) has terminated unexpectedly during startup with exit code 1 (0x1). More details may be available in 'C:\Users\(略)\VirtualBox VMs\(略)\Logs\VBoxHardening.log'.
終了コード : E_FAIL (0X80004005)
コンポーネント: MachineWrap
インターフェース: IMachine {300763af-5d6b-46e6-aa96-273eac15538a}
なお補足として、ログファイルC:\Users\<user>\VirtualBox VMs\<machine_name>\Logs\VBoxHardening.logの末尾には次のように記載されていた。
47c4.284c: Error (rc=-5607): 47c4.284c: ntdll.dll: SizeOfImage (0x262000) isn't close enough to the mapping size (0x265000) 47c4.284c: Error (rc=-5607): 47c4.284c: supHardenedWinVerifyProcess failed with -5607: ntdll.dll: SizeOfImage (0x262000) isn't close enough to the mapping size (0x265000) 47c4.284c: Error -5607 in supR3HardNtChildPurify! (enmWhat=5) 47c4.284c: supHardenedWinVerifyProcess failed with -5607: ntdll.dll: SizeOfImage (0x262000) isn't close enough to the mapping size (0x265000)
環境
- Windows 11 Pro 24H2
- osビルド:26100.1301
- VirtualBox 7.0.18 r162988
- extention pack 7.0.18r162988
- Vagrantの使用Box:bento/ubuntu-22.04
予想される原因
複数の原因が予想できるが、正解はわかっていない。おそらくWindowsアップデートではないかと思っている。
- Windowsアップデート
- 問題発生と同時期にWindowsのバージョンを24H2にアップデートしていた
- VirtualBox自体の問題
- こちらも最近アップデートしたので可能性はある
対処
根本的な対処にはなり得ないが、Vagrantでも正常起動(つまりGUIあり)で仮想マシンを起動するようにすれば問題は解決する。
具体的には、Vagrantfileに以下の通りvb.gui = trueという記述を追記すればよい。
参考:https://forums.virtualbox.org/viewtopic.php?p=545486#p545486
(中略)
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true # この文を追加!!
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
(中略)
この状態でvagrant upすると正常に起動するのではと思う。VirtualBoxのウィンドウ(仮想マシンの画面)が立ち上がるようになるのが邪魔ではあるが仕方ない。