Page 1 of 1

Error in vboxdrv.sh causes vbox modules to always be rebuilt

Posted: 29. Jul 2021, 19:39
by syphyr
There is an error in vboxdrv.sh which causes the virtualbox modules to be rebuilt each time the computer is started. modules_available() will always return 0 because the conditional is incorrect.

--- vboxdrv.sh.back 2021-07-16 17:30:37.000000000 +0200
+++ vboxdrv.sh 2021-07-29 19:33:28.735947637 +0200
@@ -327,7 +327,7 @@
# Extract last component of module path and check whether it is located
# outside of /lib/modules/*/misc.
mod_dir="$(dirname "$mod_path" | sed 's;^.*/;;')"
- [ "$mod_dir" != "misc" ] || return
+ [ "$mod_dir" = "misc" ] || return

echo "1"
}

Re: Error in vboxdrv.sh causes vbox modules to always be rebuilt

Posted: 30. Jul 2021, 11:12
by mpack
These are user forums, and you posted in a rather obscure part of them. You should raise this as a BugTracker ticket, with proper version indicators. I'm sure something like this will be fixed almost instantly.

Another thing you could do is post in the Discuss the 6.1.26 topic. The devs do at least read that (I hope).

For others: the relevant location is <src>\Vbox\Installer\linux\vboxdrv.sh, the "module_available()" function, around line 327. This function appears to have been introduced recently (it wasn't present in the 6.1.10 sources I had on my PC, but does appear in 6.1.26).

Re: Error in vboxdrv.sh causes vbox modules to always be rebuilt

Posted: 30. Jul 2021, 11:56
by fth0
Judging from the VirtualBox 6.1.24 Changelog (*) and the comments (2 x "externally built") above and inside the module_available() function, the changes in vboxdrv.sh were deliberately made to prevent VirtualBox from building its kernel modules when the Linux distribution already installed them itself, with the unwanted consequence that VirtualBox now builds its kernel modules after every boot of the Linux host.

I've already asked klaus on IRC if it's a bug or a feature. ;) Waiting for the answer ...

(*) "Linux host: Installer will not attempt to build kernel modules if system already has them installed and modules versions match current version"

Re: Error in vboxdrv.sh causes vbox modules to always be rebuilt

Posted: 30. Jul 2021, 18:35
by klaus
Was told by the dev who made the change that it's unfortunately a bug which slipped through. Classic inverted condition which easily happens with such shell script magic.

The proposed fix is correct, so anyone with the skills to edit the installed file should be able to apply the fix.

Re: Error in vboxdrv.sh causes vbox modules to always be rebuilt

Posted: 14. Aug 2021, 02:47
by WhatHaveYou
Ah! This seems to explain why of late the loading of the VirtualBox driver doubles my boot time.

I take it from the 'diff' provided that the fix - which for some reason has not been pushed to the Ubuntu PPA - is as follows. In vboxdrv.sh (which on my system has the path /usr/lib/virtualbox/vboxdrv.sh), change line 330 from

Code: Select all

[ "$mod_dir" != "misc" ] || return
to

Code: Select all

[ "$mod_dir" = "misc" ] || return
For the record: the amount of trouble that VirtualBox has caused me, on Windows and Linux hosts, has been so great over the years that (1) I just removed it from Windows, (2) I should replace it with another virtualizer on Linux.

Re: Error in vboxdrv.sh causes vbox modules to always be rebuilt

Posted: 14. Aug 2021, 10:43
by mpack
WhatHaveYou wrote: which for some reason has not been pushed to the Ubuntu PPA...
Ubuntu has their own VirtualBox fork which is therefore supported by Ubuntu, not by the VirtualBox devs.