How recompile VirtualBox for my kernel version?

VirtualBox failed with the message that it needs to be recompiled for my kernel version. How would I do this? Where do i get the headers/etc needed to do this? (When I look in YAST, I don’t see kernel-headers or kernel-devel)

My kernel version: Linux i686

install kernel source

run as root on console: /etc/init.d/vboxdrv setup


I did that and now I can’t run virtual box! I keep getting permission denied errors!

I figured it out. had to run:
sudo chmod +x /usr/lib/virtualbox/VirtualBox

Also you have to be in vboxdrv group.

Oddly enough, no. I checked because I thought that was the error but nope. I’m not a member of that group, in fact that group was never created and yet everything works.


I can’t make the module. I have done a make oldconfig and make prepare

I get

ginger2:/usr/src/linux- make oldconfig
scripts/kconfig/conf -o arch/x86/Kconfig

configuration written to .config

ginger2:/usr/src/linux- # make prepare
scripts/kconfig/conf -s arch/x86/Kconfig
CHK include/linux/version.h
CHK include/linux/utsrelease.h
SYMLINK include/asm -> arch/x86/include/asm
CALL scripts/

But /etc/init.d/vboxdrv setup
gives me

Stopping VirtualBox kernel module done
Recompiling VirtualBox kernel module failed
(Look at /var/log/vbox-install.log to find out what went wrong)

And the log file mentioned contains:

Makefile:150: Warning: using /usr/src/linux as the source directory of your Linux kernel. If this is not correct, specify KERN_DIR=<directory> and run Make again.
make KBUILD_VERBOSE=1 -C /usr/src/linux SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 modules
test -e include/linux/autoconf.h -a -e include/config/auto.conf || (
echo " ERROR: Kernel configuration is invalid.";
echo " include/linux/autoconf.h or include/config/auto.conf are missing.";
echo " Run ‘make oldconfig && make prepare’ on kernel src to fix it.";
mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*

WARNING: Symbol version dump /usr/src/linux-
is missing; modules will have no dependencies and modversions.

make -f scripts/ obj=/tmp/vbox.0
gcc -Wp,-MD,/tmp/vbox.0/linux/.SUPDrv-linux.o.d -nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/4.4/include -Iinclude -I/usr/src/linux- -include include/linux/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -fstack-protector -fstack-protector-all -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Wframe-larger-than=2048 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fasynchronous-unwind-tables -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -I/usr/src/linux/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(SUPDrv_linux)" -D"KBUILD_MODNAME=KBUILD_STR(vboxdrv)" -D"DEBUG_HASH=27" -D"DEBUG_HASH2=27" -c -o /tmp/vbox.0/linux/.tmp_SUPDrv-linux.o /tmp/vbox.0/linux/SUPDrv-linux.c
/bin/sh: scripts/genksyms/genksyms: No such file or directory
make[2]: *** [/tmp/vbox.0/linux/SUPDrv-linux.o] Error 1
make[1]: *** [module/tmp/vbox.0] Error 2
make: *** [vboxdrv] Error 2

Any ideas anyone?

cp -f /boot/config-$(uname -r) /usr/src/linux/.config
cd /usr/src/linux
make prepare
make modules_prepare

I also had to install kernel-desktop-devel. Now it works.

Thanks microchip8

This link is helpful as well.

virtualbox for openSUSE 11.2 (View topic) •


This worked perfect! Thank you!

One item I also ran into was that OpenSuse was booting into PAE kernel thus failing to compile the VirtualBox modules. I rebooted into the “default” kernel and it works fine.