It seems loading kernel modules is broken when triggered inside a chroot. This includes both loading them using kldload(8), and autoloading triggered by eg mount(8).
Why would you want to load kernel modules in a chrooted filesystem namespace?
Same reason as outside - in my particular case to make “mount -t ext2fs” work.
Note that I’m not talking about loading modules somehow located in a file inside the chroot, I’m talking about triggering the load of the module at its usual, non-chrooted path, from inside the chroot.
A commit in branch main references this bug:
Author: Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-04-21 11:54:29 +0000
Commit: Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2021-04-21 11:54:37 +0000
rc: make the 'linux' script explicitly load filesystem modules
This removes a minor annoyance with Linux jails, where you often
want linux_mounts_enable="NO", yet you want those filesystems
available for mounting in jails; normally mount(8) would result
in kernel automatically loading the KLD, but this doesn't work
inside jails or chroots.
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29725
libexec/rc/rc.d/linux | 6 ++++++
1 file changed, 6 insertions(+)