Vagrant:NS_ERROR_FAILURE

yimt發表於2020-11-15

Vagrant:NS_ERROR_FAILURE

環境:macOS11.0.1

1. 前言

macOS10.15.7升級最新的11.0.1過後,使用Vagrant建立CentOS7虛擬機器啟動提示如下錯誤。

You're running an up-to-date version of Vagrant!
yimt@MacBook-Pro centos7-docker % vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> 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", "517d8765-baba-4661-8aef-8f87cee74139", "--type", "headless"]

Stderr: VBoxManage: error: The virtual machine 'centos7-docker_default_1605406732336_15153' has terminated unexpectedly during startup with exit code 1 (0x1)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine

2. 解決方法

2.1. 重啟VirtualBox

# 重啟命令
sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart

# 提示
Loading VBoxDrv.kext
Extension with identifiers org.virtualbox.kext.VBoxNetFlt,org.virtualbox.kext.VBoxNetAdp,org.virtualbox.kext.VBoxDrv,org.virtualbox.kext.VBoxUSB not approved to load. Please approve using System Preferences.
Error: Failed to load org.virtualbox.kext.VBoxDrv
Loading VBoxUSB.kext
Extension with identifiers org.virtualbox.kext.VBoxDrv,org.virtualbox.kext.VBoxNetFlt,org.virtualbox.kext.VBoxNetAdp,org.virtualbox.kext.VBoxUSB not approved to load. Please approve using System Preferences.
Error: Failed to load org.virtualbox.kext.VBoxUSB
Loading VBoxNetFlt.kext
Extension with identifiers org.virtualbox.kext.VBoxNetAdp,org.virtualbox.kext.VBoxDrv,org.virtualbox.kext.VBoxNetFlt,org.virtualbox.kext.VBoxUSB not approved to load. Please approve using System Preferences.
Error: Failed to load org.virtualbox.kext.VBoxNetFlt
Loading VBoxNetAdp.kext
Extension with identifiers org.virtualbox.kext.VBoxUSB,org.virtualbox.kext.VBoxDrv,org.virtualbox.kext.VBoxNetAdp,org.virtualbox.kext.VBoxNetFlt not approved to load. Please approve using System Preferences.
Error: Failed to load org.virtualbox.kext.VBoxNetAdp
Executing: /usr/bin/kmutil unload -b org.virtualbox.kext.VBoxNetAdp
Executing: /usr/bin/kmutil unload -b org.virtualbox.kext.VBoxNetFlt
Executing: /usr/bin/kmutil unload -b org.virtualbox.kext.VBoxUSB
Executing: /usr/bin/kmutil unload -b org.virtualbox.kext.VBoxDrv
Fatal error: VirtualBox

2.2. 檢查重啟失敗提示

不同原因可能提示不同按照自己失敗的原因去查詢解決方案

Please approve using System Preferences.

提示需要去系統首選項授權,也就是:系統偏好設定->安全與隱私->通用。裡面有提示需要允許VirtualBox執行一些特殊操作,我這裡面允許過後是提示需要重啟,重啟完成就可以正常操作。