How to create device nodes in a chroot jail?

Eivind Olsen eivind at aminor.no
Sun Feb 1 13:44:21 PST 2004


Hello.

I'm currently running some services in a chroot() and they seem to want to 
access device nodes in $chroot/dev/
I've previously created the required device nodes with mknod(8) but it 
looks like this can cause problems. For example, after doing an upgrade 
from 5.2-RELEASE to 5.2.1-RC the /dev/random device changed its major 
number from 250 to 249 and named started complaining:

Jan 31 10:58:08 vimes named[321]: entropy.c:280: unexpected error:
Jan 31 10:58:08 vimes kernel: Jan 31 10:58:08 vimes named[321]: 
entropy.c:280: unexpected error:
Jan 31 10:58:08 vimes named[321]: fcntl(4, F_SETFL, 4): Operation not 
permitted
Jan 31 10:58:08 vimes kernel: Jan 31 10:58:08 vimes named[321]: fcntl(4, 
F_SETFL, 4): Operation not permitted
Jan 31 10:58:08 vimes named[321]: could not open entropy source 
/dev/random: unexpected error

After deleting $chroot/dev/random and recreating it with a new major number 
named started working as expected again.

I am wondering what the best way to do this is in a way that doesn't 
require me to manually delete+recreate those device nodes every time I 
recompile the system? Should I for example look into mounting a 
devfs-filesystem on $chroot/dev/ ?

-- 
Regards / Hilsen
Eivind Olsen
<eivind at aminor.no>


More information about the freebsd-current mailing list