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: URL: https://cgit.FreeBSD.org/src/commit/?id=45aec46246fe61a3f45cf7da1c80850dc226f609 commit 45aec46246fe61a3f45cf7da1c80850dc226f609 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. PR: 242955 Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29725 libexec/rc/rc.d/linux | 6 ++++++ 1 file changed, 6 insertions(+)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=2ffd6857cca0a022620fb0ee6eec6dc17be5831d commit 2ffd6857cca0a022620fb0ee6eec6dc17be5831d Author: Edward Tomasz Napierala <trasz@FreeBSD.org> AuthorDate: 2021-04-21 11:54:29 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> CommitDate: 2022-02-13 23:20:29 +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. PR: 242955 Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29725 (cherry picked from commit 45aec46246fe61a3f45cf7da1c80850dc226f609) libexec/rc/rc.d/linux | 6 ++++++ 1 file changed, 6 insertions(+)
^Triage: committed and MFCed back in 2021.