VirtualBox

Ticket #12295 (new defect)

Opened 6 months ago

Last modified 5 months ago

VBoxDrv 4.3.2 does compile on linux 3.11.6

Reported by: basos Owned by:
Priority: major Component: other
Version: VirtualBox 4.3.2 Keywords: linux 3.11.6, vboxdrv
Cc: Guest type: other
Host type: Linux

Description

The compilation of vboxdrv with the command /etc/init.d/vboxdrv setup fails on linux debian jessie, kernel 3.11.6.

Last lines shown here, full log attached

/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c: In function ‘rtR0MemObjLinuxDoMmap’:
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:216:9: error: implicit declaration of function ‘do_mmap’ [-Werror=implicit-function-declaration]
         ulAddr = do_mmap(NULL, R3PtrFixed, cb, fLnxProt, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, 0);
         ^
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c: In function ‘rtR0MemObjNativeMapUser’:
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:1465:38: error: ‘VM_RESERVED’ undeclared (first use in this function)
                     vma->vm_flags |= VM_RESERVED;
                                      ^
/tmp/vbox.0/r0drv/linux/memobj-r0drv-linux.c:1465:38: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors

Attachments

vbox-install.log Download (26.4 KB) - added by basos 6 months ago.
Vboxdrv compile log
tmp_memobj-r0drv-linux.i.gz Download (467.6 KB) - added by basos 5 months ago.
do_dkms.patch Download (673 bytes) - added by basos 5 months ago.
Fix do_dkms script-compile when dkms module has already been added

Change History

Changed 6 months ago by basos

Vboxdrv compile log

comment:1 Changed 6 months ago by frank

Which kernel packages do you have installed and where did you get them from? Current Debian/unstable does not ship kernel packages with 3.11.6 kernels AFAICS.

comment:2 Changed 6 months ago by basos

Yes, indeed. This is the latest released stable kernel (not included in Debian). In my case it is a custom build, with sources obtained from the tuxonice repository.

comment:3 Changed 6 months ago by frank

Then I would suggest to check these packages. The way we compile the VBox kernel modules is the normal way to compile 3rd-party modules. And it works for all kind of modules. The error comes from a wrong kernel version. The header file <linux/version.h> is included from the-linux-kernel.h and should define LINUX_VERSION_CODE and KERNEL_VERSION. It looks like LINUX_VERSION_CODE is wrongly defined in your packages.

comment:4 Changed 5 months ago by basos

$ cat /usr/src/linux-headers-3.11.6+toi-3.3-1-amd64/include/linux/version.h 
#define LINUX_VERSION_CODE 197636
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

I can not see how version.h contents should be wrong as this is the vanilla kernel with the well known TuxOnIce patches applied.

Based on the error messages above I would say that some internals of kernel ABI have changed and prevent the module from being compiled (Undefined symbols, functions)

I am compiling the vboxdrv module via the standard /etc/init.d.vboxdrv setup which uses the dkms facility to build the modules.

comment:5 Changed 5 months ago by frank

Then could you do the following: Look at your vbox-install.log file. Copy the last command (line 26) and paste it into a terminal window. Make sure that you change to /lib/modules/3.11.6+toi-3.3-1-amd64/build first.

Edit the pasted command line. Replace '-c' by '-E -dD' and the parameter after -o to a the same file name with the suffix .i instead of .o. Then execute the modified command line. Attach the resulting memobj-r0drv-linux.i file to this ticket.

comment:6 Changed 5 months ago by basos

Here it is.

Also, I realized that dkms was skipped, from the second and onwards try, due to a do_dkms script bug. (It fails if the dkms module has already been added) I attach a patch that fixes this also.

Changed 5 months ago by basos

Changed 5 months ago by basos

Fix do_dkms script-compile when dkms module has already been added

comment:7 Changed 5 months ago by frank

That's strange. When do you experience this problem with DKMS, which steps did you perform? Because if you execute /etc/init.d/vboxdrv setup then as first step, all old DKMS modules are uninstalled (do_dkms is always called with 'uninstall' first).

comment:8 Changed 5 months ago by frank

Regarding your compilation problem: Actually LINUX_VERSION_CODE is wrongly set. A LINUX_VERSION_CODE of 197636 stands for Linux 3.4.4 (3*65536 + 4*256 + 4). So I think your Linux headers have some bug.

And this is also the reason why the wrong code is used when compiling memobj-r0drv-linux.c. The correct LINUX_VERSION_CODE for your Linux headers would be 3*65536 + 11*256 + 6 = 199430.

Last edited 5 months ago by frank (previous) (diff)

comment:9 Changed 5 months ago by basos

I see, you were right from the beginning. I will check to find out why the version.h has invalid contents. Actually I managed to successfully compile by manually changing the value at version.h to 199430. Thanks!

As for the dkms issue, it is due to that the command (from inside do_dkms script)

dkms remove -m vboxhost -v 4.3.2 --all

fails with

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

But when I run the above command as root, it succeeds !

# dkms remove -m vboxhost -v 4.3.2 --all

------------------------------
Deleting module version: 4.3.2
completely from the DKMS tree.
------------------------------
Done.

comment:10 Changed 5 months ago by frank

Sorry, I still don't understand why you need the do_dkms patch. If you execute /etc/init.d/vboxdrv setup then the dkms module is first removed and then added. Of course you need to start this script as root.

comment:11 Changed 5 months ago by basos

Hi, if I execute (as root) the /etc/init.d/vboxdrv setup (the original file), I get the following

  Stopping VirtualBox kernel modules ...done.
  Uninstalling old VirtualBox DKMS kernel modulesError! Could not locate dkms.conf file.
  File:  does not exist.
   ...done.
  Removing old VirtualBox pci kernel module ...done.
  Removing old VirtualBox netadp kernel module ...done.
  Removing old VirtualBox netflt kernel module ...done.
  Removing old VirtualBox kernel module ...done.
  Trying to register the VirtualBox kernel modules using DKMSError! DKMS tree already contains: vboxhost-4.3.2
  You cannot add the same module/version combo more than once.
   ...failed!
    (Failed, trying without DKMS) 
   ...

Notice that the unistallation fails. But I can manually execute

# dkms remove -m vboxhost -v 4.3.2 --all
...
------------------------------
Deleting module version: 4.3.2
completely from the DKMS tree.
------------------------------
Done.
Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use