CentOS 7, Kernel 5.12, Virtual Box 6.1 -can't start Virtual Machine

General support questions
Post Reply
alexei28
Posts: 10
Joined: 2021/07/29 06:36:24

CentOS 7, Kernel 5.12, Virtual Box 6.1 -can't start Virtual Machine

Post by alexei28 » 2021/07/29 06:41:08

CentOS 7, Kernel 5.12.8-1.el7.elrepo.x86_64, Virtual Box 6.1 + extension pack

I create virtual machine - Windows 10 Enterprise. But when I click Start on Virtual box I get error:

Failed to open a session for the virtual machine Windows 10 Enterprise.

The virtual machine 'Windows 10 Enterprise' has terminated unexpectedly during startup with exit code 1 (0x1).

Result Code: NS_ERROR_FAILURE (0x80004005)
Component: MachineWrap
Interface: IMachine {85632c68-b5bb-4316-a900-5eb28d3413df}




and another error:

Kernel driver not installed (rc=-1908)

The VirtualBox Linux kernel driver is either not loaded or not set up correctly. Please try setting it up again by executing

'/sbin/vboxconfig'

as root.

If your system has EFI Secure Boot enabled you may also need to sign the kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load them. Please see your Linux system's documentation for more information.

where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT.


I try this:

Code: Select all

sudo /sbin/vboxconfig
But get error:

vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: failed: Look at /var/log/vbox-setup.log to find out what went wrong.

There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root. If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.


And in the vbox-setup.log :

Building the main VirtualBox module.
Error building the module:
make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/5.12.8-1.el7.elrepo.x86_64/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j12 modules
make[1]: warning: -jN forced in submake: disabling jobserver mode.
make -C /usr/src/kernels/5.12.8-1.el7.elrepo.x86_64 -f /usr/src/kernels/5.12.8-1.el7.elrepo.x86_64/Makefile modules
make -f ./scripts/Makefile.build obj=/tmp/vbox.0 \
single-build= \
need-builtin=1 need-modorder=1
gcc -Wp,-MMD,/tmp/vbox.0/linux/.SUPDrv-linux.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -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 -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -fno-strict-overflow -fno-stack-check -Werror=date-time -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='"SUPDrv_linux"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/linux/SUPDrv-linux.o /tmp/vbox.0/linux/SUPDrv-linux.c
gcc: error: unrecognized command line option ‘-mrecord-mcount’
gcc -Wp,-MMD,/tmp/vbox.0/.SUPDrv.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -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 -mtune=generic -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -fno-strict-overflow -fno-stack-check -Werror=date-time -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='"SUPDrv"' -DKBUILD_MODNAME='"vboxdrv"' -D__KBUILD_MODNAME=kmod_vboxdrv -c -o /tmp/vbox.0/SUPDrv.o /tmp/vbox.0/SUPDrv.c
make[3]: *** [/tmp/vbox.0/linux/SUPDrv-linux.o] Error 1
make[3]: *** Waiting for unfinished jobs....
gcc: error: unrecognized command line option ‘-mrecord-mcount’
make[3]: *** [/tmp/vbox.0/SUPDrv.o] Error 1
make[2]: *** [/tmp/vbox.0] Error 2
make[1]: *** [__sub-make] Error 2
make: *** [vboxdrv] Error 2


Also I did all steps from official documentation "Installing and using VirtualBox on CentOS" in official site.

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: CentOS 7, Kernel 5.12, Virtual Box 6.1 -can't start Virtual Machine

Post by jlehtone » 2021/07/29 15:05:34

Code: Select all

gcc: error: unrecognized command line option ‘-mrecord-mcount’
You are building with system's gcc. I don't think that you can compile kernel with that version any more.

Install 'devtoolset-10-toolchain'. Then enable that SCL: scl enable devtoolset-10 bash
Within that bash session you have access to gcc that supports newer options.

Why do you have virtualbox at all? CentOS 7 virtualization packages offer libvirtd/KVM, which are quite reliable.

Why do you have unsupported kernel? CentOS is designed to be used with its own kernel.

bonedome
Posts: 201
Joined: 2017/04/22 08:11:04

Re: CentOS 7, Kernel 5.12, Virtual Box 6.1 -can't start Virtual Machine

Post by bonedome » 2021/07/29 17:20:07

Why do you have virtualbox at all? CentOS 7 virtualization packages offer libvirtd/KVM, which are quite reliable.
After trying KVM I uninstalled virtualbox, it just seems to do virtualisation better (for me anyway) :D

jsosic
Posts: 24
Joined: 2009/02/13 15:00:00

Re: CentOS 7, Kernel 5.12, Virtual Box 6.1 -can't start Virtual Machine

Post by jsosic » 2021/10/10 11:15:09

This is what you need to do:

Edit the /usr/share/virtualbox/src/vboxhost/build_in_tmp and add the following env variables to the top:

Code: Select all

export INFOPATH=/opt/rh/devtoolset-9/root/usr/share/info
export LD_LIBRARY_PATH=/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib:/opt/rh/devtoolset-9/root/usr/lib64/dyninst:/opt/rh/devtoolset-9/root/usr/lib/dyninst:/opt/rh/devtoolset-9/root/usr/lib64:/opt/rh/devtoolset-9/root/usr/lib
export MANPATH=/opt/rh/devtoolset-9/root/usr/share/man::/opt/puppetlabs/puppet/share/man
export PATH=/opt/rh/devtoolset-9/root/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin:/root/bin
export PCP_DIR=/opt/rh/devtoolset-9/root
export PKG_CONFIG_PATH=/opt/rh/devtoolset-9/root/usr/lib64/pkgconfig
export SHLVL=4
export X_SCLS=devtoolset-9
After that, run:

Code: Select all

# yum -y install devtoolset-9
# /sbin/vboxconfig
# systemctl enable --now vboxdrv

Post Reply