From nobody Mon Mar 18 06:30:29 2024 X-Original-To: virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TylNG2Y8fz5FkB5 for ; Mon, 18 Mar 2024 06:30:38 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TylNG1vlgz4RHD; Mon, 18 Mar 2024 06:30:38 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710743438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AkRJd1fkGjCKKCq2ErasBZ4gTPFb9WrB6BYhSz3yQo8=; b=olg97S9xlqBSq+VBfbgOJ6XRP422NKS59vPnDlzCL60S5pGTTPyg+e6ExtwnNv9GivIaLQ 9E378yRqnWSaI5ekpk48fDdAU/otGYwMdcm8353UKDI849VeYZU0vKYuVT/rSWU1cp7XYE TPivg+c4jIykZIJRf7wsnoUQZElIjKsM1sMY7rL3TV5xGQG2UWa7lEsOmdi3zzgWSswfEf SGPxDfLEZK896P1eU93+SmEEHpYgqgEihDWADptEjHIEmbPq9ViGQWBcjye1TMbY3PloSN TRWZNWsYYIKwLmhAWYJLgLAY59hm7HC9uVMwomKeGRVcfRDYqWLgZahkGagUAw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710743438; a=rsa-sha256; cv=none; b=n6DueptZ8/3O74VtRRzs8w+oNISnTgc+d3olO6oMpexqI9l9umztvf1LTgTIJAtLS+vzMB sr8IP81EB2O0uLxn1SuTwCwuxReAAi2NR8dasoxvA1t1oZbjp+GyJS6Cns2yfd6zMUknHx PyAcu69Ra5e416HIK3sLp7xBgQi367jImIlVo6RD8VB5Q+hxOhrNtJ75nEaDLfk/zzvnMh a8yPnoa/Lw+7/CRZh9ZVKv/U4GAxfn+G2BP4WC/fEZsD7+hZmOxHiEPhwm/GdtinFBmwb9 y8a08zXO1IpLnD6St8uxCtYhaylr0gKE0maCyQumecSx4Nm1XhHcRNQ/fXlKDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710743438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AkRJd1fkGjCKKCq2ErasBZ4gTPFb9WrB6BYhSz3yQo8=; b=ni7XHizl5fAwzuUl6IvLppzvc6HEE3F+WJnO+VP58ue01lehn6QASkQdukV2ev22Dowzcc uCztqtBSSvuBJCiYLEYV5k6nSDO4v9fqiJRLuFMdjZOYEHdoeQfUc8bvnG7bmX6nVvxomt eMoJCKeJbDyznLiNEUfQ7g5Xl8/rGOOSnwKI/wPfwRygnANUlWbSGVvG7hQ8aKyQY+zIL2 zBrN9fpLoGRlIAkaJFzTOHD3aOuEBhz+lgzz+rZy5qVJRUeYD/ZnnuckjfZbPmuswq0kJc sWjzNuf2AEQ2vumvYhWMYC5RyOOcGzxkh5akycneDDnLWz9Tcgds2U4MMoBXyw== Received: from smtpclient.apple (unknown [IPv6:2001:19f0:6001:9db:98f0:9fe0:3545:10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4TylND4FNqz1L9P; Mon, 18 Mar 2024 06:30:36 +0000 (UTC) (envelope-from zlei@FreeBSD.org) From: Zhenlei Huang Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_19E181DF-B32E-4D3D-8867-1E381BDF95C2"; protocol="application/pgp-signature"; micalg=pgp-sha512 List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: The driver vboxdrv.ko, in the port virtualbox-ose-kmod, is not loadable in FreeBSD 13.3-RELEASE. Date: Mon, 18 Mar 2024 14:30:29 +0800 In-Reply-To: Cc: virtualization@freebsd.org, maurizio.vairani@cloverinformatica.it, groenveld@acm.org To: Felix Palmen References: <25f90f4e-9cfb-4aab-8755-f0a51430576d@cloverinformatica.it> <94DCB9E1-09C6-4932-B5CB-0B524EEC6754@FreeBSD.org> X-Mailer: Apple Mail (2.3696.120.41.1.8) --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 wrote: >=20 > * Zhenlei Huang [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 {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


On Mar = 15, 2024, at 11:04 PM, Felix Palmen <zirias@FreeBSD.org> = wrote:

* Zhenlei Huang = <zlei@FreeBSD.org> [20240315 22:57]:
Message from = virtualbox-ose-kmod-6.1.50:

--
The vboxdrv kernel module uses internal kernel APIs.

To avoid crashes due to kernel = incompatibility, this module will only
load on FreeBSD = 13.2 kernels.
```

This message is generated, see
https://cgit.freebsd.org/ports/tree/emulators/virtualbox-ose-km= od/files/pkg-message.in

So, in a = nutshell, it will only load on the kernel it was built for.

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).


--
= Felix Palmen <zirias@FreeBSD.org>     {private} =   felix@palmen-it.de
-- ports committer -- =             &n= bsp;       {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-- --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--