View previous topic :: View next topic |
Author |
Message |
Sadako Advocate
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Tue Sep 20, 2005 1:52 am Post subject: Other possible 32bit chroot mount binds? |
|
|
Okay, I started with the init script given here, added a few things and changed a few things around, and finally have it working nicely.
However, I was wondering if anyone can suggest any others or see anything intrinsically wrong with what I have;
Code: | #! /sbin/runscript
depend() {
need localmount
need bootmisc
}
start() {
ebegin "Mounting 32bit chroot directories..."
mount /32bit
mount -t proc none /32bit/proc >/dev/null
mount -o bind /proc/bus/usb /32bit/proc/bus/usb >/dev/null &
mount -o bind /dev /32bit/dev >/dev/null
mount -o bind /dev/pts /32bit/dev/pts >/dev/null &
mount -o bind /sys /32bit/sys >/dev/null &
mount -o bind /mnt /32bit/mnt >/dev/null &
mount -o bind /root /32bit/root >/dev/null &
mount -o bind /usr/portage /32bit/usr/portage >/dev/null
mount -o bind /usr/portage/distfiles /32bit/usr/portage/distfiles >/dev/null &
mount -o bind,ro /usr/src /32bit/usr/src >/dev/null &
mount -o bind,ro /usr/share/themes /32bit/usr/share/themes >/dev/null &
mount -o bind,ro /usr/lib/X11/fonts /32bit/usr/lib/X11/fonts >/dev/null &
mount -o bind /tmp /32bit/tmp >/dev/null &
mount -o bind /home /32bit/home >/dev/null
mount -o bind,ro /home/music /32bit/home/music >/dev/null &
eend $? "An error occurred while mounting 32bit chroot directories"
ebegin "Copying 32bit chroot files"
cp -pf /etc/resolv.conf /32bit/etc >/dev/null &
cp -pf /etc/passwd /32bit/etc >/dev/null &
cp -pf /etc/shadow /32bit/etc >/dev/null &
cp -pf /etc/group /32bit/etc >/dev/null &
cp -pf /etc/gshadow /32bit/etc >/dev/null &
cp -pf /etc/hosts /32bit/etc >/dev/null &
cp -pf /etc/sudoers /32bit/etc >/dev/null &
cp -Ppf /etc/localtime /32bit/etc >/dev/null &
eend $? "An error occurred while copying 32bit chroot files."
}
stop() {
ebegin "Unmounting 32bit chroot directories..."
umount /32bit/proc/bus/usb >/dev/null
umount /32bit/proc >/dev/null &
umount /32bit/dev/pts >/dev/null
umount /32bit/dev >/dev/null &
umount /32bit/sys >/dev/null &
umount /32bit/mnt >/dev/null &
umount /32bit/root >/dev/null &
umount /32bit/usr/share/themes >/dev/null &
umount /32bit/usr/lib/X11/fonts >/dev/null &
umount /32bit/usr/portage/distfiles >/dev/null
umount /32bit/usr/portage >/dev/null &
umount /32bit/usr/src >/dev/null &
umount /32bit/tmp >/dev/null &
umount /32bit/home/music >/dev/null
umount /32bit/home >/dev/null
sleep 1 && umount /32bit >/dev/null &
eend $? "An error occurred while unmounting 32bit chroot directories"
} |
I stopped backgrounding any which needed to be mounted or unmounted before something else, as this was causing problems.
The fonts mount is nice, as even though you have to emerge xorg, you can do so without the font use flags to save space, and coupled with USE="minimal", it makes for a pretty small install.
Same goes for the themes directory, and I was thinking you could just mount /usr/share altogether, but you'd have to unmount it when emerging anything and then delete anything added to /usr/share within the chroot to see realise the benefit, so it's probably not worth the hassle.
I'm not so sure aout the src mount, though.
(I know most wont have any use for the music or distfiles mounts, but I have these on separate partitions).
Edit;
Forgot to add, Code: | alias lsmount="mount | grep -v bind" | gives you the normal mount listing without all the bind mounts clutering things up.
Any other tips/tricks? _________________ "You have to invite me in" |
|
Back to top |
|
|
Voyageur Developer
Joined: 06 Mar 2005 Posts: 342 Location: Paris, France
|
Posted: Tue Sep 20, 2005 11:55 am Post subject: |
|
|
Code: | mount -o bind /usr/portage /32bit/usr/portage >/dev/null
mount -o bind /usr/portage/distfiles /32bit/usr/portage/distfiles >/dev/null & |
Since you already bind /usr/portage, you don't need to bind its sub-directory /usr/portage/distfiles
I also added /usr/local/portage, and all of /usr/share (not just themes). So far so good here _________________ Routinely breaking NX, GNUstep, net-ftp, miscellaneous (llvm, filezilla, rdesktop, chromium, ...) packages |
|
Back to top |
|
|
Sadako Advocate
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Tue Sep 20, 2005 3:51 pm Post subject: |
|
|
Voyageur wrote: | Code: | mount -o bind /usr/portage /32bit/usr/portage >/dev/null
mount -o bind /usr/portage/distfiles /32bit/usr/portage/distfiles >/dev/null & |
Since you already bind /usr/portage, you don't need to bind its sub-directory /usr/portage/distfiles |
That's how I thought it should work too, however I have distfiles on a separate partition and after running the script ls /32bit/usr/portage/distfiles showed the contents of the near empty /usr/portage/distfiles directory/mount point.
Now that I think about it though, I haven't tried it since I stopped backgrounded the previous mount, so maybe that was the problem. I'll test it out when I get home.
Voyageur wrote: | I also added /usr/local/portage, and all of /usr/share (not just themes). So far so good here |
Are you not worried about overwriting or removing something from your 64-bit install, or do you mount it read only? _________________ "You have to invite me in" |
|
Back to top |
|
|
Voyageur Developer
Joined: 06 Mar 2005 Posts: 342 Location: Paris, France
|
Posted: Tue Sep 20, 2005 7:07 pm Post subject: |
|
|
Quote: | I have distfiles on a separate partition |
Ah ok then I'm not so sure anymore that the second mount doesn't serve its purpose (but who knows with this nifty bind option)
Quote: | Are you not worried about overwriting or removing something from your 64-bit install, or do you mount it read only? |
Well /usr/share is supposed to only house "independant-platform" files like data, man pages, docs, ... And it sure helps limiting the size of the chroot (mounted read-write to make portage happy).
But don't take my word on it, this is my "let's see if I'll break it" box, so I can't guarantee it won't make your box blow up _________________ Routinely breaking NX, GNUstep, net-ftp, miscellaneous (llvm, filezilla, rdesktop, chromium, ...) packages |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|