63

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}
5
  • 2
    StackOverflow's scope is limited to questions about writing code, or tools exclusively for that use. Questions about usage/troubleshooting that doesn't involve modifying a program's source code are a better fit for SuperUser, or a platform-specific Stack Exchange site such as Unix & Linux or Ask Different. Commented Mar 25, 2019 at 22:03
  • 2
    This is now an issue on macOS 12.0.1 Monterey, too Commented Oct 26, 2021 at 13:47
  • 1
    @CharlesDuffy SuperUser only if this does turn out to be a permissions issue, which it is NOT on my instance. Unix & Linux for a MacOSX-specific question? Nah. I have been through every answer in this thread and non seems to be the correct answer in my situation. MacOSX Monterey, newest VBox version.
    – DevlshOne
    Commented Oct 29, 2021 at 22:12
  • 2
    @DevlshOne, I'll grant you that Super User or Ask Different is a better choice than Unix & Linux (though MacOS X is a UNIX) -- but the above doesn't make any kind of argument for keeping it here on Stack Overflow. Our scope is limited to questions about writing code or about tools that are specific to development work. VirtualBox isn't specific to development work, and there's no code in the question at all. Commented Oct 29, 2021 at 22:41
  • 1
    2023 answer - first, just try upgrading VirtualBox to the most recent version.
    – rinogo
    Commented Apr 27, 2023 at 22:53

22 Answers 22

97

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 :

Allow Oracle America, Inc.

The preferences pane has changed in macOS Ventura. You have to find the corresponding section in Privacy & Security which has a button to configure the extensions and then asks fora restart.

Ventura system extensions

This should solve your issue.

16
  • 2
    I didn't even need to do a separate uninstall step... just installed the latest version and that fixed it.
    – Cryptc
    Commented Jul 4, 2021 at 18:50
  • 14
    I never had the option to allow developer "Oracle…". I'm basically stuck at this point.
    – lampyridae
    Commented Jul 5, 2021 at 19:37
  • 2
    This worked for me on macOs 11.4 Big Sur, with VirtualBox 6.1
    – adejones
    Commented Jul 17, 2021 at 13:00
  • 3
    @BrunoBronosky I'm trying this with macOs 11.4 Big Sur & VirtualBox 6.1 but every time I visit system preferences in Security & Privacy I don't see the message about blocked software components. I vaguely remember Mac saying something like that a long time ago but I don't know how to find it again...
    – profPlum
    Commented Jul 19, 2021 at 14:32
  • 7
    Doesn't solve my issue on Monterey.
    – DevlshOne
    Commented Oct 29, 2021 at 22:16
19

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.

Screenshot of VirtualBox VM

18

enter image description here

  • Run it and it works!
6
  • 2
    you save me m8.
    – Vasilisck
    Commented May 4, 2021 at 18:47
  • @Vasilisck Glad to hear :) Commented May 5, 2021 at 8:59
  • 1
    Thanks! Helped! The version of VB and the pack has to match I guess.
    – Hitokage
    Commented Aug 19, 2022 at 7:48
  • 1
    The version of the extension pack has to be exactly the same as the version of VirtualBox. You need to install it under File - Options - Extensionpack.
    – Andreas
    Commented Sep 25, 2022 at 7:22
  • Didn't work, yay!
    – rschwieb
    Commented Oct 31, 2022 at 19:06
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.

5

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:

  1. Details
  2. Snapshots
  3. 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.

3

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.

3

Same thing happened to me after upgrading to MacOS Ventura 13.1. I solved the issue by installing VirtualBox 7 from their website. https://www.virtualbox.org

2

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.

2
  • 1
    Didn't work for me.
    – DevlshOne
    Commented Oct 29, 2021 at 22:14
  • Thx @jonathan-homer, that was the solution that worked for me (because I had a missing / broken extension pack on my host, obviously) Commented Jul 25, 2022 at 7:01
2

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.

2
  • 1
    I tried it and it didn't work Commented Oct 10, 2021 at 21:11
  • Didn't work for me, either. Even after two uninstall / reinstalls and manually adding Oracle VBox to the Files and Folders Access role.
    – DevlshOne
    Commented Oct 29, 2021 at 22:14
2

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.

1
  • I get an error: Error Domain=KMErrorDomain Code=71 "Kernel request failed: (libkern/kext) kext (kmod) start/stop routine failed (-603946985)" UserInfo={NSLocalizedDescription=Kernel request failed: (libkern/kext) kext (kmod) start/stop routine failed (-603946985)}
    – jakxnz
    Commented Aug 11, 2022 at 2:02
2

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
2

macOS BIG Sur v 11.6:

this post is open for a long time but no solution worked for me but finally I found the solution

  • start virtualbox with terminal in sudo mode
sudo virtualbox 
  • install your ova system kali, unbutu...

  • start your vm after to have change the settings

  • during the launch of your vm it is possible that macos must have allow your audio device click "allow"

I found this solution forums.virtualbox

thanks to them

1
  • So, starting virtualbox as sudo did it for me. I installed Virtualbox with he dmg file but still launched with terminal. My windows partition wasn't visible so I simply dragged and dropped the .vbox file into the window and it was ready. After starting the SD card reader was there and I was even able to burn an Android image to it. Commented Apr 3, 2023 at 18:04
2

I was facing a similar issue with vagrant version v2.3.2 and VirtualBox version 7.0.2 on macOS Ventura. In my case, the issue was solved by doing the following:

# 1
sudo su
csrutil clear

#2
Then uninstall VirtualBox using the official uninstaller after that reboot the system.

#3
After the reboot install VirtualBox again using:

brew install --cask virtualbox

#4 
Add this line to your Vagrantfile:
virtualbox__intnet: true

#5
vagrant up
0
2

I'm running macOs Ventura. After getting this error, I simply downloaded and installed latest version of Virtualbox, it simply fixed this issue and run without any problems.

1
  • 3
    Same here but the key is to download and install VirtualBox 7. If you have VirtualBox 6.1 it doesn't work and checking for updates claim there is no update. You need to look for version 7, download it and install it. Beware. Commented Nov 23, 2022 at 14:34
2

For me it happened after upgrading my MacOS to Ventura. I also had to upgrade my VB to 7.x as mentioned here to fix the issue

1

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.

1
  • yes, discarding the saved state works.
    – Resfe
    Commented Sep 1, 2023 at 1:43
1

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".

1
  • Didn't solve my issue.
    – DevlshOne
    Commented Oct 29, 2021 at 22:15
1

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
1

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.

1
  • 1
    This was the only solution here that worked for me (Big Sur v11.1; VirtualBox v7.0.10). Obviously lost the saved state, but the machine was otherwise as I left it (i.e. like it had been turned off instead of hibernated).
    – DyedPurple
    Commented Aug 11, 2023 at 8:35
0

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.

0

I had similar issie, but root cause was completely different then other answers.

In my case it turn out that problem was configuration of the image. If you select VM image check its settings then you can see this:

enter image description here

Now if you hover mouse over warring triangle you will get hint that some configuration setting is invalid. As you can see above I had some network adapter miss configured.

0

Solved with MacOS Monterey 12.6.2 + Latest VirtualBox 7.0 I first uninstalled using official virtualbox uninstall tool then re-installed and everything was working fine..

Not the answer you're looking for? Browse other questions tagged or ask your own question.