On Friday 01 August 2014 16:44:11 Canek Peláez Valdés wrote:

> I was only offering options. The OP will use whatever he decides to use.

All interesting stuff. Personally, I'm not ready to go for systemd, as the
openrc system I have works well for me and I understand it (mostly).

I settled on an init script to set up the chroot, with a suitable mtab ready
to be copied in. For anyone who's interested, this is the init:

start() {
    ebegin "Mounting 32-bit chroot dirs"
    mount -t proc /proc /mnt/atom/proc
    mount --rbind /dev /mnt/atom/dev
    mount --rbind /sys /mnt/atom/sys
    mount -t nfs 192.168.0.2:/usr/portage/packages 
/mnt/atom/usr/portage/packages
    cp /root/mtab.atom /mnt/atom/etc/mtab
    eend $? "An error occurred while attempting to mount 32-bit chroot 
directories"
}

stop() {
    ebegin "Unmounting 32-bit chroot dirs"
    rm /mnt/atom/etc/mtab
    umount -f /mnt/atom/dev/mqueue
    umount -f /mnt/atom/dev/pts
    umount -f /mnt/atom/dev/shm
    umount -f /mnt/atom/dev
    umount -f /mnt/atom/proc
    umount -f /mnt/atom/sys/fs/cgroup/openrc
    umount -f /mnt/atom/sys/fs/cgroup/cpuset
    umount -f /mnt/atom/sys/fs/cgroup/cpu
    umount -f /mnt/atom/sys/fs/cgroup/cpuacct
    umount -f /mnt/atom/sys/fs/cgroup/freezer
    umount -f /mnt/atom/sys/fs/cgroup
    umount -f /mnt/atom/sys/kernel/debug
    umount -f /mnt/atom/sys
    umount -f /mnt/atom/usr/portage/packages
    eend $? "An error occurred while attempting to unmount 32-bit chroot 
directories"
}

(I've omitted several sleeps from the /stop/ procedure.) If I left out any of
the lower-level umounts, the ones above it would fail.

# cat /root/mtab.atom
devtmpfs /dev devtmpfs rw,relatime,size=8201684k,nr_inodes=2050421,mode=755 0 0
/sys /sys none rw,bind,rbind 0 0
/dev /dev none rw,bind,rbind 0 0
proc /proc proc rw,relatime 0 0
tmpfs /run tmpfs rw,nosuid,nodev,relatime,size=1640604k,mode=755 0 0
mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620 0 0
shm /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0
cgroup_root /sys/fs/cgroup tmpfs 
rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755 0 0
openrc /sys/fs/cgroup/openrc cgroup 
rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc
 0 0
cpuset /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
cpu /sys/fs/cgroup/cpu cgroup rw,nosuid,nodev,noexec,relatime,cpu 0 0
cpuacct /sys/fs/cgroup/cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct 0 0
freezer /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
/dev/mapper/vg7-atom / ext4 rw,relatime,commit=0 1 2

That probably has a lot more stuff in it than I need; I just removed the
things I certainly didn't need from a copy of the host mtab.

There's a similar init script and mtab for the other chroot.

I've no doubt all you systemd people will throw up your hands in dismay at the
work involved in setting that up. It didn't take long, really.

-- 
Regards
Peter


Reply via email to