Tuesday, September 22, 2015

Oracle VirtualBox on Debian Wheezy Installation Fail and Solution

Upon attempting to install Oracle VirtualBox on a Debian GNU/Linux system, you might run into a colorful error:

[FAIL] Starting VirtualBox kernel modules[....] No suitable module for running kernel found ... failed!

After a bit of searching I found a sort of solution to my problem which was:

      Install "module-assistant" and install VirtualBox from the "backports" repository.

While this is an official resource, it might not be the ideal solution to use a backport, which I'll come back to below with a "Second solution."  In this case I am using Debian 7 "wheezy," and the backport would be from "jessie" or "stretch."

First solution:

Run these commands to get the Module Assistant program ready:

apt-get install module-assistant

m-a prepare

I believe it was actually unnecessary to install headers with the following command, but I've included it just in case it's helpful in other situations:

apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]-,,')

Then to add the backports repositories to sources.list we could use a command like

nano /etc/apt/souces.list

and add the following text:

# backported
deb http://http.debian.net/debian/ wheezy-backports main contrib

Next it's time to try installing the VirtualBox package again, with:

apt-get -t wheezy-backports install virtualbox

This worked well, despite the FAIL message being displayed again just before it installed the correct kernel modules and finished successfully.  That's when I realized it was still using an older version: VirtualBox 4.3.18 instead of 5.0.2 which was the latest.

Later I realized that you can just go to the VirtualBox website and find their latest version in a neat Debian package, so I removed VirtualBox with apt-get and removed the backports part of sources.list

Second Solution:

Details were found at:

 https://www.virtualbox.org/wiki/Linux_Downloads

In addition to having the dkms package installed, installing VirtualBox in this way requires adding a line to sources.list for installing directly from Oracle, such as:

#Oracle VirtualBox
deb http://download.virtualbox.org/virtualbox/debian wheezy contrib

It also requires installing key for apt-secure, as described on their page, like so:

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

Even after all that, in my case there was still a warning about the source being unverifiable but then it was easy to install virtualbox 5 (actually 5.0.2, at the time) with the simple commands:

apt-get update
apt-get install VirtualBox-5.0

And it was a breeze, worked like a charm.

Compared to using a backport of an older version of VirtualBox, this method may be preferable.

It's probably safe to assume that this has been a problem for more people than just you and I, and recently I'd noticed that there is actually an entire distribution based primarily on the combination of VirtualBox and Debian.  It's called Robolinux.

I wish I'd recorded links to the other sites that were helpful to me with this so I could credit them here, but this should be enough information to get around the error message or to get the application installed, anyway.


No comments:

Post a Comment