Re: VirtualBox kmod won't load "module already loaded or in kernel"

From: Piotr Smyrak <ps.ports_at_smyrak.com>
Date: Wed, 24 Jul 2024 09:41:13 UTC
On Fri, 19 Jul 2024 13:37:41 +1000
Greg 'groggy' Lehey <grog@freebsd.org> wrote:

> On Friday, 19 July 2024 at 13:23:46 +1000, Graham Menhennitt wrote:
> > Hello all,
> >
> > I'm running FredBSD 14.1 amd64 with a GENERIC kernel. I've installed
> > VirtualBox from packages. But I can't load any of its kmod modules.
> > When I try, I get a message:
> >     # kldload vboxdrv
> >     kldload: can't load vboxdrv: module already loaded or in kernel
> >     #
> > However, neither of those things is true:
> >     # kldstat -v|grep -i virtualbox
> >     #  
> 
> Yes.  It lies.  It's VB's inimitable way of saying "you have the wrong
> module version for this kernel".  It should be sufficient to rebuild
> the virtualbox-ose-kmod port.  Don't install the package, because it
> doesn't know what kernel you have.

It's worth to note that there is a systematic solution to rebuild ports
that install kernel modules each time a new kernal is installed from
sources. Placing such a line in /etc/make.conf will induce rebuilding
of kmod port by system Makefiles:

PORTS_MODULES += emulators/virtualbox-ose-kmod

HTH,
-- 
 Piotr Smyrak