rcvboxadd quicksetup always compiles

On my Linux machine I have the issue that VirtualBox rcvboxadd quicksetup always compiles its kernel modules even if they already exist.

I am using RHEL 8.10 and Oracle VirtualBox 7.1.6 (although it also happens in earlier versions). The comment about quicksetup in the rcvboxadd script states:

# Builds kernel modules for the specified kernels if they are not already built.

But running rcvboxadd quicksetup (compiles kernel modules for the currently running kernel) or rcvboxadd quicksetup all (compiles kernel modules for all installed kernels) always compiles the kernel modules even if they exist.

By looking at the function setup_modules() in the script /usr/sbin/rcvboxadd there is a line which is commented:

#test ! -f "$1" || return 0

that checks if the kernel module already exists. So if we remove the comment with:

sed -i "/#test \! -f \"\$1\"/s/    #/    /" /sbin/rcvboxadd

it works just as it should:

  • rcvboxadd quicksetup compiles the modules for the current running kernel if they do not exist
  • rcvboxadd quicksetup all compiles modules for all installed kernels if they do not exist
  • rcvboxadd setup alway compiles the modules for the current running kernel