CentOS 8 Stream - vboxdrv wont build

Discussions related to using VirtualBox on Linux hosts.
max1344
Posts: 2
Joined: 31. Jul 2021, 01:08

CentOS 8 Stream - vboxdrv wont build

Post by max1344 »

I have a machine which has been updated from CentOS 8 to CentOS 8 Stream, I have installed the latest VirtualBox (6.1.26). But I get an error when building the kernelmodule.
/sbin/vboxconfig fails building the file alloc-r0drv-linux.c saying:
error: implicit declaration of function 'map_vm_area'; did you mean 'get_vm_area'
From what I have seen googling the problem it is related to kernel versions 5.8+.
CentOS 8 Stream is runnign 4.18.0-326 (with a lot of backports I guess...)
Any ideas how to solve the problem?
svartalf
Posts: 7
Joined: 31. Mar 2018, 18:32

Re: CentOS 8 Stream - vboxdrv wont build

Post by svartalf »

I have the same issue.
Guest Additions build failed on kernel-4.18.0-326.el8.x86_64
It builds OK on previous kernel 4.18.0-315.el8.x86_64
Mhollow
Posts: 3
Joined: 1. Aug 2021, 09:18

Re: CentOS 8 Stream - vboxdrv wont build

Post by Mhollow »

I confirm the same problem is in my case.
the same version of OS, kernel and VBox
/tmp/vbox.0/r0drv/linux/alloc-r0drv-linux.c: In function ‘rtR0MemAllocExecVmArea’:
/tmp/vbox.0/r0drv/linux/alloc-r0drv-linux.c:204:14: error: implicit declaration of function ‘map_vm_area’; did you mean ‘get_vm_area’? [-Werror=implicit-function-declaration]
if (!map_vm_area(pVmArea, PAGE_KERNEL_EXEC,
^~~~~~~~~~~
get_vm_area
./tools/objtool/objtool orc generate --module --no-fp --retpoline "/tmp/vbox.0/r0drv/linux/.tmp_assert-r0drv-linux.o";
gcc -Wp,-MD,/tmp/vbox.0/r0drv/linux/.mpnotification-r0drv-linux.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include/drm-backport -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -DCC_HAVE_ASM_GOTO -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -DCONFIG_TPAUSE=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wno-unused-const-variable -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -Wno-packed-not-aligned -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV -DIPRT_WITHOUT_EFLAGS_AC_PRESERVING -DVBOX_WITH_64_BITS_GUESTS -DCONFIG_VBOXDRV_AS_MISC -DRT_ARCH_AMD64 -DMODULE -DKBUILD_BASENAME='"mpnotification_r0drv_linux"' -DKBUILD_MODNAME='"vboxdrv"' -c -o /tmp/vbox.0/r0drv/linux/.tmp_mpnotification-r0drv-linux.o /tmp/vbox.0/r0drv/linux/mpnotification-r0drv-linux.c
cc1: some warnings being treated as errors
./tools/objtool/objtool orc generate --module --no-fp --retpoline "/tmp/vbox.0/r0drv/linux/.tmp_initterm-r0drv-linux.o";
make[2]: *** [scripts/Makefile.build:316: /tmp/vbox.0/r0drv/linux/alloc-r0drv-linux.o] Error 1
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: CentOS 8 Stream - vboxdrv wont build

Post by scottgus1 »

Could you all please try a roll-back to 6.1.24 or 6.1.22? Maybe a bug creeped in.
Mhollow
Posts: 3
Joined: 1. Aug 2021, 09:18

Re: CentOS 8 Stream - vboxdrv wont build

Post by Mhollow »

it's rather tricky
I uninstalled 6.1.26 but was not able to install 6.1.24

sudo dnf install VirtualBox-6.1-6.1.24_145767_el6-1.x86_64.rpm
Error:
Problem: conflicting requests
- nothing provides python(abi) = 2.6 needed by VirtualBox-6.1-6.1.24_145767_el6-1.x86_64
- nothing provides libpython2.6.so.1.0()(64bit) needed by VirtualBox-6.1-6.1.24_145767_el6-1.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
max1344
Posts: 2
Joined: 31. Jul 2021, 01:08

Re: CentOS 8 Stream - vboxdrv wont build

Post by max1344 »

I think its related to a backported 5.x feature in the CentOS kernel..
willnix1155
Posts: 1
Joined: 1. Aug 2021, 16:46

Re: CentOS 8 Stream - vboxdrv wont build

Post by willnix1155 »

It seems so... The following dirty workaround makes vbox working again on CentOS Stream:

------
--- /usr/share/virtualbox/src/vboxhost/vboxdrv/r0drv/linux/alloc-r0drv-linux.c.orig 2021-08-01 16:28:12.124816773 +0200
+++ /usr/share/virtualbox/src/vboxhost/vboxdrv/r0drv/linux/alloc-r0drv-linux.c 2021-08-01 16:28:51.783892753 +0200
@@ -38,7 +38,7 @@


#if (defined(RT_ARCH_AMD64) || defined(DOXYGEN_RUNNING)) && !defined(RTMEMALLOC_EXEC_HEAP)
-# if RTLNX_VER_MIN(2,6,23) && RTLNX_VER_MAX(5,8,0)
+# if RTLNX_VER_MIN(2,6,23) && RTLNX_VER_MAX(4,17,0)
/**
* Starting with 2.6.23 we can use __get_vm_area and map_vm_area to allocate
* memory in the moduel range. This is preferrable to the exec heap below.
------
Mhollow
Posts: 3
Joined: 1. Aug 2021, 09:18

Re: CentOS 8 Stream - vboxdrv wont build

Post by Mhollow »

It works.
Thanks a lot
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: CentOS 8 Stream - vboxdrv wont build

Post by scottgus1 »

Thanks for trying the downgrade. The devs may need to know about this backport. Please post this problem and the solution you found on the Bugtracker, so the devs can be made aware of it.

Thanks for the solution!
vtipo
Posts: 2
Joined: 3. Aug 2021, 14:51

Re: CentOS 8 Stream - vboxdrv wont build

Post by vtipo »

dowgrading to 6.1.20 wont help solve the issue :(
Ethan Brown
Posts: 1
Joined: 4. Aug 2021, 23:24

Re: CentOS 8 Stream - vboxdrv wont build

Post by Ethan Brown »

I struggled with this for some time, but was able to get VirtualBox to work by booting into an older kernel (4.18.0-240.el8.x86_64) and installing VirtualBox from the virtualbox repository.
Interestingly, I also have to use this kernel to run VMWare's vmplayer. It doesn't work with the newer kernels.
DustWolf
Posts: 4
Joined: 29. Dec 2011, 17:05
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP, Windows 7

Re: CentOS 8 Stream - vboxdrv wont build

Post by DustWolf »

Here is a direct link to the bug:
https://www.virtualbox.org/ticket/20488

I'll try to fill in some relevant info.
vtipo
Posts: 2
Joined: 3. Aug 2021, 14:51

Re: CentOS 8 Stream - vboxdrv wont build

Post by vtipo »

Ethan Brown wrote:I struggled with this for some time, but was able to get VirtualBox to work by booting into an older kernel (4.18.0-240.el8.x86_64) and installing VirtualBox from the virtualbox repository.
Interestingly, I also have to use this kernel to run VMWare's vmplayer. It doesn't work with the newer kernels.
also version 4.18.0-315.el8.x86_64 of kernel works
javajeep
Posts: 2
Joined: 7. Aug 2021, 19:04

Re: CentOS 8 Stream - vboxdrv wont build

Post by javajeep »

the post by willnix1155 » 1. Aug 2021, 16:59 seems to work for me, so far... Thanks

I edited the file /usr/share/virtualbox/src/vboxhost/vboxdrv/r0drv/linuxalloc-r0drv-linux.c and changed the line 41
from # if RTLNX_VER_MIN(2,6,23) && RTLNX_VER_MAX(5,8,0)
to # if RTLNX_VER_MIN(2,6,23) && RTLNX_VER_MAX(4,17,0)

then run # /sbin/vboxconfig

Though all my host adapters that was setup previously was gone. I had to set that up again.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: CentOS 8 Stream - vboxdrv wont build

Post by fth0 »

@all: Please try the test builds offered in 20488#comment:4 and report back.
Post Reply