Author Topic: Can't use a mirror of / with unionfs in a chroot jail  (Read 834 times)

Offline shabble

  • New Friend
  • *
  • Posts: 2
Can't use a mirror of / with unionfs in a chroot jail
« on: March 24, 2010, 10:51:21 AM »
Hope I'm in the right section - point me in the right direction if not, TIA.

Current setup:
Code: [Select]
[paul@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.32.8-pclos5.bfs #1 SMP PREEMPT Sat Feb 13 03:56:10 CST 2010 i686 Intel(R) Core(TM)2 Duo CPU     T9300  @ 2.50GHz GNU/Linux
[paul@localhost ~]$ unionctl -V
unionctl version: $Id: unionctl.c,v 1.1 2006/05/31 02:51:04 dquigley Exp $
Distributed with Unionfs 1.4
<snip>

I'm trying to implement the stuff at http://www.howtoforge.com/safe_mirror_unionfs_chroot

Simplified version of what I'm trying:
Code: [Select]
export TMPUFS=~/mnt/tmpufs
mkdir -p $TMPUFS  $TMPUFS/cache $TMPUFS/union
chmod 777 $TMPUFS/cache
# Create virtual ext2 volume - 16M large, and mount it
dd if=/dev/zero of=$TMPUFS/cache.img bs=16M count=1
mkfs.ext2 $TMPUFS/cache.img -F
sudo mount $TMPUFS/cache.img $TMPUFS/cache -o loop

# Union the volume with / as read only
sudo mount -t unionfs -o dirs=$TMPUFS/cache:/=ro unionfs $TMPUFS/union
ls -l /$TMPUFS/union

My result:
Code: [Select]
[all but last line of code above omitted]
[paul@localhost mnt]$ ls -l /$TMPUFS/union
ls: cannot access //home/paul/mnt/tmpufs/union/sys: No such file or directory
ls: cannot access //home/paul/mnt/tmpufs/union/proc: No such file or directory
total 180
drwxr-xr-x 1 root root  4096 2010-03-17 09:30 bin/
drwxr-xr-x 1 root root  4096 2010-03-24 14:25 boot/
drwxrwxrwx 1 root root  4096 2010-03-22 12:42 conf/
drwxr-xr-x 1 root root  4180 2010-03-24 14:25 dev/
drwxr-xr-x 1 root root 12288 2010-03-24 16:34 etc/
drwxr-xr-x 1 root root  4096 2010-03-16 10:41 home/
drwxr-xr-x 1 root root  4096 2010-03-12 16:20 initrd/
drwxr-xr-x 1 root root 12288 2010-03-24 11:41 lib/
drwx------ 1 root root 12288 2010-03-24 16:34 lost+found/
drwxr-xr-x 1 root root  4096 2010-03-24 14:24 media/
drwxr-xr-x 1 root root  4096 2010-03-17 12:23 mnt/
-rw-r--r-- 1 root root 75140 2010-03-24 11:40 Module.symvers
drwxr-xr-x 1 root root  4096 2010-03-15 16:30 opt/
d????????? ? ?    ?        ?                ? proc/
drwxr-xr-x 1 root root  4096 2010-03-24 12:31 proc2/
drwxr-xr-x 1 root root  4096 2010-03-24 16:35 root/
drwxr-xr-x 1 root root 12288 2010-03-24 11:40 sbin/
drwxr-xr-x 1 root root  4096 2010-02-22 12:36 swap/
d????????? ? ?    ?        ?                ? sys/
drwxrwxrwt 1 root root   240 2010-03-24 16:27 tmp/
drwxr-xr-x 1 root root  4096 2010-01-28 11:48 usr/
drwxr-xr-x 1 root root  4096 2010-03-12 15:30 var/
[paul@localhost mnt]$ ls -l /$TMPUFS/union/proc
ls: cannot access //home/paul/mnt/tmpufs/union/proc: No such file or directory
[paul@localhost mnt]$

What's up with /proc and /sys?

I can't chroot into this directory and expect anything that relies on ps to work for example.

/tmp and /dev work without the mount tricks referred to in the link up top (with the exception of the softlinks in /dev to stuff in /proc of course, because it ain't there.)

Any pointers appreciated.

I've tried with a couple of 'tiny' distributions in VirtualBox to see if this is something fundamental with unionfs rather than PCLOS, but the unionfs support seems to be rather lacking in them.

Offline shabble

  • New Friend
  • *
  • Posts: 2
Re: Can't use a mirror of / with unionfs in a chroot jail
« Reply #1 on: March 31, 2010, 02:39:31 AM »
Update - I've compiled 2.6.32.10 to see if that's changed things, and my mention of the version of unionctl is misleading. Behaviour has not changed.

Since there's been 50-odd views of this since I posted, and no replies, could I ask at least one person to at least try what I'm doing and determine whether it's
  • just me
  • something I'm doing wrong
  • something with unionfs/PCLos?

TIA.

Hope I'm in the right section - point me in the right direction if not, TIA.

Current setup:
Code: [Select]
[paul@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.32.8-pclos5.bfs #1 SMP PREEMPT Sat Feb 13 03:56:10 CST 2010 i686 Intel(R) Core(TM)2 Duo CPU     T9300  @ 2.50GHz GNU/Linux
[paul@localhost ~]$ unionctl -V
unionctl version: $Id: unionctl.c,v 1.1 2006/05/31 02:51:04 dquigley Exp $
Distributed with Unionfs 1.4
<snip>


Current situation:
Code: [Select]
[paul@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.32.10-pclos2 #1 SMP Tue Mar 16 13:56:55 CDT 2010 i686 Intel(R) Core(TM)2 Duo CPU     T9300  @ 2.50GHz GNU/Linux
[paul@localhost ~]$ modinfo unionfs
filename:       /lib/modules/2.6.32.10-pclos2/kernel/fs/unionfs/unionfs.ko.gz
license:        GPL
description:    Unionfs 2.5.3 (for 2.6.32-pre) (http://unionfs.filesystems.org)
author:         Erez Zadok, Filesystems and Storage Lab, Stony Brook University (http://www.fsl.cs.sunysb.edu)
srcversion:     41C476B5BE69AE96354B5FA
depends:       
vermagic:       2.6.32.10-pclos2 SMP mod_unload modversions 686
[paul@localhost ~]$