How to create device nodes in a chroot jail?

From: Eivind Olsen <eivind_at_aminor.no>
Date: Sun, 01 Feb 2004 22:46:51 +0100
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>
Received on Sun Feb 01 2004 - 12:44:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:41 UTC