Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Mar 2024 14:30:29 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Felix Palmen <zirias@FreeBSD.org>
Cc:        virtualization@freebsd.org, maurizio.vairani@cloverinformatica.it, groenveld@acm.org
Subject:   Re: The driver vboxdrv.ko, in the port virtualbox-ose-kmod, is not loadable in FreeBSD 13.3-RELEASE.
Message-ID:  <BA0312F9-33AE-4036-B37A-AD4BDB712E13@FreeBSD.org>
In-Reply-To: <qu4wisye7urejtx7bmmdwdg4ccwwb62nqk77vpomzgct35c4bt@lk2xdfat5vlk>
References:  <25f90f4e-9cfb-4aab-8755-f0a51430576d@cloverinformatica.it> <94DCB9E1-09C6-4932-B5CB-0B524EEC6754@FreeBSD.org> <qu4wisye7urejtx7bmmdwdg4ccwwb62nqk77vpomzgct35c4bt@lk2xdfat5vlk>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_19E181DF-B32E-4D3D-8867-1E381BDF95C2
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_B52290E4-13BE-4572-98A9-ACE750E02906"


--Apple-Mail=_B52290E4-13BE-4572-98A9-ACE750E02906
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii



> On Mar 15, 2024, at 11:04 PM, Felix Palmen <zirias@FreeBSD.org> wrote:
>=20
> * Zhenlei Huang <zlei@FreeBSD.org> [20240315 22:57]:
>> Message from virtualbox-ose-kmod-6.1.50:
>>=20
>> --
>> The vboxdrv kernel module uses internal kernel APIs.
>>=20
>> To avoid crashes due to kernel incompatibility, this module will only
>> load on FreeBSD 13.2 kernels.
>> ```
>=20
> This message is generated, see
> =
https://cgit.freebsd.org/ports/tree/emulators/virtualbox-ose-kmod/files/pk=
g-message.in
>=20
> So, in a nutshell, it will only load on the kernel it was built for.
>=20
> Therefore, for some reason OP just didn't successfully build/install =
it
> locally.

I think you are right.

The error message
> KLD vboxdrv.ko: depends on kernel - not available or version mismatch
actually hints that the dependency 'kernel' of the module vboxdrv.ko is =
not satisfied,
from bc6d5725ed6c (emulators/virtualbox-ose-kmod*: Tie to a specific =
release branch) and
kernel source `sys/kern/kern_linker.c`:
```
error =3D linker_load_module(NULL, modname, lf, verinfo, NULL);
if (error) {
        printf("KLD %s: depends on %s - not available or"
            " version mismatch\n", lf->filename, modname);
        break;
}
```

The definition of DECLARE_MODULE_WITH_MAXVER is:
```
#define DECLARE_MODULE_WITH_MAXVER(name, data, sub, order, maxver)      =
\
        MODULE_DEPEND(name, kernel, __FreeBSD_version,                  =
\
            __FreeBSD_version, maxver);                                 =
\
        MODULE_METADATA(_md_##name, MDT_MODULE, &data, =
__XSTRING(name));\
        SYSINIT(name##module, sub, order, module_register_init, &data); =
\
        struct __hack
```
, then the kernel `version mismatch` means the `__FreeBSD_version` is =
not 13.3 (or SA / EN).

So if the vitualbox ose kernel module *IS* built from source then it is =
almost definitely linked
against wrong `__FreeBSD_version` (either /usr/include/osreldate.h is =
outdated or the module
is linked against wrong header file).

>=20
> --
> Felix Palmen <zirias@FreeBSD.org>     {private}   felix@palmen-it.de
> -- ports committer --                     {web}  http://palmen-it.de
> {pgp public key}  http://palmen-it.de/pub.txt
> {pgp fingerprint} 6936 13D5 5BBF 4837 B212  3ACC 54AD E006 9879 F231




--Apple-Mail=_B52290E4-13BE-4572-98A9-ACE750E02906
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" =
class=3D""><div><div class=3D"content-isolator__container"><div =
dir=3D"auto" style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
line-break: after-white-space;" class=3D""><br class=3D""><div><br =
class=3D""><blockquote type=3D"cite" class=3D""><div class=3D"">On Mar =
15, 2024, at 11:04 PM, Felix Palmen &lt;<a =
href=3D"mailto:zirias@FreeBSD.org" class=3D"">zirias@FreeBSD.org</a>&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><div =
class=3D""><div class=3D"content-isolator__container">* Zhenlei Huang =
&lt;<a href=3D"mailto:zlei@FreeBSD.org" =
class=3D"">zlei@FreeBSD.org</a>&gt; [20240315 22:57]:<br =
class=3D""><blockquote type=3D"cite" class=3D"">Message from =
virtualbox-ose-kmod-6.1.50:<br class=3D""><br class=3D"">--<br =
class=3D"">The vboxdrv kernel module uses internal kernel APIs.<br =
class=3D""><br class=3D"">To avoid crashes due to kernel =
incompatibility, this module will only<br class=3D"">load on FreeBSD =
13.2 kernels.<br class=3D"">```<br class=3D""></blockquote><br =
class=3D"">This message is generated, see<br class=3D""><a =
href=3D"https://cgit.freebsd.org/ports/tree/emulators/virtualbox-ose-kmod/=
files/pkg-message.in" =
class=3D"">https://cgit.freebsd.org/ports/tree/emulators/virtualbox-ose-km=
od/files/pkg-message.in</a><br class=3D""><br class=3D"">So, in a =
nutshell, it will only load on the kernel it was built for.<br =
class=3D""><br class=3D"">Therefore, for some reason OP just didn't =
successfully build/install it<br class=3D"">locally.<br =
class=3D""></div></div></div></blockquote><div><br class=3D""></div><div>I=
 think you are right.</div><div><br class=3D""></div><div>The error =
message</div><div>&gt;&nbsp;KLD vboxdrv.ko: depends on kernel - not =
available or version mismatch</div><div>actually hints that the =
dependency 'kernel' of the module&nbsp;<span style=3D"caret-color: =
rgb(0, 0, 0); color: rgb(0, 0, 0);" class=3D"">vboxdrv.ko is not =
satisfied,</span></div><div><span style=3D"caret-color: rgb(0, 0, 0); =
color: rgb(0, 0, 0);" class=3D"">from&nbsp;</span><font color=3D"#000000" =
class=3D"">bc6d5725ed6c (emulators/virtualbox-ose-kmod*: Tie to a =
specific release branch) and</font></div><div><font color=3D"#000000" =
class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" class=3D"">kernel =
source&nbsp;</span></font><span style=3D"caret-color: rgb(0, 0, 0); =
color: rgb(0, 0, 0);" =
class=3D"">`sys/kern/kern_linker.c`:</span></div><div><span =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" =
class=3D"">```</span></div><div><div style=3D"caret-color: rgb(0, 0, 0); =
color: rgb(0, 0, 0);"><div>error =3D linker_load_module(NULL, modname, =
lf, verinfo, NULL);</div><div>if (error) {</div><div>&nbsp; &nbsp; =
&nbsp; &nbsp; printf("KLD %s: depends on %s - not available =
or"</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; " version =
mismatch\n", lf-&gt;filename, modname);</div><div>&nbsp; &nbsp; &nbsp; =
&nbsp; break;</div><div>}</div></div><div style=3D"caret-color: rgb(0, =
0, 0); color: rgb(0, 0, 0);">```</div></div><div><span =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=3D""><br =
class=3D""></span></div><div><span style=3D"caret-color: rgb(0, 0, 0); =
color: rgb(0, 0, 0);" class=3D"">The definition of&nbsp;</span><span =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" =
class=3D"">DECLARE_MODULE_WITH_MAXVER is:</span></div><div><span =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" =
class=3D"">```</span></div><div><div><font color=3D"#000000" =
class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" class=3D"">#define =
DECLARE_MODULE_WITH_MAXVER(name, data, sub, order, maxver) &nbsp; &nbsp; =
&nbsp;\</span></font></div><div><font color=3D"#000000" class=3D""><span =
style=3D"caret-color: rgb(0, 0, 0);" class=3D"">&nbsp; &nbsp; &nbsp; =
&nbsp; MODULE_DEPEND(name, kernel, __FreeBSD_version, &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;\</span></font></div><div><font color=3D"#000000" class=3D""><span =
style=3D"caret-color: rgb(0, 0, 0);" class=3D"">&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; __FreeBSD_version, maxver); &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; \</span></font></div><div><font color=3D"#000000" =
class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" class=3D"">&nbsp; =
&nbsp; &nbsp; &nbsp; MODULE_METADATA(_md_##name, MDT_MODULE, &amp;data, =
__XSTRING(name));\</span></font></div><div><font color=3D"#000000" =
class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" class=3D"">&nbsp; =
&nbsp; &nbsp; &nbsp; SYSINIT(name##module, sub, order, =
module_register_init, &amp;data); \</span></font></div><div><font =
color=3D"#000000" class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" =
class=3D"">&nbsp; &nbsp; &nbsp; &nbsp; struct =
__hack</span></font></div></div><div><span style=3D"caret-color: rgb(0, =
0, 0); color: rgb(0, 0, 0);" class=3D"">```</span></div><div><font =
color=3D"#000000" class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" =
class=3D"">, then the kernel `</span></font><span style=3D"caret-color: =
rgb(0, 0, 0); color: rgb(0, 0, 0);" class=3D"">version mismatch` means =
the `</span><span style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, =
0);" class=3D"">__FreeBSD_version` is not 13.3 (or SA / =
EN).</span></div><div><span style=3D"caret-color: rgb(0, 0, 0); color: =
rgb(0, 0, 0);" class=3D""><br class=3D""></span></div><div><font =
color=3D"#000000" class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" =
class=3D"">So if the vitualbox ose kernel module *IS* built from source =
then it is almost definitely linked</span></font></div><div><font =
color=3D"#000000" class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" =
class=3D"">against wrong `</span></font><span style=3D"caret-color: =
rgb(0, 0, 0); color: rgb(0, 0, 0);" class=3D"">__FreeBSD_version` =
(either&nbsp;</span><font color=3D"#000000" class=3D""><span =
style=3D"caret-color: rgb(0, 0, 0);" class=3D"">/usr/include/osreldate.h =
is outdated or the module</span></font></div><div><font color=3D"#000000" =
class=3D""><span style=3D"caret-color: rgb(0, 0, 0);" class=3D"">is =
linked&nbsp;</span></font><span style=3D"caret-color: rgb(0, 0, 0); =
color: rgb(0, 0, 0);" class=3D"">against wrong header =
file).</span></div><br class=3D""><blockquote type=3D"cite" =
class=3D""><div class=3D""><div class=3D""><div =
class=3D"content-isolator__container"><br class=3D"">-- <br class=3D""> =
Felix Palmen &lt;<a href=3D"mailto:zirias@FreeBSD.org" =
class=3D"">zirias@FreeBSD.org</a>&gt; &nbsp;&nbsp;&nbsp;&nbsp;{private} =
&nbsp;&nbsp;<a href=3D"mailto:felix@palmen-it.de" =
class=3D"">felix@palmen-it.de</a><br class=3D""> -- ports committer -- =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{web} &nbsp;<a =
href=3D"http://palmen-it.de" class=3D"">http://palmen-it.de</a><br =
class=3D""> {pgp public key} &nbsp;<a href=3D"http://palmen-it.de/pub.txt"=
 class=3D"">http://palmen-it.de/pub.txt</a><br class=3D""> {pgp =
fingerprint} 6936 13D5 5BBF 4837 B212 &nbsp;3ACC 54AD E006 9879 F231<br =
class=3D""></div></div></div></blockquote></div><br class=3D""><div =
class=3D"">
<div><br class=3D""></div>

</div>
<br class=3D""></div></div></div></body></html>=

--Apple-Mail=_B52290E4-13BE-4572-98A9-ACE750E02906--

--Apple-Mail=_19E181DF-B32E-4D3D-8867-1E381BDF95C2
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----

iNUEARYKAH0WIQRj28YmNowGX1isJg7GJJ6Jgbd0XwUCZfffhl8UgAAAAAAuAChp
c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0NjNE
QkM2MjYzNjhDMDY1RjU4QUMyNjBFQzYyNDlFODk4MUI3NzQ1RgAKCRDGJJ6Jgbd0
X7v/AQCt4ldYQqtcH5F4A7TSgW9EZ2e3io3fJNqAy9cxXgYGXwEAp1L8TF0sjMCi
qYa5nHyoYg1JleIkgw3ypRJEgX/01AI=
=rc1d
-----END PGP SIGNATURE-----

--Apple-Mail=_19E181DF-B32E-4D3D-8867-1E381BDF95C2--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BA0312F9-33AE-4036-B37A-AD4BDB712E13>