本記事の環境
OS:Windows 11 Home (64 bit)
CPU:AMD Ryzen 5 3500U Radeon Vega Mobile Gfx 2.10 GHz
RAM:20 GB
Vagrant 2.3.4 VirtualBox 7.0
参考書籍
![実践Vagrant [ ミッチェル・ハシモト ] 実践Vagrant [ ミッチェル・ハシモト ]](https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/6655/9784873116655.jpg?_ex=128x128)
- 価格: 2860 円
- 楽天で詳細を見る
![Vagrant入門ガイド【電子書籍】[ 新原雅司 ] Vagrant入門ガイド【電子書籍】[ 新原雅司 ]](https://thumbnail.image.rakuten.co.jp/@0_mall/rakutenkobo-ebooks/cabinet/4611/2000001734611.jpg?_ex=128x128)
- 価格: 440 円
- 楽天で詳細を見る
エラーの発生条件
Vagrantfileで以下をコメントアウトしてvagrant upを実行する
config.vm.network "private_network", ip: "192.168.33.10"
エラー内容
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'centos/7' version '2004.01' is up to date...
==> 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%...E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Querying NetCfgInstanceId failed (ERROR_FILE_NOT_FOUND)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreate(struct HandlerArg *)" at line 105 of file VBoxManageHostonly.cpp
原因と対処方法
原因
Hyper-Vが有効がになっていたため、Hyper-VとVirtualBox+Vagrantと競合が発生していた
対処方法
管理者権限のコマンドプロンプトかPowerShellで以下のコマンドを実行してパソコンを再起動
bcdedit /set hypervisorlaunchtype off