man dchroot (Commandes) - enter a chroot environment


dchroot - enter a chroot environment


dchroot [OPTION]... [COMMAND]


dchroot allows the user to run a command or a login shell in a chroot environment. If no command is specified, a login shell will be started in the user's current working directory inside the chroot.

This version of dchroot is a compatibility wrapper around the schroot(1) program. It is provided for backward compatibility with the dchroot command-line options, but schroot is recommended for future use. See the section [lq]Migration[rq] below for help migrating your existing dchroot configuration to schroot. See the section [lq]Incompatibilities[rq] below for known incompatibilities with dchroot.

If no chroot is specified, the chroot name or alias default will be used as a fallback. If using the configuration in /etc/dchroot.conf, the first chroot in the file is the default.


Note that the original dchroot did not provide long options. dchroot accepts the following options:

Basic options

-h, --help
Show help summary.
-a, --all
Select all chroots.
-l, --list
List all available chroots.
-i, --info
Print detailed information about the specified chroots. Note that the original dchroot did not include this option.
-p, --path
Print location (path) of the specified chroots.
Print configuration of the specified chroots. This is useful for testing that the configuration in use is the same as the configuration file. Any comments in the original file will be missing. Note that the original dchroot did not include this option.
-d, --preserve-environment
Preserve the user's environment inside the chroot environment. The default is to use a clean environment; this option copies the entire user environment and sets it in the session.
-q, --quiet
Print only essential messages.
-v, --verbose
Print all messages. Note that the original dchroot did not include this option.
-V, --version
Print version information.


The original dchroot configuration file, /etc/dchroot.conf has the following format:

[oq]#[cq] starts a comment line.
Blank lines are ignored.
Chroot definitions are a single line containing an identifier and a path, separated by whitespace. The first chroot is also the default.

An example file:

CR]# Example comment


CR]sarge /srv/chroot/sarge

CR]sid /srv/chroot/sid

This file defines a chroot called [oq]sarge[cq], located at /srv/chroot/sarge, and a second chroot called [oq]sid[cq], located at /srv/chroot/sid.


Log messages are worded and formatted differently.
The parsing of /etc/dchroot.conf uses a smaller list of allowed whitespace characters (space and tab), which may cause a parse error during tokenising if the file contains odd characters as separators, such as carriage returns, vertical tabs and form feeds.
dchroot provides a restricted subset of the functionality implemented by schroot, but is still schroot underneath. Thus dchroot is still subject to schroot security checking, including PAM authentication and authorisation, and session management, for example, and hence may behave slightly differently to the original dchroot in some circumstances.


To migrate an existing dchroot configuration to schroot, perform the following steps:

Dump the dchroot configuration in schroot keyfile format to /etc/schroot/schroot.conf.

CR]# CB]dchroot --config >> /etc/schroot/schroot.conf

Edit /etc/schroot/schroot.conf to add access to the groups who are to be allowed to access the chroots, and make any other desired changes to the configuration. See schroot.conf(5).
Remove /etc/dchroot.conf, so that dchroot will subsequently use /etc/schroot/schroot.conf for its configuration. If the dchroot package is still installed, purge it, or else delete the file.


CR]$ schroot/dchroot -l

CR]Available chroots: sarge [default], sid


CR]$ schroot/dchroot -p sid



CR]$ dchroot -q -c sid -- uname -smr

CR]Linux ppc


CR]$ dchroot -c sid

CR]I: [sid chroot] Running login shell: [lq]/bin/bash[rq]


Use -- to allow options beginning with [oq]-[cq] or [oq]--[cq] in the command to run in the chroot. This prevents them being interpreted as options for schroot itself. Note that the top line was echoed to standard error, and the remaining lines to standard output. This is intentional, so that program output from commands run in the chroot may be piped and redirected as required; the data will be the same as if the command was run directly on the host system.


None known at this time.


The system-wide dchroot chroot definition file. This file must be owned by the root user, and not be writable by other. If present, this file will be used in preference to /etc/schroot/schroot.conf.
The system-wide schroot definition file. This file must be owned by the root user, and not be writable by other. It is recommended that this file be used in preference to /etc/dchroot.conf, because the chroots can be used interchangeably with schroot, and the group security policies provided by schroot are also enforced.


Roger Leigh.

This implementation of dchroot uses the same command-line options as the original dchroot by David Kimdon <>, but is an independent implementation.


Copyright © 2005-2006 Roger Leigh <>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.