Upgrade Virtualbox when upgrading Ubuntu

Fix errors about a missing kernel driver wanting to install dkms and run /sbin/vboxconfig, with thi procedure. This error usually happens when going between major or point releases–say Virtualbox 5.0 → 5.1 or 4.3 → 5.1). It can also happen when upgrading the operating system.

Fix

Uninstall old Virtualbox by

apt remove virtualbox

or

dpkg -r virtualbox

Then reinstall new Virtualbox:

gdebi virtualbox*.deb