[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bind mount in 32bit chroot

On Thu, Mar 03, 2005 at 06:07:23PM -0500, Javier Kohen wrote:
> >Q2, how about devices, Shouldn't /dev be bind mounted?
> Apparently not, your chroot should have the devices created. I don't 
> know what the reason is though, so if somebody can enlighten us here we 
> would both learn something new :)

Several reasons to bind mount /dev:
1) /dev does not contain only devices (unfortunately) it also contains
some named pipe and some named sockets:

%ls -l /dev  | grep '^[psd]'
prw-r--r--    1 root     root            0 mar  4 01:18 gpmdata
prw-------    1 root     root            0 jan 21 18:49 initctl
srw-rw-rw-    1 root     root            0 jan 21 18:50 log
prw-r-----    1 root     adm             0 mar  3 13:38 xconsole

The named pipes in the chrooted /dev and in the base /dev are unrelated.
(You can read on one what is written to the other.)
However, you can mount --bind each pipes separatly instead of the whole
/dev directory.

For example if you run a 64 bit gpm repeater and a 32 bit Xserver,
the Xserver will not be able to read the (non-chroot) /dev/gpmdata.
Syslog will be broken in the chroot, etc.

2) You would have to take care of mounting devpts on both /dev/pts.

3) The tmpfs filesystems on both /dev/shm are unrelated. You will not 
be able to use shm for communicating between the chroot and the base.

4) Some programs can create devices dynamically. In this case you will
have to create them manually in the 'other' /dev.

5) If you run the same debian release in the chroot and outside, using
the same /dev will save you the trouble to take care of permissions and
symlink, etc.


Reply to: