If you’re using the closed-source version (the non-OSE) of VirtualBox for virtualization, upgrading your Ubuntu version will likely break your VirtualBox installation. This is because VirtualBox uses dkms to automatically pull in and recompile the kernel modules during a kernel upgrade, but when you upgrade your Ubuntu version, the third-party repository is disabled for compatibility.
What you need to do is re-add the repository line for VirtualBox in Synaptic. This is very easy. It’s important to understand that none of the steps listed here will harm your existing VMs — those files are located in ~/.virtualbox for older installs, and “~/VirtualBox VMs” (and the equivalent on Windows machines) in newer installs. You may want to consider backing those files up somewhere else before starting.
Assuming that your Ubuntu upgrade is already complete, you need to know the nickname for your Ubuntu version. This is easily found at System > About Ubuntu.
Once you’ve found that, simply re-add the correct repository line using the following steps:
Step 1 – Find your version
Go to the VirtualBox download page and find the repository line for your version of Ubuntu.
Although VirtualBox development is kept close to the Ubuntu release schedule, new repository lines may not be immediately available after a new Ubuntu release is launched. Simply check back to that page until they have posted the new repository.
Step 2 – Install dkms
This may be required for other programs, but you will want to make sure dkms is installed to keep the VirtualBox modules up to date after installation. Install dkms using your favorite package manager or enter the following command at a terminal:
sudo apt-get install dkms
(I noticed that VirtualBox 4 installs dkms as a dependency — previous versions may as well. It’s always best to play it safe.)
Step 3 – Enter the repository information in Synaptic Package Manager
Open Synaptic and follow the following menu trees to add the new repository line.
system > administration > synaptic package manager
settings > repositories
Click other software tab
Click add button
Paste your repository line that matches your version, found at the VirtualBox website, here.
Close and click reload.
Step 4 – Install VirtualBox
Now, install the virtualbox-4.0 (or the current version) using your favorite package manager, or enter this at a terminal:
sudo apt-get install virtualbox-4.0
If you experience issues with message related to no key, no signature, or bad signature, refer to the VirtualBox Linux Downloads page for information on resolving that. The messages are generally safe to ignore, though more cautious users may want to install the signing key to make sure the downloads have the correct digital signature.
Questions, comments, and feedback are welcome and appreciated.