Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Feb 2004 22:46:51 +0100
From:      Eivind Olsen <eivind@aminor.no>
To:        current@freebsd.org
Subject:   How to create device nodes in a chroot jail?
Message-ID:  <10344312.1075675611@[192.168.0.2]>

next in thread | raw e-mail | index | archive | help
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@aminor.no>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?10344312.1075675611>