I recently got stuck while trying to install Headless Virtualbox on a Centos 5.2 server per the directions at Howtoforge here. The RPM failed with the error that it couldn’t find the kernel source. I thought I had already installed kernel-devel, and confirmed that I did. The instructions were to define the KERN_DIR variable like so:

$ export KERN_DIR=/usr/src/kernels/2.6.18-92.1.22.el5-i686/
$ /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel module [  OK  ]
Removing old VirtualBox netflt kernel module [  OK  ]
Removing old VirtualBox kernel module [  OK  ]
Recompiling VirtualBox kernel module [  OK  ]
Starting VirtualBox kernel module [FAILED]
(modprobe vboxdrv failed. Please use 'dmesg' to find out why)

dmesg shows this:

vboxdrv: disagrees about version of symbol struct_module

Interesting!

After several missteps, it turns out there is a separate development rpm for the PAE kernel:

$ yum install kernel-PAE-devel

After that installs, we are good:

$ export KERN_DIR=/usr/src/kernels/2.6.18-92.1.22.el5-PAE-i686/
$ /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel module [  OK  ]
Removing old VirtualBox netflt kernel module [  OK  ]
Removing old VirtualBox kernel module [  OK  ]
Recompiling VirtualBox kernel module [  OK  ]
Starting VirtualBox kernel module [  OK  ]

Golden.

13 comments
  1. Pingback: Dave Drager
  2. I tried to install VirtualBox on a Xen Kernel. After about 7 hours of banging my head and searching for the correct headers, dealing with build errors etc I gave up! (very unlike me). It just wasnt worth the hassle. I am now working on a PAE kernel, lets hope its more straightforward!

  3. I tried to install VirtualBox on a Xen Kernel. After about 7 hours of banging my head and searching for the correct headers, dealing with build errors etc I gave up! (very unlike me). It just wasnt worth the hassle. I am now working on a PAE kernel, lets hope its more straightforward!

  4. That’s because you must have installed kernel-devel instead of kernel-xen-devel. This will compile the module. But when you try to load the module, it will reboot the system and then you wont be able to boot it unless you boot in single user mode and then disable the vboxdrv init script.

    Xen and VirtualBox are incompatible (at least at the time of writing this). Someone filed bug with virtualbox but that was closed with the status as “wont fix”. So I guess you will need some other kernel and not xen.

  5. That’s because you must have installed kernel-devel instead of kernel-xen-devel. This will compile the module. But when you try to load the module, it will reboot the system and then you wont be able to boot it unless you boot in single user mode and then disable the vboxdrv init script.

    Xen and VirtualBox are incompatible (at least at the time of writing this). Someone filed bug with virtualbox but that was closed with the status as “wont fix”. So I guess you will need some other kernel and not xen.

  6. I tried with this, but it still won’t solve my problem.
    I do just follow the advice, and get a problem as this link is not available:
    /lib/modules/build -> ../../../usr/src/kernels/2.6.35.6-48.fc14.i686.PAE

    Then I find that the kernel source file and kernel module don’t match each other:
    $ ll /usr/src/kernels/; ll /lib/modules/; ll /lib/modules/2.6.35.6-48.fc14.i686.PAE/ |grep build
    total 16
    drwxr-xr-x. 22 root root 4096 Nov 19 14:58 2.6.35.6-45.fc14.i686
    drwxr-xr-x. 22 root root 4096 Nov 15 00:04 2.6.35.6-48.fc14.i686
    drwxr-xr-x. 22 root root 4096 Dec 8 17:08 2.6.35.9-64.fc14.i686
    drwxr-xr-x. 22 root root 4096 Dec 8 15:19 2.6.35.9-64.fc14.i686.PAE
    total 12
    drwxr-xr-x. 7 root root 4096 Dec 8 16:50 2.6.35.6-45.fc14.i686
    drwxr-xr-x. 6 root root 4096 Dec 8 16:50 2.6.35.6-48.fc14.i686
    drwxr-xr-x. 6 root root 4096 Nov 27 23:38 2.6.35.6-48.fc14.i686.PAE
    lrwxrwxrwx. 1 root root 50 Nov 27 23:17 build -> ../../../usr/src/kernels/2.6.35.6-48.fc14.i686.PAE
    lrwxrwxrwx. 1 root root 5 Nov 27 23:17 source -> build

    $ rpm -q kernel-PAE-devel
    kernel-PAE-devel-2.6.35.9-64.fc14.i686
    $ uname -r
    2.6.35.6-48.fc14.i686.PAE

    How can that be?
    Since there’s only one PAE for src and one for module, I simply make link as build -> ../../../usr/src/kernels/2.6.35.9-64.fc14.i686.PAE

    then fail as:
    Starting VirtualBox kernel modules [FAILED]
    (modprobe vboxdrv failed. Please use ‘dmesg’ to find out why)
    dmesg shows:
    [ 1544.584690] vboxdrv: version magic ‘2.6.35.9-64.fc14.i686.PAE SMP mod_unload 686 ‘ should be ‘2.6.35.6-48.fc14.i686.PAE SMP mod_unload 686 ‘

    Now I get stuck. anybody know what’s next?

Comments are closed.

You May Also Like

Simple Guide To Signing RPMs with FPM

I’ve been using the excellent fpm (Effing package manager!) tool for automatically…

SSH – Unspecified GSS failure

Recently came across a problem with one system authentication to another via…

Attach files to email via command line

This is a pretty simple thing to do, once you’ve figured it…

Installing And Compiling Zabbix Client / Agent

Zabbix is an excellent system monitoring package. It does everything from basic…