1

Virtualbox fails to load kernel module after updating Debian from Stretch to Buster. I have Virtualbox 6.1 and the next kernel version:

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

Also, I have legacy support on my Bios and secureboot disabled. Debian is also configured to boot from Legacy

I've seen a bunch of similar cases however all of the proposed workarounds don't work for me.

I've tried the next solutions:

~$ 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.

Also i've tried another possible workarounds:

  • Reboot my PC and try to perform modprobe and vboxconfig commands
  • run virtualbox as root
  • install Virtualbox 5.2, 6.0, 6.1 from Debian repo
  • Install the latest Virtualbox directly from the .deb package
  • sudo /opt/VirtualBox/vboxdrv.sh force-reload
  • sudo /opt/VirtualBox/vboxdrv.sh setup

All the failed operations related to vboxdrv kernel module returning in stdout or in dmesg this message:

module: vboxdrv: Unknown rela relocation: 4
a_bridges
  • 386
  • 4
  • 11
  • 1
    What does dmesg say? – Raman Sailopal Nov 03 '20 at 15:08
  • The same, `[ 57.782047] module: vboxdrv: Unknown rela relocation: 4 [ 87.412310] module: vboxdrv: Unknown rela relocation: 4 [ 132.103972] module: vboxdrv: Unknown rela relocation: 4 [ 555.694328] module: vboxdrv: Unknown rela relocation: 4 [ 603.724296] module: vboxdrv: Unknown rela relocation: 4 [ 607.392530] module: vboxdrv: Unknown rela relocation: 4 [ 695.696342] module: vboxdrv: Unknown rela relocation: 4 [ 1007.680936] module: vboxdrv: Unknown rela relocation: 4 [ 1472.050823] module: vboxdrv: Unknown rela relocation: 4` – a_bridges Nov 03 '20 at 16:00
  • 1
    Looks like a compatibility issue between the kernel and binutils version that was used when building modules. See these discussions: [link1](https://www.reddit.com/r/linuxquestions/comments/903xwq/unable_to_compile_working_kernel_modules_anymore/), [link2](https://forums.gentoo.org/viewtopic-t-1096172-start-0.html). Also: [binutils version](https://stackoverflow.com/questions/23604949/how-to-see-what-version-of-binutils-is-on-ubuntu) – Milag Nov 06 '20 at 18:27
  • @Milag `ld -v GNU ld (GNU Binutils for Debian) 2.31.1` It seems it's the same binutils version that it was mentioned on one of the discussions. Can you please suggest the best and safest way to fix it? – a_bridges Nov 08 '20 at 22:32
  • 1
    @a_bridges Have you tried to downgrade `binutils` to <= 2.30 like it is suggested in the one link? – Simon Nov 09 '20 at 15:20
  • @Simon Yes, I've tried it and I've seen another error while launching Virtualbox. It also crashed some of my software, at least all my Nvidia/Optirun drivers. I can repeat this step again and show an error if needed. But it was something like "terminated unexpectedly during startup with exit code 1 (0x1)." – a_bridges Nov 10 '20 at 12:30
  • 1
    @a_bridges It seems that downgrading fixes this issue then? More details would be helpful or maybe even a new question for this new issue. – Simon Nov 10 '20 at 16:59
  • @Simon IIt's weird but when I've did the same steps (downgrading binutils again) for the second time I don't have this 1 (0x1) error anymore. Thank you! My issue is solved now – a_bridges Nov 11 '20 at 10:56
  • @Milag Thank you for your help can you please write your comment as an answer so I can award your answer by the bounty? Also what else can be affected? Is there a chanse that I put back my Nvidia drivers and it will brake Virtualbox in case if binutils will be upgraded again? I've seen that also some another packages were affected by adding this new repo. – a_bridges Nov 11 '20 at 10:56
  • OK, done. Re: break vbox? possibly, there might be indicators checking modules with `readelf -r` – Milag Nov 11 '20 at 14:21

1 Answers1

1

The relocation errors look like a compatibility issue between the running kernel and the binutils version that was used when building modules. See these discussions:

Exec format error and Unknown rela relocation:

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

On Stack Overflow, see binutils version

Simon
  • 4,251
  • 2
  • 24
  • 34
Milag
  • 1,793
  • 2
  • 9
  • 8