4

I did upgrade VirtualBox from 4.1 to 4.2

wheneverver I want to load my Win XP VDI, it gives me the following error:

Kernel driver not installed (rc=-1908)

The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing

/etc/init.d/vboxdrv setup

as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.

I ran the suggested step to reinstall the kernel module, and the log file is as follow:

Makefile:181: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Stop.
Makefile:181: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Stop.
Makefile:181: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Stop.

I still unable to re-run my win virtual XP vdi file.

Anyone have any clue?

2 Answers 2

10

Looks like you don't have the kernel headers installed, dkms needs then to install the Virtual Box kernel drive, to install then run:

sudo apt-get install linux-headers-`uname -r`

Afterwards,

/etc/init.d/vboxdrv setup

should work.

7
  • Hey it works man! I did exactly according your suggestion. why the error doesn't say anything about kernel header? just curious.
    – Husni
    Nov 17, 2012 at 17:20
  • It does. You have highlighted it in bolt in your question ;). Nov 19, 2012 at 10:22
  • Came here with the same issues as the OP. It was the 'uname -r' advice that you left that made me check the version of the Kernel headers I had installed. They were not the same version as the Kernel I'm running. Thanks.
    – csilk
    Dec 7, 2012 at 18:59
  • This allows /etc/init.d/vboxdrv setup to run; however, it fails with the error Failed to install using DKMS, attempting to install without Makefile:181: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop. This can hardly be considered successful...
    – weberc2
    Feb 2, 2013 at 21:09
  • @weberc2: Did you run the first command?. Feb 3, 2013 at 16:43
0

The same may happen in VirtualBox 5. The vboxdrv script is now called vboxadd (I guess) and the logic is as follow:

KERN_VER=`uname -r`
KERN_DIR="/lib/modules/$KERN_VER/build"
if [ -d "$KERN_DIR" ]; then
    KERN_REL=`make -sC $KERN_DIR --no-print-directory kernelrelease 2>/dev/null || true`
    if [ -z "$KERN_REL" -o "x$KERN_REL" = "x$KERN_VER" ]; then
        return 0
    fi
fi

So basically you need to make sure that you have installed VBoxGuestAdditions and the kernel sources exists in /lib/modules/$(uname -r)/build. If they don't match, the command will fail.

Here is a simple test:

$ sudo sh -x /opt/VBoxGuestAdditions-5.0.16/init/vboxadd setup 2>&1 | grep KERN
+ KERN_VER=2.6.32-573.18.1.el6.x86_64
+ KERN_DIR=/lib/modules/2.6.32-573.18.1.el6.x86_64/build

So make sure you install all the dependencies, e.g.

sudo apt-get -y install dkms build-essential linux-headers-$(uname -r) virtualbox-guest-additions-iso

Then make sure that /lib/modules/$(uname -r)/build points to /usr/src/kernels/$(uname -r).

And double check that these two commands are matching:

$ sudo make -sC /usr/src/kernels/$(uname -r) kernelrelease
2.6.32-642.1.1.el6.x86_64
$ uname -r
2.6.32-642.1.1.el6.x86_64

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .