Differences between revisions 11 and 12
Revision 11 as of 2012-04-02 09:00:54
Size: 2718
Editor: CraigHesling
Comment:
Revision 12 as of 2013-09-15 18:12:27
Size: 2547
Editor: GeoffSimmons
Comment: Drop Kde4schroot references (outdated page), use DebianMan, update InterWiki.
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
~+Schroot+~ allows users to execute commands or interactive shells in different [[chroot|chroots]] (see DebPkg:schroot). ~+Schroot+~ allows users to execute commands or interactive shells in different [[chroot|chroots]] (see DebianPkg:schroot).
Line 8: Line 8:
 *More info: [[sudo]], http://linux.die.net/man/1/su  *More info: [[sudo]], [[DebianMan:1/su|su(1)]]
Line 15: Line 15:
DebPkg:debootstrap is used to install a Debian base system(the new root), for the example below. DebianPkg:debootstrap is used to install a Debian base system(the new root), for the example below.
Line 94: Line 94:
ToDo : This page is a place holder. Please re-use the content of [[Kde4schroot]] to make it a generic example.
Line 97: Line 95:
 * [[Kde4schroot]] - How-to set up a schroot to run KDE4

Schroot allows users to execute commands or interactive shells in different chroots (see schroot).

Unless otherwise stated, all commands presented on this page must be executed as root.

So, either run them as sudo <command>, or switch to root at the beginning by typing su.

Installation

apt-get install schroot

debootstrap is used to install a Debian base system(the new root), for the example below.

apt-get install debootstrap

Setup

  • Configuration file: /etc/schroot/schroot.conf

  • If you prefer separate configuration files, place them in /etc/schroot/chroot.d/.

Example

A simple example that creates a chroot and installs <some-package> for an X windows environment. This is not the safest nor a standard way of setup.

Backup:

cp /etc/schroot/schroot.conf /etc/schroot/schroot.conf.old

Create root file system:

mkdir -p /srv/chroot/test
debootstrap wheezy /srv/chroot/test

Replace the contents of /etc/schroot/schroot.conf with the following:

# schroot chroot definitions.
# See schroot.conf(5) for complete documentation of the file format.
#
# Please take note that you should not add untrusted users to
# root-groups, because they will essentially have full root access
# to your system.  They will only have root access inside the chroot,
# but that's enough to cause malicious damage.
#
# The following lines are examples only.  Uncomment and alter them to
# customise schroot for your needs, or create a new entry from scratch.
#
#
[wheezy-test]
description=Contains the SPICE program
aliases=test
type=directory
directory=/srv/chroot/test
users=jsmith
root-groups=root
script-config=desktop/config
personality=linux
preserve-environment=true

Where jsmith is an underprivileged user.

schroot -c test

W: Failed to change to directory '/ ... is ok.

apt-get update && apt-get install <some-package>
exit

As the user jsmith execute:

xhost +
schroot -ctest

From this point the <some-package> could be used...

Or,

xhost +
SESH=$(schroot -ctest -b)
schroot -r -c $SESH
schroot -e -c $SESH


See Also :