From Gentoo Wiki
Jump to:navigation Jump to:search

schroot is a utility to securely enter and execute commands in a chroot environment.


USE flags

USE flags for dev-util/schroot Utility to execute commands in a chroot environment

btrfs Enable support for chroots using btrfs snapshots
dchroot Enables the building of a wrapper named "dchroot", replacing sys-apps/dchroot
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
lvm Enable support for chroots using LVM snapshots
nls Add Native Language Support (using gettext - GNU locale utilities)
pam Add support for PAM (Pluggable Authentication Modules) - DANGEROUS to arbitrarily flip
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
zfs Enable support for chroots using ZFS shapshots/clones


root #emerge --ask dev-util/schroot


Environment variables


  • /etc/schroot/schroot.conf - Global (system wide) configuration file.
  • /etc/schroot/chroot.d - A directory for additional chroot definitions. See the schroot man page for more details.
  • /etc/schroot/setup.d - The global setup script directory.
  • /etc/pam.d/schroot - A global PAM configuration directory.



user $schroot --help
  schroot  [OPTION…] [COMMAND] — run command or shell in a chroot

  -h [ --help ]                   Show help options
  -V [ --version ]                Print version information
  -l [ --list ]                   List available chroots
  -i [ --info ]                   Show information about selected chroots
  --config                        Dump configuration of selected chroots
  --location                      Print location of selected chroots

General options:
  -q [ --quiet ]                  Show less output
  -v [ --verbose ]                Show more output

Chroot selection:
  -c [ --chroot ] arg             Use specified chroot
  -a [ --all ]                    Select all chroots and active sessions
  --all-chroots                   Select all chroots
  --all-sessions                  Select all active sessions
  --all-source-chroots            Select all source chroots
  --exclude-aliases               Do not include aliases

Chroot environment:
  -d [ --directory ] arg          Directory to use
  -s [ --shell ] arg              Shell to use as login shell
  -u [ --user ] arg               Username (default current user)
  -p [ --preserve-environment ]   Preserve user environment
  -o [ --option ] arg             Set option

Session actions:
  --automatic-session             Begin, run and end a session automatically
  -b [ --begin-session ]          Begin a session; returns a session ID
  --recover-session               Recover an existing session
  -r [ --run-session ]            Run an existing session
  -e [ --end-session ]            End an existing session

Session options:
  -n [ --session-name ] arg       Session name (defaults to an automatically
                                  generated name)
  -f [ --force ]                  Force operation, even if it fails



root #emerge --ask --depclean --verbose dev-util/schroot

See also

External resources