Re: schroot help needed
On (10/11/06 09:53), Lubos Vrbka wrote:
> could anybody please show me how to setup schroot so, that it
> automatically bindmounts the /dev, /tmp and /home directories inside the
> chroot when it is entered? until now i was using permanent bind mount in
> my fstab. however, having the directories bindmounted only when the
> chroot is used seems to be a better idea. this should be possible in
> schroot, but i can't figure out how to set it up. probably
> schroot/exec.d/10mount needs to be somehow modified (or maybe some other
> file) but i don't know how. manpage is not of particular help for me in
> this respect :(
I've only done this setting up a chroot to run 32bit applications on a
64bit system but it should be equally applicable to your situation.
>From the amd64 howto:
http://alioth.debian.org/docman/view.php/30192/21/debian-amd64-howto.html
To run an application inside the chroot you will need some parts of
your 64bit system tree inside the chroot. This can be achieved with a
bind mount. In this example we will bind /tmp to the chroot for the X11
sockets which are in /tmp, and bind /home to access the home
directories from within the chroot. You may also want to mount the
/dev, /proc and /sys filesystems within the chroot. Edit your fstab and
add the required paths:
# sid32 chroot
/home /var/chroot/sid-ia32/home none bind 0 0
/tmp /var/chroot/sid-ia32/tmp none bind 0 0
/dev /var/chroot/sid-ia32/dev none bind 0 0
/proc /var/chroot/sid-ia32/proc none bind 0 0
Then mount them:
mount /var/chroot/sid-ia32/home
mount /var/chroot/sid-ia32/tmp
mount /var/chroot/sid-ia32/dev
mount /var/chroot/sid-ia32/proc
You will also need to set up the relevant users in the chroot. Copy
your /etc/passwd, /etc/shadow and /etc/group files to the chroot, or
add the users manually to the passwd/shadow of your chroot. It is also
possible to hard link the files when they are on the same partition.
Just make sure the user exists also in the chroot. To avoid locale
problems you might also want to set up /etc/environment.
WARNING! Remember that if you bind your home directory and delete your
chroot, all your personal data will be lost. So do not forget to umount
your home before eventually erasing a chroot.
Please note that if you are using schroot there are chances you can
avoid binding directories and copying or hard linking files. Check
schroot manpage and modify /etc/schroot/setup.d/10mount to match your
needs.
HTH
Regards
Clive
--
www.clivemenzies.co.uk ...
...strategies for business
Reply to: