17 May 2013

419. Talking to Myself in Public: DKMS, your own kernel and Virtualbox

Brief version:
check your /lib/modules/KERNEL/build symmlinks if you compile your own kernel.

Original post:
A while back I installed the Oracle-packaged version Virtualbox 4.2 on my system since I had issues with the debian version when going above kernel 3.6 (http://verahill.blogspot.com.au/search?q=kernel+virtualbox)

It's been a bit annoying since I've had to run
sudo service vboxdrv setup

manually every time I upgrade the kernel, but it's not that much hassle. However, I've been seeing error messages such as

Error! Could not locate dkms.conf file. File: does not exist.

In addition, I've just upgraded the kernel from 3.8.8-ck1 to 3.9.2-ck1, but not rebooted, so there's no vboxdrv module for the running kernel at the moment. Both kernels were compiled on the machine they were running on.
Anyway, typically I should be able to solve that by doing
sudo dkms autoinstall -k 3.8.8-ck1

but again I get the above error about no dksm.conf file.

Troubleshooting:

The debian version
virtualbox-dkms belongs to the debian version and isn't needed for the oracle version -- installing it removes the Oracle version. Anyway, to remind myself of why I wasn't using the debian version (4.1.18-dfsg-2+deb7u1)) in Wheezy I did
sudo apt-get install virtualbox-dkms

which remove the oracle version and installed the debian one.
Building initial module for 3.9.2-ck1 Error! Bad return status for module build on kernel: 3.9.2-ck1 (x86_64) Consult /var/lib/dkms/virtualbox/4.1.18/build/make.log for more information. dpkg: error processing virtualbox-dkms (--configure): subprocess installed post-installation script returned error exit status 10
dmesg shows
[704511.419271] vboxdrv: disagrees about version of symbol module_layout
OK. False starts.

I then purged virtualbox and reinstalled the debian version:
sudo apt-get purge virtualbox
sudo apt-get install virtualbox-dkms

Same problem.
Looking at https://bbs.archlinux.org/viewtopic.php?id=151965
for i in /var/lib/dkms/*/[^k]*/source; do [ -e "$i" ] || echo "$i";done
/var/lib/dkms/vboxhost/4.1.10/source /var/lib/dkms/vboxhost/4.2.8/source
sudo rm /var/lib/dkms/vboxhost/4.1.10/source sudo rm /var/lib/dkms/vboxhost/4.2.8/source

sudo apt-get install virtualbox-dkms
Error! Bad return status for module build on kernel: 3.9.2-ck1 (x86_64) Consult /var/lib/dkms/virtualbox/4.1.18/build/make.log for more information. dpkg: error processing virtualbox-dkms (--configure):

sudo less /var/lib/dkms/virtualbox/4.1.18/build/make.log
CC [M] /var/lib/dkms/virtualbox/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.o /var/lib/dkms/virtualbox/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.c: In function ‘rtR0MemObjNativeMapUser’: /var/lib/dkms/virtualbox/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.c:1451:38: error: ‘VM_RESERVED’ undeclared (first use in this function) /var/lib/dkms/virtualbox/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.c:1451:38: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [/var/lib/dkms/virtualbox/4.1.18/build/vboxdrv/r0drv/linux/memobj-r0drv-linux.o] Error 1 make[1]: *** [/var/lib/dkms/virtualbox/4.1.18/build/vboxdrv] Error 2 make: *** [_module_/var/lib/dkms/virtualbox/4.1.18/build] Error 2 make: Leaving directory `/home/me/tmp/linux-3.9.2'

The issues is known
http://siduction.org/index.php?name=PNphpBB2&file=viewtopic&t=3097
http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1086030.html
http://forums.linuxmint.com/viewtopic.php?f=47&t=52496

The oracle version
I gave up and downloaded the newest oracle version again:
wget http://download.virtualbox.org/virtualbox/4.2.12/virtualbox-4.2_4.2.12-84980~Debian~wheezy_amd64.deb
sudo dpkg -i virtualbox-4.2_4.2.12-84980~Debian~wheezy_amd64.deb
Trying to register the VirtualBox kernel modules using DKMS:Error! Your kernel headers for kernel 3.8.8-ck1 cannot be found. Please install the linux-headers-3.8.8-ck1 package, or use the --kernelsourcedir option to tell DKMS where it's located Failed, trying without DKMS ... failed! Recompiling VirtualBox kernel modules:. Starting VirtualBox kernel modules: modprobe vboxdrv failed. Please use 'dmesg' to find out why ... failed!

That last 'failed' is actually ok -- I think it built, but only for 3.9.2-ck1 while the running kernel is 3.8.8-ck1.

So, good enough to use, but not good enough for a blog post, since we're back to square one.
Hmm...
ls /lib/modules/3.8.8-ck1/build -lah
/lib/modules/3.8.8-ck1/build -> /home/me/tmp/ck-kernel/linux-3.8.8

Sure, that where I built it, but it should be pointing at /usr/src/linux-headers-3.8.8-ck1
sudo rm /lib/modules/3.8.8-ck1/build
sudo ln -s /usr/src/linux-headers-3.8.8-ck1/ /lib/modules/3.8.8-ck1/build

I then did the whole purge/install dance again:
sudo apt-get purge virtualbox-4.2
sudo dpkg -i virtualbox-4.2_4.2.12-84980~Debian~wheezy_amd64.deb
Trying to register the VirtualBox kernel modules using DKMS:. Starting VirtualBox kernel modules:.
dkms status
nvidia, 304.88, 3.8.0, x86_64: installed nvidia, 304.88, 3.8.8-ck1, x86_64: installed nvidia, 304.88, 3.8.8, x86_64: installed nvidia, 304.88, 3.9.2-ck1, x86_64: installed vboxhost, 4.2.12, 3.8.8-ck1, x86_64: installed
sudo rm /lib/modules/3.9.2-ck1/build sudo ln -s /usr/src/linux-headers-3.9.2-ck1/ /lib/modules/3.9.2-ck1/build sudo dkms autoinstall -k 3.9.2-ck1 dkms status
nvidia, 304.88, 3.8.0, x86_64: installed nvidia, 304.88, 3.8.8-ck1, x86_64: installed nvidia, 304.88, 3.8.8, x86_64: installed nvidia, 304.88, 3.9.2-ck1, x86_64: installed vboxhost, 4.2.12, 3.8.8-ck1, x86_64: installed vboxhost, 4.2.12, 3.9.2-ck1, x86_64: installed
Happy again. And no dkms.conf errors anymore!

No comments:

Post a Comment