【解決方法】VirtualBoxをHomebrewで再インストール後Vagrant起動時に発生したNS_ERROR_FAILUREの対処

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。
VirtualBoxを再インストール後Vagrant起動時に発生したNS_ERROR_FAILUREの解決手順をメモしました。
環境
- Vagrant 2.2.16
- VirtualBox 6.1.22 r144080
発生したエラー
実行ログ
zsh$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'centos/8' version '2011.0' is up to date...
==> default: Clearing any previously set forwarded ports...
==> 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%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 95 of file VBoxManageHostonly.cpp
VBoxManageのCLIの実行エラー
VagrantがVBoxManage
のCLIを実行しようとした際にエラーが発生しているようです。
zshThere was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
VirtualBoxで確認
VirtualBoxから起動を確認してみるとカーネルドライバーがインストールされていないというエラーが出ています。
zshKernel driver not installed (rc=-1908)
Make sure the kernel module has been loaded successfully.
where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT.
エラーの原因
システムソフトウェアアップデートの許可
VirtualBoxのアップデートの際にシステムソフトウェアアップデートの許可を実行していなかったことが原因でした。
システムソフトウェアアップデートを許可して解決
セキュリティとプライバシーを開く
システム環境設定
> セキュリティとプライバシー
を開きます。
実行許可
「開発元"Oracle Ameria, Inc."のシステムソフトウェアがアップデートされました。」の右側の許可
を実行します。
再起動の実施
再起動の案内が表示されるので任意のタイミングで再起動します。
「開発元 Oracle Ameria, Inc. のシステムソフトウェアがアップデートされました。」の右側の許可
を実行します。
Vagrantを再リロード
vagrant reload
コマンドでvagrantをリロードします。
zsh$ vagrant reload
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'centos/8' version '2011.0' 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: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
[default] GuestAdditions 6.1.22 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Rsyncing folder: /Users/yuki.hayakawa/workspace/sakura-tools/ => /vagrant
==> default: Mounting shared folders...
default: /var/www/app => /Users/yuki.hayakawa/workspace/sakura-tools
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
無事起動することができました。
- article
【早見表】よく使うVagrantコマンドとオプションの一覧まとめ
- article
vagrantで起動したVM内で立ち上げているDockerのVolume(MySQLデータ永続化)で書き込みエラーになる件の対処
- article
【解決方法】Vagrantで構築したUbuntu20.04へsynced_folder を設定した際に発生するマウントエラーの対処
- article
【設定方法】VagrantとVirtualBoxでUbuntu20.04の仮想環境をサクッと構築する手順
- article
【設定方法】VagrantとVirtualBoxでCentOS8の仮想環境をサクッと構築する手順
- article
【解決方法】Vagrantを起動した際に発生するumount: /mnt: not mounted.の対処について
- article
Dify と外部 API 連携:Webhook・Zapier・REST API 活用法Dify と外部 API 連携:Webhook・Zapier・REST API 活用法
- article
ESLint の自動修正(--fix)の活用事例と注意点
- article
Playwright MCP で大規模 E2E テストを爆速並列化する方法
- article
Storybook × TypeScript で型安全な UI 開発を極める
- article
Zustand でユーザー認証情報を安全に管理する設計パターン
- article
Node.js × TypeScript:バックエンド開発での型活用テクニック
- review
人類はなぜ地球を支配できた?『サピエンス全史 上巻』ユヴァル・ノア・ハラリが解き明かす驚愕の真実
- review
え?世界はこんなに良くなってた!『FACTFULNESS』ハンス・ロスリングが暴く 10 の思い込みの正体
- review
瞬時に答えが出る脳に変身!『ゼロ秒思考』赤羽雄二が贈る思考力爆上げトレーニング
- review
関西弁のゾウに人生変えられた!『夢をかなえるゾウ 1』水野敬也が教えてくれた成功の本質
- review
「なぜ私の考えは浅いのか?」の答えがここに『「具体 ⇄ 抽象」トレーニング』細谷功
- review
もうプレーヤー思考は卒業!『リーダーの仮面』安藤広大で掴んだマネジャー成功の極意