Virtualbox upgrade error "Breaks existing package..."

Solution 1:

In order to be able to upgrade Virtual Box to a higher major release (e.g. 4.2.x to 4.3.x) we will have to remove the kernel modules and applications of an old version first. This will not affect our virtual machines.

In case you had installed from the Oracle repository you can - after having updated the apt cache - just run the following commands:

sudo apt-get purge virtualbox-4.2
sudo apt-get install virtualbox-4.3

After upgrading we will also have to download and re-install the extension packs in case we need them. Also it is advisable to update the guest additions in our virtual machines.

Solution 2:

This issue is also resolved for VirtualBox-5.0 to Virtualbox-5.1

sudo apt-get purge virtualbox-5.0

Then download the virtualbox-5.1 with your Ubuntu version and bit level

Right-click on the file and install via Ubuntu Software Center.

Don't forget to get the extension packs @ www.virtualbox.org/wiki/Downloads Install them via Virtualbox under File/Preferences then Extensions tab on the left.

Every virtual machine will then come back!

Solution 3:

Try to remove and then install it with

sudo apt-get purge virtualbox-*

if there wasn't a package to remove then try to install it:

sudo apt install virtualbox-5.1.8

if there wasn't a package then try to add it by using a PPA:

echo 'deb http://download.virtualbox.org/virtualbox/debian xenial contrib' | sudo tee -a /etc/apt/sources.list

According to your distribution, replace xenial with trusty, precise, etc. You can add these keys with

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -

To install VirtualBox, do

sudo apt-get update && sudo apt-get install virtualbox-5.1

Source