Re: Kernel modules not loading on 15-prerelease

From: Mark Millard <marklmi_at_yahoo.com>
Date: Fri, 05 Sep 2025 16:17:06 UTC
On Sep 5, 2025, at 07:37, bob prohaska <fbsd@www.zefox.net> wrote:

> On Thu, Sep 04, 2025 at 09:08:20AM -0700, Mark Millard wrote:
>> 
>> 
>> I'm saying more than that: Any time you used just
>> -DWITH_META_MODE you were not correctly specifying
>> that META_MODE would be used: that specification
>> has to be via an environment variable called
>> WITH_META_MODE, not via a global make variable
>> called WITH_META_MODE .
> 
> Ok, that is something I failed to grasp until now.
> Apparently, my problems are that
> 1. world isn't updating

Not fully updating. Nor are the kernel/modules
fully updating.

> making
> 2. kernel and modules inconsistent.

world's status is not all that is involved in that.

> There a page at https://wiki.freebsd.org/MetaMode offering 
> concise instruction, dated 2021, for using WITH_META_MODE.
> Is it still correct?

For a normal, modern context, yes.

The below will end up recommending a sequence to get
a working kernel/filmon/modules combination before
doing a full buildworld.

Adding notes that that web page's instructions:

> Setup
> 
> Add WITH_META_MODE=YES to /etc/src-env.conf

The above should work in modern contexts. If you are to
disable META_MODE it would be a change to the file to
instead define WITHOUT_META_MODE .

I'll note that the YES text is ignored: just the defined
vs. not status is used for these.

> Run # kldload filemon

Of course, you are tying to get to a status where that
would actually work. Establishing an initial META_MODE
context would need to be done once you have filemon
working so that the full information is recorded.

> Run # make cleanworld once.

In your odd context, "make clean" may well be better
for before starting the builds.

> If objects don't have .meta files then META_MODE won't do the right thing on an incremental build. 1
> FreeBSD buildworld will now create meta files to improve the performance of future builds.

So: how to get a valid kernel/module-set without
first building all of the world:

FIRST: deal with having /etc/src-env.conf include a
line with:

WITH_META_MODE=

(Your choice if you want the YES or some text.)

NOTE: I make the assumption that you want to use
      /etc/src-env.conf instead of command line
      content.

# cd /usr/src/ # (or where ever you have your source)
# make clean # not something that you would normally do
# make kerneltoolchain
# make buildkernel
# make installkernel
# shutdown -r now

NOTE: At this point use of filemon (and more) should
      load and work. But the kerneltoolchain activity
      was not recorded.

NOTE: I do not know your detailed choices about handling
      kernel updates so you may have more related to the
      installkernel than I show. For example, you might
      deliberately keep a copy of the old kernel under
      some alternate name before updating the default
      named one. (There are other possibilities.)

After logging in, do the first build with filemon and META_MODE
via:

# kldload filemon # Should always be established before META_MODE use.
# cd /usr/src/
# make clean # not something that you would normally do
# make buildworld buildkernel

NOTE: That should establish all the *.meta files for META_MODE
      use.

NOTE: At this point a normal procedure for the installkernel
      and installworld sequence can be used.

I have scripts that I used to do various types of builds. They
include doing:

kldload -n filemon
cd /usr/src/ # or my equivalent for a specific source tree

That is in order to establish context for later commands
in the script and for META_MODE use.

I happen to choose to not start filemon unless I'm
starting a system software build, avoiding any overhead
if I've not done any system builds yet.


===
Mark Millard
marklmi at yahoo.com