10

I had VirtualBox 4.3 installed and uninstalled it to have VirtualBox 5.1... big mistake, ever since I keep getting errors, or being unable to install any other version. Already used Synaptic, and

sudo apt-get purge virtualbox

following a suggestion, used the command

sudo apt-get remove virtualbox
apt-get autoremove

which seemed to get rid of some VB dependencies and allowed me to install VB again, but I get this error when I try to start it:

Failed to acquire the VirtualBox COM object. 
The application will now terminate. 
Failed to acquire the VirtualBox COM object. 
The application will now terminate. 
Document is empty.   
Location: '/home/user/.config/VirtualBox/VirtualBox.xml', line 1 (0), column 1.


/home/vbox/vbox-5.1.22/src/VBox/Main/src-server/VirtualBoxImpl.cpp[550]
(nsresult VirtualBox::init()).

Result Code: NS_ERROR_FAILURE (0x80004005) 
Component: VirtualBoxWrap
Interface: IVirtualBox {0169423f-46b4-cde9-91af-1e9d5b6cd945} Callee:
IVirtualBoxClient {d2937a8e-cb8d-4382-90ba-b7da78a74573}

What should I do?

1
  • You must COMPLETELY uninstall ALL of vbox before attempting to install another version. The method of uninstalling depends entirely upon how you originally installed that version - apt/synaptic can remove ONLY packages they installed.
    – user535733
    May 26, 2017 at 4:00

3 Answers 3

15

I encountered this situation after a power loss and reboot of my host system.

Overview

VirtualBox stores its global configuration in ~/.config/VirtualBox/VirtualBox.xml, (if you've upgraded from early versions it may be in ~/.VirtualBox/VirtualBox.xml). The file includes global configuration options and the list of registered virtual machines with pointers to their XML settings files (for each machine under ~/VirtualBox VMs).

Options

To solve a corrupted VirtualBox.xml do one of the following, in order of preference:

  1. Restore a backup. Ubuntu comes with Backups (Déjà Dup) installed by default. If you're using it, you can easily restore the file by navigating to ~/.config/VirtualBox/, right-clicking on VirtualBox.xml, and choose Revert to previous version... more details

  2. Restore a copy. Each time VirtualBox Manager starts up, it creates a backup copy of ~/.config/VirtualBox/VirtualBox.xml (called ~/.config/VirtualBox/VirtualBox.xml-prev). The drawback is this file will/may only be useful if you haven't started VirtualBox Manager.

    Steps to restore a copy

    1. Ensure VirtualBox Manager is not running.
    2. Navigate to ~/.config/VirtualBox/
    3. Rename ~/.config/VirtualBox/VirtualBox.xml to something like ~/.config/VirtualBox/VirtualBox.xml-original
    4. Rename the backup ~/.config/VirtualBox/VirtualBox.xml-prev to ~/.config/VirtualBox/VirtualBox.xml
    5. Start VirtualBox Manager. This is a copy of the state of the last VirtualBox Manager startup, and hopefully resolves your situation.
  3. Remove the file. Always Backup first, including VirtualBox VMs. This is a last resort.

    Steps to remove the file

    1. Backup
    2. Navigate to ~/.config/VirtualBox/
    3. Delete/rename the VirtualBox.xml file.
    4. Start VirtualBox Manager. This will recreate a file during startup.
      The result of removing the file will likely be a loss of some/all of your machines in the list. Any missing machines might be able to be restored by re-registering .vbox files and {snapshot}.vdi files stored by default in the ~/VirtualBox VMs folder. Full details of how to recover this condition are beyond the scope of this question. Always

Notes:

  • The tilde (~) is a shortcut representation for the $HOME environment variable. It can be cut-and-paste into a GUI program like Gnome Files (Nautilus) (which supports freedesktop.org conventions), or in a terminal.
    • To past a path in the location bar of Gnome Files (Nautilus), press CTRL-L. Then type or paste a path.
  • Before upgrading: It is prudent to shutdown each virtual machine (in lieu of a suspended\snapshot state).
  • Before upgrading: It is also important to eject/unmount any VBoxGuestAdditions.iso in CD drive. Then, new version can be inserted and installed after upgrade.
1
  • 1
    Mine /home/myuser/.config/VirtualBox/VirtualBox.xml was completely empty x) , so I've copied contents from /home/myuser/.config/VirtualBox/VirtualBox.xml-prev into it as you've suggested and it worked! :)
    – jave.web
    Jul 31, 2020 at 13:00
8

I faced the similar issue, removing the xml file resolved this for me. So for you please do

rm /home/user/.config/VirtualBox/VirtualBox.xml

and start virtualbox again.

1
  • 2
    I'd suggest moving instead of removing. ;-) Always better practice to have a backup in case things don't go as expected. Try: mv /home/user/.config/VirtualBox/VirtualBox.xml ~/ --> which will move VirtualBox.xml to your $HOME folder. Alternatively, use a GUI File Manager such as Gnome Files (originally Nautilus) to remove to Trash or move somewhere. Sep 4, 2020 at 0:04
0

All of this was very helpful. Thanks very much.

I tried using the "prev" version, which didn't work. Then moved VirtualBox.xml to a backup and started up VirtualBox. That showed a new, empty system with no VMs. I started up each of the VM's by right-clicking and "open with Virtualbox". They started up as before and are now available in the VM list when I open Virtualbox.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .