kldconfig(8)

kldconfig8

Display or modify the kernel module search path

Usage

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

kldconfig -r

Overview

The kldconfig utility displays or modifies the search path used by the kernel when loading modules using the kldload(8) utility or the kldload(2) syscall.

The following options are available:

-d

Remove the specified paths from the module search path.

-f

Do not fail if a path specified for adding is already present in the search path, or if a path 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.

-i

Add the specified paths to the beginning of the search path, not to the end. This option can only be used when adding paths.

-m

Instead of replacing the module search path with the set of paths specified, “merge” in the new entries.

-n

Do not actually change the module search path.

-r

Display the current search path. This option cannot be used if any paths are also specified.

-S sysctlname

Specify the sysctl name to use instead of the default kern.module_path.

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

-v

Verbose output: display the new module search path. If the path has been changed, and the -v flag is specified more than once, the old path is displayed as well.

Files

/boot/kernel, /boot/modules, /modules

The default module search path used by the kernel.

Exit status

The kldconfig utility exits 0 on success, and >0 if an error occurs.

Examples

Show the module search path

$ 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:

$ 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:

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

Add the /boot directory to the beginning of the search path and display extra verbose output:

$ 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:

$ 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:

$ 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:

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

Releases

65 releases since FreeBSD 4.4-RELEASE; the text changed 36 times.

  1. 4.4–4.7
  2. 4.8
  3. 4.9–4.11
  4. 5.0–5.5
  5. 6.0–6.3
  6. 6.4
  7. 7.0
  8. 7.1
  9. 7.2
  10. 7.3
  11. 7.4
  12. 8.0
  13. 8.1
  14. 8.2
  15. 8.3
  16. 8.4
  17. 9.0
  18. 9.1
  19. 9.2
  20. 9.3
  21. 10.0
  22. 10.1
  23. 10.2
  24. 10.3
  25. 10.4
  26. 11.0
  27. 11.1
  28. 11.2
  29. 11.3
  30. 11.4
  31. 12.0
  32. 12.1
  33. 12.2
  34. 12.3
  35. 12.4
  36. 13.0–13.2
  37. 13.3–16.0

History

The kldconfig utility first appeared in FreeBSD 4.4.

Authors

Peter Pentchev ⟨[email protected]⟩

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.