After last Ubuntu 16.04 kernel update (4.13.0-26), Virtual Box stopped working correctly. When starting a virtual machine, the host stops completely. Here are the steps to solve it.
- Remove any previous virtualbox installation (VM's are kept):
sudo apt-get remove virtualbox virtualbox-5.1
- Remove virtualbox-dkms:
sudo apt-get remove virtualbox-dkms
- Add the Oracle repository
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian xenial contrib" >> /etc/apt/sources.list.d/virtualbox.list'
- Setup the keyring so to trust the updates from the repository:
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
- Install VBox 5.2 from Ubuntu Software Tool
sudo apt-get update
sudo apt-get install virtualbox-5.2
- Finally, run this command to update kernel modules
sudo /sbin/vboxconfig