Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Apr 2024 14:21:59 +0200
From:      =?UTF-8?Q?Fernando_Apestegu=C3=ADa?= <fernape@freebsd.org>
To:        Kyle Evans <kevans@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org,  dev-commits-src-main@freebsd.org
Subject:   Re: git: bc0c6c9cf3a9 - main - freebsd-update: Add check for kernel modules
Message-ID:  <CAGwOe2aanA%2B0Cp3V_v4cBrWp7L5uYpf-3tZM=dn-tPpUOV_3KQ@mail.gmail.com>
In-Reply-To: <6114cce6-dd6e-478f-97af-1a2813f29332@FreeBSD.org>
References:  <202404141746.43EHkobl002927@gitrepo.freebsd.org> <6114cce6-dd6e-478f-97af-1a2813f29332@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000c96a17061621aba3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Apr 15, 2024 at 5:44=E2=80=AFAM Kyle Evans <kevans@freebsd.org> wro=
te:

> On 4/14/24 12:46, Fernando Apestegu=C3=ADa wrote:
> > The branch main has been updated by fernape:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=3Dbc0c6c9cf3a9f9a54dbdd92dd8f1f65=
ff8092d17
> >
> > commit bc0c6c9cf3a9f9a54dbdd92dd8f1f65ff8092d17
> > Author:     Fernando Apestegu=C3=ADa <fernape@FreeBSD.org>
> > AuthorDate: 2023-04-19 16:08:47 +0000
> > Commit:     Fernando Apestegu=C3=ADa <fernape@FreeBSD.org>
> > CommitDate: 2024-04-14 17:46:23 +0000
> >
> >      freebsd-update: Add check for kernel modules
> >
> >      People get confused when some software (VirtualBox, etc) does not
> work as
> >      expected (or at all) after a major upgrade.
> >
> >      We have a nice way to deal with this when using sources, namely
> including
> >      PORTS_MODULES in /etc/make.conf, but we lack something similar for
> binary
> >      updates.
> >
> >      This patch retrieves a list of kernel modules installed from
> packages and
> >      advises the user to recompile from ports to avoid problems.
> >
> >      Approved by:            zlei@
> >      Differential Revision:  https://reviews.freebsd.org/D39695
> > ---
> >   usr.sbin/freebsd-update/freebsd-update.sh | 58
> +++++++++++++++++++++++++++++++
> >   1 file changed, 58 insertions(+)
> >
> > diff --git a/usr.sbin/freebsd-update/freebsd-update.sh
> b/usr.sbin/freebsd-update/freebsd-update.sh
> > index 4a6a8d78330b..d1cd46963a6c 100644
> > --- a/usr.sbin/freebsd-update/freebsd-update.sh
> > +++ b/usr.sbin/freebsd-update/freebsd-update.sh
> > @@ -655,6 +655,63 @@ fetch_setup_verboselevel () {
> >       esac
> >   }
> >
> > +# Check if there are any kernel modules installed from ports.
> > +# In that case warn the user that a rebuild from ports (i.e. not from
> > +# packages) might need necessary for the modules to work in the new
> release.
> > +upgrade_check_kmod_ports() {
> > +     local mod_name
> > +     local modules
> > +     local pattern
> > +     local pkg_name
> > +     local port_name
> > +     local report
> > +     local w
> > +
> > +     if ! command -v pkg >/dev/null; then
> > +             echo "Skipping kernel modules check. pkg(8) not present."
> > +             return
> > +     fi
> > +
> > +     # Most modules are in /boot/modules but we should actually look
> > +     # in every path configured in module_path
> > +     search_files=3D"/boot/defaults/loader.conf /boot/loader.conf"
>
> Woof... this is inherently quite fragile, and it completely ignores how
> loader.conf are actually processed.  The final module_path will always
> get passed to the kernel via kenv(1) and exposed as kern.module_path,
> please strongly consider just grabbing it from one of them instea .
>

Thanks for the feedback. kern.module_path seems like the way to do this
indeed.

Here is a review:
https://reviews.freebsd.org/D44797

Cheers.

>
> Thanks,
>
> Kyle Evans
>

--000000000000c96a17061621aba3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Mon, Apr 15, 2024 at 5:44=E2=80=AF=
AM Kyle Evans &lt;<a href=3D"mailto:kevans@freebsd.org">kevans@freebsd.org<=
/a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0=
px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">O=
n 4/14/24 12:46, Fernando Apestegu=C3=ADa wrote:<br>
&gt; The branch main has been updated by fernape:<br>
&gt; <br>
&gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3Dbc0c6c9cf3a9=
f9a54dbdd92dd8f1f65ff8092d17" rel=3D"noreferrer" target=3D"_blank">https://=
cgit.FreeBSD.org/src/commit/?id=3Dbc0c6c9cf3a9f9a54dbdd92dd8f1f65ff8092d17<=
/a><br>
&gt; <br>
&gt; commit bc0c6c9cf3a9f9a54dbdd92dd8f1f65ff8092d17<br>
&gt; Author:=C2=A0 =C2=A0 =C2=A0Fernando Apestegu=C3=ADa &lt;fernape@FreeBS=
D.org&gt;<br>
&gt; AuthorDate: 2023-04-19 16:08:47 +0000<br>
&gt; Commit:=C2=A0 =C2=A0 =C2=A0Fernando Apestegu=C3=ADa &lt;fernape@FreeBS=
D.org&gt;<br>
&gt; CommitDate: 2024-04-14 17:46:23 +0000<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 freebsd-update: Add check for kernel modules<br>
&gt;=C2=A0 =C2=A0 =C2=A0 <br>
&gt;=C2=A0 =C2=A0 =C2=A0 People get confused when some software (VirtualBox=
, etc) does not work as<br>
&gt;=C2=A0 =C2=A0 =C2=A0 expected (or at all) after a major upgrade.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 <br>
&gt;=C2=A0 =C2=A0 =C2=A0 We have a nice way to deal with this when using so=
urces, namely including<br>
&gt;=C2=A0 =C2=A0 =C2=A0 PORTS_MODULES in /etc/make.conf, but we lack somet=
hing similar for binary<br>
&gt;=C2=A0 =C2=A0 =C2=A0 updates.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 <br>
&gt;=C2=A0 =C2=A0 =C2=A0 This patch retrieves a list of kernel modules inst=
alled from packages and<br>
&gt;=C2=A0 =C2=A0 =C2=A0 advises the user to recompile from ports to avoid =
problems.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 <br>
&gt;=C2=A0 =C2=A0 =C2=A0 Approved by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 zlei@<br>
&gt;=C2=A0 =C2=A0 =C2=A0 Differential Revision:=C2=A0 <a href=3D"https://re=
views.freebsd.org/D39695" rel=3D"noreferrer" target=3D"_blank">https://revi=
ews.freebsd.org/D39695</a><br>
&gt; ---<br>
&gt;=C2=A0 =C2=A0usr.sbin/freebsd-update/freebsd-update.sh | 58 +++++++++++=
++++++++++++++++++++<br>
&gt;=C2=A0 =C2=A01 file changed, 58 insertions(+)<br>
&gt; <br>
&gt; diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/free=
bsd-update/freebsd-update.sh<br>
&gt; index 4a6a8d78330b..d1cd46963a6c 100644<br>
&gt; --- a/usr.sbin/freebsd-update/freebsd-update.sh<br>
&gt; +++ b/usr.sbin/freebsd-update/freebsd-update.sh<br>
&gt; @@ -655,6 +655,63 @@ fetch_setup_verboselevel () {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0esac<br>
&gt;=C2=A0 =C2=A0}<br>
&gt;=C2=A0 =C2=A0<br>
&gt; +# Check if there are any kernel modules installed from ports.<br>
&gt; +# In that case warn the user that a rebuild from ports (i.e. not from=
<br>
&gt; +# packages) might need necessary for the modules to work in the new r=
elease.<br>
&gt; +upgrade_check_kmod_ports() {<br>
&gt; +=C2=A0 =C2=A0 =C2=A0local mod_name<br>
&gt; +=C2=A0 =C2=A0 =C2=A0local modules<br>
&gt; +=C2=A0 =C2=A0 =C2=A0local pattern<br>
&gt; +=C2=A0 =C2=A0 =C2=A0local pkg_name<br>
&gt; +=C2=A0 =C2=A0 =C2=A0local port_name<br>
&gt; +=C2=A0 =C2=A0 =C2=A0local report<br>
&gt; +=C2=A0 =C2=A0 =C2=A0local w<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0if ! command -v pkg &gt;/dev/null; then<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0echo &quot;Skipping k=
ernel modules check. pkg(8) not present.&quot;<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return<br>
&gt; +=C2=A0 =C2=A0 =C2=A0fi<br>
&gt; +<br>
&gt; +=C2=A0 =C2=A0 =C2=A0# Most modules are in /boot/modules but we should=
 actually look<br>
&gt; +=C2=A0 =C2=A0 =C2=A0# in every path configured in module_path<br>
&gt; +=C2=A0 =C2=A0 =C2=A0search_files=3D&quot;/boot/defaults/loader.conf /=
boot/loader.conf&quot;<br>
<br>
Woof... this is inherently quite fragile, and it completely ignores how <br=
>
loader.conf are actually processed.=C2=A0 The final module_path will always=
 <br>
get passed to the kernel via kenv(1) and exposed as kern.module_path, <br>
please strongly consider just grabbing it from one of them instea .<br></bl=
ockquote><div><br></div><div>Thanks for the feedback. kern.module_path seem=
s like the way to do this indeed.<br></div><div><br></div><div>Here is a re=
view:<br></div><div><a href=3D"https://reviews.freebsd.org/D44797">https://=
reviews.freebsd.org/D44797</a></div><div>=C2=A0</div><div>Cheers.<br></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks,<br>
<br>
Kyle Evans<br>
</blockquote></div></div>

--000000000000c96a17061621aba3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGwOe2aanA%2B0Cp3V_v4cBrWp7L5uYpf-3tZM=dn-tPpUOV_3KQ>