mold icon indicating copy to clipboard operation
mold copied to clipboard

Virtualbox cannot be installed on Ubuntu 22.04 if mold is used as default linker

Open achataigner opened this issue 3 months ago • 1 comments

OS: Linux Ubuntu 22.04

Steps to reproduce: Install mold: sudo apt update && sudo apt install mold Set mold as default linker using update-alternatives tool: sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.mold" 30 Check that mold is the defaut linker: ld --version Download and launch official virtualbox installer for Ubuntu 22.04: https://www.virtualbox.org/wiki/Linux_Downloads

Expected result Virtualbox is correctly installed

Actual result This error appears:

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.

These errors appear after running sudo vboxconfig at the end of /var/log/vbox-setup.log:

# LD [M]  /tmp/vbox.0/vboxnetflt.o
  ld -m elf_x86_64 -z noexecstack   -r -o /tmp/vbox.0/vboxnetflt.o @/tmp/vbox.0/vboxnetflt.mod 
# cmd_modules_order /tmp/vbox.0/modules.order
  {   echo /tmp/vbox.0/vboxnetflt.o; :; } > /tmp/vbox.0/modules.order
sh ./scripts/modules-check.sh /tmp/vbox.0/modules.order
make -f ./scripts/Makefile.modpost
# MODPOST /tmp/vbox.0/Module.symvers
   scripts/mod/modpost -M -m -a      -o /tmp/vbox.0/Module.symvers -T /tmp/vbox.0/modules.order -i Module.symvers -e -i /tmp/vbox.0/Module.symvers
ERROR: modpost: "VBoxHost_RTMemAllocTag" [/tmp/vbox.0/vboxnetflt.ko] undefined!
ERROR: modpost: "VBoxHost_RTNetIPv4HdrChecksum" [/tmp/vbox.0/vboxnetflt.ko] undefined!
ERROR: modpost: "VBoxHost_RTNetIPv4PseudoChecksum" [/tmp/vbox.0/vboxnetflt.ko] undefined!
ERROR: modpost: "VBoxHost_RTNetIPv4FinalizeChecksum" [/tmp/vbox.0/vboxnetflt.ko] undefined!
ERROR: modpost: "VBoxHost_RTNetIPv6PseudoChecksumEx" [/tmp/vbox.0/vboxnetflt.ko] undefined!
ERROR: modpost: "VBoxHost_RTStrToUInt32" [/tmp/vbox.0/vboxnetflt.ko] undefined!
ERROR: modpost: "VBoxHost_RTR0Init" [/tmp/vbox.0/vboxnetflt.ko] undefined!
ERROR: modpost: "VBoxHost_RTLogRelGetDefaultInstanceEx" [/tmp/vbox.0/vboxnetflt.ko] undefined!
ERROR: modpost: "VBoxHost_RTLogLoggerEx" [/tmp/vbox.0/vboxnetflt.ko] undefined!
ERROR: modpost: "VBoxHost_RTR0Term" [/tmp/vbox.0/vboxnetflt.ko] undefined!
WARNING: modpost: suppressed 6 unresolved symbol warnings because there were too many)
make[2]: *** [scripts/Makefile.modpost:145: /tmp/vbox.0/Module.symvers] Error 1
make[1]: *** [Makefile:1872: modpost] Error 2
make: *** [/tmp/vbox.0/Makefile-footer.gmk:146: vboxnetflt] Error 2

Here is my askubuntu post about this issue: https://askubuntu.com/questions/1555529/failed-to-install-virtualbox-7-2-on-ubuntu-22-04/1555846#1555846

achataigner avatar Sep 10 '25 09:09 achataigner

It looks like VirtualBox installer tries to build kernel modules. mold generally supports only user-land programs, so it may be not too easy to build VirtualBox with mold.

rui314 avatar Sep 14 '25 09:09 rui314