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 virtualboxfollowing a suggestion, used the command
sudo apt-get remove virtualbox
apt-get autoremovewhich 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?
13 Answers
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:
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 onVirtualBox.xml, and choose Revert to previous version... more detailsRestore 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
- Ensure VirtualBox Manager is not running.
- Navigate to
~/.config/VirtualBox/ - Rename
~/.config/VirtualBox/VirtualBox.xmlto something like~/.config/VirtualBox/VirtualBox.xml-original - Rename the backup
~/.config/VirtualBox/VirtualBox.xml-prevto~/.config/VirtualBox/VirtualBox.xml - Start VirtualBox Manager. This is a copy of the state of the last VirtualBox Manager startup, and hopefully resolves your situation.
Remove the file. Always Backup first, including
VirtualBox VMs. This is a last resort.Steps to remove the file
- Backup
- Navigate to
~/.config/VirtualBox/ - Delete/rename the
VirtualBox.xmlfile. - 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.vboxfiles and{snapshot}.vdifiles stored by default in the~/VirtualBox VMsfolder. 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$HOMEenvironment 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.
- To past a path in the location bar of
- Before upgrading: It is prudent to
shutdowneach virtual machine (in lieu of asuspended\snapshotstate). - Before upgrading: It is also important to
eject/unmountanyVBoxGuestAdditions.isoin CD drive. Then, new version can be inserted and installed after upgrade.
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.
1All 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