building and loading kernel module in jail / host

andy1

Cadet
Joined
May 9, 2019
Messages
3
Hi,

I compiled a kernel module myself in jail. kldload module tells me permission denied.

I tried kldload this module on FreeNAS host from the jail directory and i get an error:

kldload: unexpected relocation type 4
link_elf_obj: symbol memcpy undefined
linker_load_file: Unsupported file type

Any ideas ?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Does your module load on regular FreeBSD?

FreeNAS is customized and doesn't include all libraries usually found in a FreeBSD build (unlike the jail, which does run a more standard build, but has no direct access to the hardware unless you use a different devfs ruleset from the default). Even if the jail gets full access to the system with the least restrictive devfs ruleset, I don't think you can necessarily run kernel modules not present on the host. Anyway, maybe all this is telling you that FreeNAS isn't a good candidate to host a custom kernel module.
 
Last edited:

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
A jail is a userland container. You cannot modify the kernel in this way from a jail.
 

andy1

Cadet
Joined
May 9, 2019
Messages
3
yes, i compiled the module on a virtualbox FreeBSD 11.2 guest and it loads. My FreeNAS box is at 11.2

Does your module load on regular FreeBSD?

FreeNAS is customized and doesn't include all libraries usually found in a FreeBAS build (unlike the jail, which does run a more standard build, but has no direct access to the hardware unless you use a different devfs ruleset from the default). Even if the jail gets full access to the system with the least restrictive devfs ruleset, I don't think you can necessarily run kernel modules not present on the host. Anyway, maybe all this is telling you that FreeNAS isn't a good candidate to host a custom kernel module.
 

andy1

Cadet
Joined
May 9, 2019
Messages
3
A jail is a userland container. You cannot modify the kernel in this way from a jail.

This is the reason why i tried to load the module at the FreeNAS host, but without success as i reported in my first post.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
This is the reason why i tried to load the module at the FreeNAS host
As I already stated, you're probably missing a litany of dependencies and should not plan to install those if you want an easy life through the series of updates to FreeNAS. It's an appliance OS, so doesn't really support OS adjustment.
 
Top