KLDCONFIG(8)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… KLDCONFIG β€” the manual page, but make it cute

okay bestie, welcome to the kldconfig(8) glow-up ✨ it lives in section 8 of the System Manager's Manual and it's literally the glow-up artist for your kernel module search path. let's get into it 🫢


🌸 NAME 🌸

kldconfig β€” display or modify the kernel module search path. that's it. that's the whole vibe check πŸ‘‘


✨ SYNOPSIS ✨

kldconfig [-dfimnUv] [-S sysctlname] [path ...]
kldconfig -r

two moods, bestie. one with paths, one with just -r. pick your fighter πŸŽ€


πŸ’– DESCRIPTION πŸ’–

so the kldconfig utility displays or modifies the search path β€” and that's the search path the kernel uses when it's loading modules via the kldload(8) utility or the kldload(2) syscall. it's giving behind-the-scenes main character energy, honestly πŸ”₯

here are the options, and yes i'm listing every single one because we don't skip πŸ’…

πŸ¦‹ OPTIONS πŸ¦‹

  • -d β€” remove the specified paths from the module search path. bye bestie πŸ‘‹
  • -f β€” do not fail if a path you specified for adding is already present in the search path, or if a path you specified for removing is not present in the search path. this may be useful in startup/shutdown scripts for adding a path to a file system which is still not mounted, or in shutdown scripts for unconditionally removing a path that may have been added during startup. it's the "no thoughts, just vibes" flag 🫢
  • -i β€” add the specified paths to the beginning of the search path, not to the end. front of the line energy πŸ‘‘ this option can only be used when adding paths β€” don't get cute with it.
  • -m β€” instead of replacing the module search path with the set of paths specified, "merge" in the new entries. like, keep the old stuff AND the new stuff. both. both is good πŸ’œ
  • -n β€” do not actually change the module search path. it's a dress rehearsal, a simulation, a little delulu where nothing is real πŸ™ˆ
  • -r β€” display the current search path. this option cannot be used if any paths are also specified. periodt.
  • -S sysctlname β€” specify the sysctl name to use instead of the default kern.module_path. custom name, custom vibe.
  • -U β€” "Unique-ify" the current search path. if any of the directories is repeated one or more times, only the first occurrence remains. this option implies -m. slay, but tidy πŸ’…
  • -v β€” verbose output: display the new module search path. and if the path has been changed, and the -v flag is specified more than once, the old path is displayed as well. double -v = the before AND after pics πŸ“Έ

πŸŽ€ FILES πŸŽ€

  • /boot/kernel, /boot/modules, /modules β€” the default module search path used by the kernel. the OGs 🌈

πŸ’€ EXIT STATUS πŸ’€

the kldconfig utility exits 0 on success, and >0 if an error occurs. clean exit = iconic. error = we don't talk about it 😭


πŸ”₯ EXAMPLES πŸ”₯

okay this is the fun part, let's actually do things πŸ“

Show the module search path β€” the classic, the starter pack:

$ kldconfig -r
/boot/kernel;/boot/modules;/boot/dtb;/boot/dtb/overlays

Try to delete the /boot directory from the search path. the command will fail. not me getting rejected 😭

$ kldconfig -d /boot
kldconfig: not in module search path: /boot
$ echo $?
1

Same as above but forcing the operation. this time the command will succeed. -f said "i got you" 🫢

$ kldconfig -d -f /boot
$ echo $?
0

Add the /boot directory to the beginning of the search path and display extra verbose output β€” watch it scoot to the front:

$ kldconfig -i -m -vv /boot
/boot/kernel;/boot/modules -> /boot;/boot/kernel;/boot/modules

Without -m the -i flag will overwrite the contents of the search path list. yeah… it really does that. that's the whole list gone, bestie πŸ’€

$ kldconfig -i -vv /boot
/boot;/boot/kernel;/boot/modules;/boot/dtb;/boot/dtb/overlays -> /boot

Same as above but using -n to simulate the operation without actually doing it β€” the simulation arc πŸ™ˆ

$ kldconfig -i -n -vv /boot
/boot;/boot/kernel;/boot/modules;/boot/dtb;/boot/dtb/overlays -> /boot

Add directories to the search path removing duplicates. note the need of -f to force the operation in case any of the directories is already in the search path. the /boot/kernel directory will be added once β€” unique, one of a kind, literally main character energy πŸ‘‘

$ kldconfig -f -U /boot/kernel /boot/kernel /boot/modules /boot/dtb /boot/dtb/overlays

🧚 SEE ALSO 🧚

kldload(2), kldload(8), kldxref(8), sysctl(8) β€” go read those too, i'll wait πŸ’–


⭐ HISTORY ⭐

the kldconfig utility first appeared in FreeBSD 4.4. vintage. retro. a legacy icon πŸŽ€


πŸ‘‘ AUTHORS πŸ‘‘

Peter Pentchev <roam@FreeBSD.org> β€” thank you for this, king 🫢


and that's the whole page, bestie!! this Debian build is dated September 29, 2020 and it's KLDCONFIG(8) in the System Manager's Manual, so you know exactly which era of slay you're reading πŸ’œ ✨ πŸ¦‹

πŸ“¦ where this page comes from