Failed to open a session for the virtual machine win-7

Ubuntu 16.04.1 is showing this error while running virtual machine:

Failed to open a session for the virtual machine win-7. The virtual
machine 'win-7' has terminated unexpectedly during startup with exit
code 1 (0x1).

Result Code:  NS_ERROR_FAILURE (0x80004005) Component:  MachineWrap
Interface:  IMachine {f30138d4-e5ea-4b3a-8858-a059de4c93fd}

Solution 1:

Shutdown all your VM's.

  1. Go to your /home/$user/.VirtualBox/ folder
  2. Find the file VirtualBox.xml-prev
  3. mv VirtualBox.xml VirtualBox.xml.bak
  4. mv VirtualBox.xml-prev VirtualBox.xml

If this fails, you can reverse it with rm VirtualBox.xml && mv VirtualBox.xml.bak VirtualBox.xml

Try restarting VirtualBox

Other possible fixes:

  • sudo /etc/init.d/vboxdrv setup

or

  • sudo dpkg-reconfigure virtualbox-dkms