VirtualBox

11 年 前 建立

8 年 前 結束

#12295 closed defect (obsolete)

VBoxDrv 4.3.2 does compile on linux 3.11.6

回報者: basos 負責人:
元件: other 版本: VirtualBox 4.3.2
關鍵字: linux 3.11.6, vboxdrv 副本:
Guest type: other Host type: Linux

描述

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

附加檔案 (3)

vbox-install.log (26.4 KB ) - 11 年 前, 由 basos 新增
Vboxdrv compile log
tmp_memobj-r0drv-linux.i.gz (467.6 KB ) - 11 年 前, 由 basos 新增
do_dkms.patch (673 位元組 ) - 11 年 前, 由 basos 新增
Fix do_dkms script-compile when dkms module has already been added

下載所有附檔: .zip

更動歷史 (15)

11 年 前basos 編輯

附檔: 新增 vbox-install.log

Vboxdrv compile log

comment:1 11 年 前Frank Mehnert 編輯

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 11 年 前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 11 年 前Frank Mehnert 編輯

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 11 年 前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 11 年 前Frank Mehnert 編輯

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 11 年 前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.

11 年 前basos 編輯

11 年 前basos 編輯

附檔: 新增 do_dkms.patch

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

comment:7 11 年 前Frank Mehnert 編輯

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 11 年 前Frank Mehnert 編輯

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.

最後由 Frank Mehnert 編輯於 11 年 前 (上一筆) (差異)

comment:9 11 年 前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 11 年 前Frank Mehnert 編輯

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 11 年 前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.

comment:12 8 年 前aeichner 編輯

狀態: newclosed
處理結果: obsolete

Please reopen if still relevant with a recent VirtualBox release.

注意: 瀏覽 TracTickets 來幫助您使用待辦事項功能

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette