'VirtualBox NS_ERROR_FAILURE (0x80004005) macOS
I'm using macOS and installed VirtualBox.
When I start a machine, I'm getting the following error :
Failed to open a session for the virtual machine ubuntu.
The virtual machine 'ubuntu' has terminated unexpectedly during startup with exit code 1 (0x1).
Result Code: NS_ERROR_FAILURE (0x80004005)
Component: MachineWrap
Interface: IMachine {85cd948e-a71f-4289-281e-0ca7ad48cd89}
Solution 1:[1]
This error seems to appear with VirtualBox installs on versions of macOS 10.13.
To fix this issue, you have to uninstall VirtualBox (use the VirtualBox_uninstall.tool of the VirtualBox downloaded dmg).
Then, install it again executing VirtualBox.pkg. At the end of the install, go to System Preferences, Security and Privacy, and the click the allow button :
This should solve your issue.
Solution 2:[2]
Here is what worked for me. I kept getting that error when I was trying to 'add' the ISO after clicking start on the VM to set it up.
However, when I clicked on 'Tools' on the left sidebar, then click "Media". From there I was able to add my Kali Linux ISO so when I started the VM again, the ISO showed up in the list.

Solution 3:[3]
- Download the virtualbox extension from https://www.virtualbox.org/wiki/Downloads
- Run it and it works!
Solution 4:[4]
Let's look at this from a troubleshooting perspective. The number one thing to do instead of guessing is diagnose and the best way to do that when you don't know what the problem is. I'll take you through the steps for my particular use case but it should give you a general idea on how to look at the problem in order to find the correct solution.
a.-Have a look at the actual logs of the VM:
Click on the Menu Item, you should see three choices:
- Details
- Snapshots
- Logs
Look for this error code: VMSetError and look for the matching RETURN CODE (rc) rc=VERR_VD_IMAGE_READ_ONLY
In the example below the file under /build/virtualbox....is in read only mode.
VMSetError: /build/virtualbox-8vePuu/virtualbox-6.1.16-dfsg/src/VBox/Devices/Storage/DrvVD.cpp(5228) int drvvdConstruct(PPDMDRVINS, PCFGMNODE, uint32_t); rc=VERR_VD_IMAGE_READ_ONLY
b.-Interpret what that means: But the problem is the /build directory does not exist at all. So what the rc above really means is that it cannot FIND that file, because /build doesn't even exist (nor it seems to be supposed to).
cd: /build/virtualbox-8vePuu/virtualbox-6.1.16-dfsg/src/VBox/Devices/Storage/: No such file or directory
root@pop-os:~# cd /build/virtualbox-8vePuu/virtualbox-6.1.16-dfsg/
-bash: cd: /build/virtualbox-8vePuu/virtualbox-6.1.16-dfsg/: No such file or directory
root@pop-os:~# cd /build
-bash: cd: /build: No such file or directory
root@pop-os:~# ls /
bin dev home lib32 libx32 media opt root sbin sys usr
boot etc lib lib64 lost+found mnt proc run srv tmp var
Another thing to notice is that for my case other VMs with VDIs in the same location don't have the problem. That completely discards two possibilities:
- There's a problem with the install of Virtual Box
- There's an actual file permissions issue
The possibility is that the VM got corrupted at some point during shut down and that created the config corruption, not a VDI corruption at the VM level, not VirtualBox level.
Unless you power off your VM the "Close" function on your Vm window will ALWAYS save the state of the machine, so "Discarding" the state is only possible when you have two or more states because in that case at a minimum there is always the LAST state.
The conclusion is then that the corruption is at the VM state level and we need to get rid of that.
c.-Solution:
Go to VM-> Menu->Snapshots -> Clone
Create a linked Clone. That will simply copy the config files to the right place and link with the same VDI.
Start that one. If it starts you know you have a problem with the original VM. You can either re-create the VM and point to the existing VDI or create a full clone (it will take longer) and the delete the original.
To prevent this (at least for my case), avoid sending the Power Off Message to your VM when closing, better use the ACPI Shutdown method as Power off can leave (as we saw) your machine on an unwanted state.
Solution 5:[5]
Using a readonly filesystem, blocking VBox files wrtiting access causes this error. Move VBox virtual machines files to a new location with writing permissions must resolves this problem. In my case, i use a Linux server, with VBOx software but my machine was moved to a Windows partition with BitLocker active and the windows Disk was mounted in ReadOnly, causing this problem.
Solution 6:[6]
I was having the same problem with the latest Monterey Macos. Just run the following commands on your terminal.
sudo kextload -b org.virtualbox.kext.VBoxDrv
sudo kextload -b org.virtualbox.kext.VBoxNetFlt
sudo kextload -b org.virtualbox.kext.VBoxNetAdp
sudo kextload -b org.virtualbox.kext.VBoxUSB
And here's where I got these commands from: https://forums.virtualbox.org/viewtopic.php?f=39&t=104272&sid=617676a134b8f244304a58cbe41c3e86
[update] Unfortunately, I have to execute this command every time I restart my laptop. I'll put a definitive solution once I get it.
Solution 7:[7]
That file is obviously corrupted. If you go to that location [1], you'll see a 0-bytes file. In that same folder, chances are you're going to find a file named "VirtualBox.xml-prev". Delete the "VirtualBox.xml" file (the 0-bytes one) and rename the "VirtualBox.xml-prev" to "VirtualBox.xml".
If there is no "VirtualBox.xml-prev", or if it's also a 0-bytes file, then don't worry, it's still fixable. Just delete both of these files, they will be re-created when VirtualBox runs again. You simply would have lost any VirtualBox preferences and registered VMs that you might have had. Not the VMs themselves, the list of the VMs. You need to re-register your VMs, by either double-clicking on the .vbox file of every VM that you have, or go to the menu "Machine" ยป "Add" and navigate to the .vbox file of each of your existing VMs. Your VMs are located (by default) in "/Users//VirtualBox VMs".
Solution 8:[8]
Had the same issue on Mac OS Big Sur 11.4 when I was trying to add my Ubuntu instance (on Intel tho), nothing suggested here and other topics helped. Turned out you have to give access (Full Disc Access) to Virtual Box in Settings. Go to Settings -> Security & Privacy -> Privacy -> Full Disc Access -> plus sign (unlock it if needed) -> choose Virtual Box Application -> Open. After that I was able to choose my Ubuntu image in Finder.
Solution 9:[9]
If you are working on Vagrant and VirtualBox with the latest macOS Monterey, I will tell you based on my hour's search that it is the incompatible issue of the latest Monterey.
I now have several options to do. one is to downgrade to the last version of macOS(annoying), the other is to continually find a walk around.
you may find this to be useful as a walk around:
add code below in your vagrant file to start with GUI instead of headless
config.vm.provider "virtualbox" do |vb|
vb.gui = true
end
Solution 10:[10]
If somebody have problem with run virtual machine after upgrade VirtualBox on BigSur 11.6.3, first should check System Extension in System preferences -> Security & Privacy and allow Run Oracle. After rebooting computer, virtual machine start normally.
Solution 11:[11]
I had this issue after I upgraded to Monterrey from Big Sur. To fix:
- completely uninstall Virtualbox. Do this by downloading and opening the DMG and choose 'Virtualbox_uninstall.tool'. You will get a permission denied error, so go to System Preferences->Security and Privacy->General tab, and click on the relevant 'Allow' in 'Allow apps downloaded from:' section. This will run the script
- install VirtualBox 6.1.30 (the latest will likely work as well). I still got the same "NS_ERROR_FAILURE" error. Again go to System Preferences->Security and Privacy->General tab and allow Oracle from the 'Allow apps downloaded from:' section. You will have to reboot
Solution 12:[12]
I got this when I was trying to restore a suspended session. The fix was to click the "Discard" button (down arrow icon) and just discard the saved machine state. It's at least faster that uninstall/reinstall, I'd try it first.
Solution 13:[13]
I had the issue when I upgraded and I used the Extensions feature.
Check that your extensions have been updated as well. Download the latest from VirtualBox Website. Select File / Preferences and then the Extensions. Click the add symbol and select the new updated extension file.
Try and restart your virtual machine again.
Solution 14:[14]
On MacOS Mojave, owner for /Applications folder needs to be user root, group admin. Same for the VirtualBox.app folder. This was the only thing that worked for me.
Solution 15:[15]
If you are trying to run an OS with state saved, then right clicking the Virtual machine and pressing discard saved state could resolve the issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow


