VirtualBox and Vagrant on Ubuntu 14.04 LTS trusty – Fix for: virtualbox-dkms kernel module failed to build

VirtualBox and Vagrant fail to install on Ubuntu 14.04 LTS. You can fix this by installing them from DEB packages provided by the project.

Fix: Install from Upstream

Remove old Virtualbox and install a new one from the official download page

$ sudo apt-get -y purge virtualbox virtualbox-dkms
$ wget http://download.virtualbox.org/virtualbox/5.0.8/virtualbox-5.0_5.0.8-103449~Ubuntu~trusty_amd64.deb
$ sudo gdebi -n virtualbox-*.deb

New Vagrant is needed for the new version of VirtualBox. Remove the old one, install new one from upstream download page.

$ wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb
$ sudo gdebi -n vagrant*.deb

Recompile Module after Kernel Upgrade

When you upgrade your kernel (package linux-image-*), VirtualBox kernel module (driver) must be recompiled. Luckily, this is just single line

$ sudo /usr/lib/virtualbox/vboxdrv.sh setup

This fixes error messages such as this one from ‘vagrant up’:
“VirtualBox is complaining that the kernel module is not loaded. Please
run `VBoxManage –version` or open the VirtualBox GUI to see the error
message which should contain instructions on how to fix this error. ”

Background

With latest kernel updates, you can no longer install VirtualBox on Ubuntu (Xubuntu) 14.04 LTS. There are many bug reports on this, but no fix on sight. And it’s still half a year until the next long term support release, 16.04 LTS xenial.
When you install VirtualBox directly from upstream source, Oracle, the built in Vagrant from standard repositories no longer works. This means that you’ll also have to install Vagrant from upstream source, HashiCorp.
Downloading packages from web pages and installing them manually means that you don’t get the many benefits of apt-get package manager (security, scalability, convenience…).
After upgrading these two packages manually, VirtualBox and Vagrant work again.
An alternative method for installing the packages would be using personal package archives, PPAs.
VirtualBox and Vagrant are quite important packages, so it’s at least annoying that they are suddenly broken on a long term support release during the support term.

Administrivia

Updated: Added “Recompile Module after Kernel Upgrade”.

Posted in Uncategorized | Tagged , , , , , , , , , , , | Comments Off on VirtualBox and Vagrant on Ubuntu 14.04 LTS trusty – Fix for: virtualbox-dkms kernel module failed to build

Comments are closed.