vboxdrv 内核模块未加载(未知 rela 重定位 - debian buster)

The vboxdrv kernel module is not loaded (Unknown rela relocation - debian buster)

Virtualbox 在将 Debian 从 Stretch 更新到 Buster 后无法加载内核模块。 我有 Virtualbox 6.1 和下一个内核版本:

~$ uname -a Linux debian 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23) x86_64 GNU/Linux

此外,我的 Bios 上有传统支持,并且禁用了安全启动。 Debian 也配置为从 Legacy

引导

我见过很多类似的案例,但是所有建议的解决方法都不适合我。

我已经尝试了下一个解决方案:

~$ sudo /sbin/vboxconfig  vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services. vboxdrv.sh: Building
VirtualBox kernel modules. vboxdrv.sh: failed: modprobe vboxdrv
failed. Please use 'dmesg' to find out why.
 
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.

~$ sudo modprobe vboxdrv  modprobe: ERROR: could not insert 'vboxdrv': Exec format error

~$ sudo dpkg-reconfigure virtualbox-6.1 dkms addgroup: The group
`vboxusers' already exists as a system group. Exiting. vboxdrv.sh:
failed: modprobe vboxdrv failed. Please use 'dmesg' to find out why.

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.

~$ sudo apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,')
virtualbox-6.1 --reinstall ... Unpacking linux-headers-amd64
(4.19+105+deb10u7) over (4.19+105+deb10u7) ... Setting up
linux-headers-amd64 (4.19+105+deb10u7) ... Setting up virtualbox-6.1
(6.1.16-140961~Debian~buster) ... addgroup: The group `vboxusers'
already exists as a system group. Exiting. vboxdrv.sh: failed:
modprobe vboxdrv failed. Please use 'dmesg' to find out why.

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. Processing
triggers for mime-support (3.62) ... Processing triggers for
hicolor-icon-theme (0.17-2) ... Processing triggers for systemd
(241-7~deb10u4) ... Processing triggers for shared-mime-info (1.10-1)
... Processing triggers for desktop-file-utils (0.23-4) ...

:~$ sudo /sbin/rcvboxdrv 
setup vboxdrv.sh: Stopping VirtualBox services. 
vboxdrv.sh: Starting VirtualBox services. 
vboxdrv.sh:
Building VirtualBox kernel modules. vboxdrv.sh: failed: modprobe vboxdrv failed. 
Please use 'dmesg' to find out why.

我还尝试了另一种可能的解决方法:

所有与 vboxdrv 内核模块相关的失败操作在 stdoutdmesg 中返回此消息:

module: vboxdrv: Unknown rela relocation: 4

重定位错误看起来像是 运行 内核与构建模块时使用的 binutils 版本之间的兼容性问题。查看这些讨论:

Exec 格式错误和未知的 rela 重定位:

This kernel commit looks relevant — 0x02 and 0x04 are R_X86_64_PC32 and R_X86_64_PLT32 respectively — but you don't have that in your kernel. It looks like you've upgraded to binutils >= 2.31, so your linker has decided to use R_X86_64_PLT32 relocations now.

Confirmed, downgrading binutils to 2.30 solves the problem

关于 Stack Overflow,请参阅 binutils version