virtualbox-dkms: fix alloc_netdev problems when compiling with 3.17.0-rcX headers
Intro
Because of my bug hunting approach of using latest kernel I experienced problem
with compiling VirtualBox modules with 3.17.0-rc5 version on my Debian Jessie.
Issue is well known and described for examples
here.
Problem manifest itself with:
1
2
3
4
5
6
7
8
9
10
11
12
------------------------------
Deleting module version: 4.3.14
completely from the DKMS tree.
------------------------------
Done.
Loading new virtualbox-4.3.14 DKMS files...
Building only for 3.17.0-rc5+
Building initial module for 3.17.0-rc5+
Error! Bad return status for module build on kernel: 3.17.0-rc5+ (x86_64)
Consult /var/lib/dkms/virtualbox/4.3.14/build/make.log for more information.
Job for virtualbox.service failed. See 'systemctl status virtualbox.service' and 'journalctl -xn'for details.
invoke-rc.d: initscript virtualbox, action "restart" failed.
during virtualbox-dkms package installation or reconfiguration. In make.log
you will find compilation error:
CC [M] /var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.o
/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c: In function ‘vboxNetAdpOsCreate’:
/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c:186:48: error: macro "alloc_netdev" requires 4 arguments, but only 3 given
vboxNetAdpNetDevInit);
^
/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c:184:15: error: ‘alloc_netdev’ undeclared (first use in this function)pNetDev= alloc_netdev(sizeof(VBOXNETADPPRIV),
^
/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c:184:15: note: each undeclared identifier is reported only once for each function it appears in
/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c: At top level:
/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.c:159:13: warning: ‘vboxNetAdpNetDevInit’ defined but not used [-Wunused-function]
static void vboxNetAdpNetDevInit(struct net_device *pNetDev)
^
scripts/Makefile.build:257: recipe for target '/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.o' failed
make[2]: *** [/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp/linux/VBoxNetAdp-linux.o] Error 1
scripts/Makefile.build:404: recipe for target '/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp' failed
make[1]: *** [/var/lib/dkms/virtualbox/4.3.14/build/vboxnetadp] Error 2
Makefile:1373: recipe for target '_module_/var/lib/dkms/virtualbox/4.3.14/build' failed
make: *** [_module_/var/lib/dkms/virtualbox/4.3.14/build] Error 2
make: Leaving directory '/usr/src/linux-headers-3.17.0-rc5+'
For sure we have to wait for some time before new version of kernel and
VirtualBox will catch up each other in Debian.
Fix source code of Debian package
Let’s get get virtualbox package source, fix issues rebuild package and install
in the system. Patch to apply can be found
here.
1
2
apt-get source virtualbox-dkms
cd virtualbox-4.3.14-dfsg
sudo dpkg -i ../virtualbox-dkms_4.3.14-dfsg-1_all.deb
(Reading database ... 432638 files and directories currently installed.)
Preparing to unpack .../virtualbox-dkms_4.3.14-dfsg-1_all.deb ...
------------------------------
Deleting module version: 4.3.14
completely from the DKMS tree.
------------------------------
Done.
Unpacking virtualbox-dkms (4.3.14-dfsg-1) over (4.3.14-dfsg-1) ...
Setting up virtualbox-dkms (4.3.14-dfsg-1) ...
Loading new virtualbox-4.3.14 DKMS files...
Building only for 3.17.0-rc5+
Building initial module for 3.17.0-rc5+
Done.
vboxdrv:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/3.17.0-rc5+/updates/dkms/
vboxnetadp.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/3.17.0-rc5+/updates/dkms/
vboxnetflt.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/3.17.0-rc5+/updates/dkms/
vboxpci.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/3.17.0-rc5+/updates/dkms/
sed: -e expression #1, char 6: unknown command: `m'
depmod....
DKMS: install completed.`
And we can happily use VirtualBox with 3.17.0-rc5 kernel.
Founder of 3mdeb, a passionate advocate for open-source firmware solutions, driven by a belief in transparency, innovation, and trustworthiness. Every day is a new opportunity to embody the company's vision, emphasizing user liberty, simplicity, and privacy. Beyond business, a casual chess and bridge player, finding peace in nature and nourishment in theology, philosophy, and psychology. A person striving to foster a healthy community, grounded in collaboration and shared growth, while nurturing a lifelong curiosity and a desire to deeply understand the world.