Compiling a new kernel module for VirtualBox

I had installed VirtualBox a while ago on my laptop running my Slackware64 test environment, so I could experiment with the program a bit. Then I forgot all about it.

Today, I upgraded to the latest set of slackware64-current packages, including the new kernel and when I rebooted to that new kernel, I saw an error message scrolling by stating that “the vboxdrv kernel modules failed to load”. Of course… a new kernel needs all external modules to be recompiled.

When installing VirtualBox, I had already noticed that the installer is Slackware friendly; it installed a nice “/etc/rc.d/rc.vboxdrv” boot script and updated the “rc.local” script so that it runs “rc.vboxdrv” on boot. Well done!

It is easy to rebuild the missing VirtualBox kernel modules using that rc script: you just need to run it once with the “setup” parameter.

root@alienteepee:~# /etc/rc.d/rc.vboxdrv setup
Stopping VirtualBox kernel module ...done.
Recompiling VirtualBox kernel module ...done.
Starting VirtualBox kernel module ...done.

That’s all there is to it!

Cheers, Eric

11 thoughts on “Compiling a new kernel module for VirtualBox

  1. Oh, this is in any case would be broken.
    I thought that everything worked. Maybe someone did it while I was sleeping

  2. Yeah, VirtualBox is not only an excellent piece of software, the developers also provide superb support. A while ago the scripts were written for System V and derivatives. As I didn’t manage to get VBox running smoothly, I posted some question in the newsgroup. Not only did the developers offer a helping hand to get the whole package installed on my computer — they also added support for Slackware to their scripts almost immediately!

    Great product, friendly people, impressive support — that’s about what I think about Innotek. I hope It’s not getting worse now, due to the Oracel#


  3. The current SlackBuild on SBo disables the setup feature of the rc.vboxdrv init script. (the actual virtualbox-ose SlackBuild) The comment in the script says “We don’t want a init script building kernel modules”. Since you posted this I am assuming it’s safe to enable this feature, or is there a reason it is disabled by default that we should be aware of?

  4. Hi Frank,
    This is the policy for scripts that are hosted there – they should be foolproof.
    But there is nothing against changing the scripts (like rc.vboxdrv) if you are an experienced Slacker. After all, the command “rc.vboxdrv setup” is never going to be executed on boot. You, the admin, are expected to run it. To me it is only beneficial that the script has this ability.


  5. Doesn’t work with VB 3.2.4 on my Slack13.1 box :[

    it tells me to look at dmesg. which tells me
    warning: VirtualBox’ uses 32-bit capabilities (legacy support in use)

  6. Pingback: [SOLVED] VirtualBox Kernel Driver Missing after Update?

  7. Pingback: Virtualbox ???????? | Mark Wallace's Home Page

  8. And 3 years after you posted this, you helped me do the same on Ubuntu 14.04.1 (but the script is located in /etc/init.d) and we’re running 4.3.20 now… Try doing that under Windows! 😉


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.