From: Peter Humphrey <peter@prh.myzen.co.uk>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] What to put in chroot mtab
Date: Sat, 02 Aug 2014 11:08:30 +0100 [thread overview]
Message-ID: <1794742.fjLTEISsYR@wstn> (raw)
In-Reply-To: <CADPrc803EeGo4S=dhQNfefdCwLWUM-PRuE9SW63YDY2M3YAa-Q@mail.gmail.com>
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
next prev parent reply other threads:[~2014-08-02 10:08 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-01 13:07 [gentoo-user] What to put in chroot mtab Peter Humphrey
2014-08-01 13:12 ` Peter Humphrey
2014-08-01 13:28 ` Dale
2014-08-01 20:46 ` J. Roeleveld
2014-08-01 21:31 ` Canek Peláez Valdés
2014-08-01 21:33 ` Canek Peláez Valdés
2014-08-01 21:39 ` J. Roeleveld
2014-08-01 21:44 ` Canek Peláez Valdés
2014-08-01 21:46 ` Canek Peláez Valdés
2014-08-02 0:27 ` J. Roeleveld
2014-08-02 0:21 ` J. Roeleveld
2014-08-02 10:08 ` Peter Humphrey [this message]
2014-08-01 23:39 ` Dale
2014-08-01 14:56 ` Peter Humphrey
2014-08-01 15:00 ` Canek Peláez Valdés
2014-08-01 15:07 ` Rich Freeman
2014-08-01 15:25 ` Peter Humphrey
2014-08-01 15:21 ` Peter Humphrey
2014-08-01 15:29 ` Canek Peláez Valdés
2014-08-01 16:50 ` Peter Humphrey
2014-08-02 18:28 ` Rich Freeman
2014-08-01 14:02 ` Rich Freeman
2014-08-01 19:32 ` Neil Bothwick
2014-08-01 20:40 ` J. Roeleveld
2014-08-02 10:38 ` Peter Humphrey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1794742.fjLTEISsYR@wstn \
--to=peter@prh.myzen.co.uk \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox