device entries outside /proc with procfs (for chroot)

Brian Candler B.Candler at pobox.com
Tue Sep 20 00:47:02 PDT 2005


On Mon, Sep 19, 2005 at 05:18:57PM +0000, Poul-Henning Kamp wrote:
> In message <20050919130810.A41848 at cons.org>, Martin Cracauer writes:
> >I noticed the creation of /dev/ entries outside of /dev doesn't work
> >anymore.  This is needed for chroot environments, which rely on
> >/dev/null on a regular basis.
> 
> mount -t devfs foo /chroot/dev
> 
> Consider devfs(8) rules as a filtering method.

It took me a while to work out exactly how to configure this, so here's the
recipe (from a FreeBSD 5.4 box)

    [/etc/rc.conf]
    devfs_set_rulesets="/chroot/dev=devfsrules_jail"

Then run "/etc/rc.d/devfs start"

Under FreeBSD 5.4 at least, mknod still works. But using devfs is much
better since you get all necessary pty devices.

    $ ls /chroot/dev
    fd      ptyp2   ptyp7   ptypc   stderr  ttyp2   ttyp7   ttypc   zero
    log     ptyp3   ptyp8   ptypd   stdin   ttyp3   ttyp8   ttypd
    null    ptyp4   ptyp9   ptype   stdout  ttyp4   ttyp9   ttype
    ptyp0   ptyp5   ptypa   ptypf   ttyp0   ttyp5   ttypa   ttypf
    ptyp1   ptyp6   ptypb   random  ttyp1   ttyp6   ttypb   urandom

Regards,

Brian.


More information about the freebsd-current mailing list