dchroot-dsa(1) enter a chroot environment

SYNOPSIS

dchroot-dsa [-h|--help | -V|--version | -l|--list | -i|--info | --config | -p|--listpaths] [-d directory|--directory=directory] [-q|--quiet | -v|--verbose] [-c chroot|--chroot=chroot | --all | CHROOT] [COMMAND]

DESCRIPTION

dchroot-dsa 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 home directory inside the chroot.

The user's environment will be preserved inside the chroot.

The command is a single argument which must be an absolute path to the program. Additional options are not permitted.

The directory the command or login shell is run in depends upon the context. See --directory option below for a complete description.

This version of dchroot-dsa is a compatibility wrapper around the schroot(1) program. It is provided for backward compatibility with the dchroot-dsa command-line options, but schroot is recommended for future use. See the section "Incompatibilities" below for known incompatibilities with older versions of dchroot-dsa.

OPTIONS

dchroot-dsa accepts the following options:

Basic options

-h, --help
Show help summary.
-a, --all
Select all chroots. Note that earlier versions of dchroot-dsa did not include this option.
-c, --chroot=chroot
Specify a chroot to use. This option may be used multiple times to specify more than one chroot, in which case its effect is similar to --all. If this option is not used, the first non-option argument specified the chroot to use. Note that earlier versions of dchroot-dsa did not include this option.
-l, --list
List all available chroots.
-i, --info
Print detailed information about the available chroots. Note that earlier versions of dchroot-dsa did not include this option.
-p, --listpaths
Print absolute locations (paths) of the available chroots.
--config
Print configuration of the available 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 earlier versions of dchroot-dsa did not include this option.
-d, --directory=directory
Change to directory inside the chroot before running the command or login shell. If directory is not available, dchroot-dsa will exit with an error status.
The default behaviour (all directory paths are inside the chroot) is to run the login shell or command in the user's home directory, or / if the home directory is not available. If none of the directories are available, dchroot-dsa will exit with an error status.
-q, --quiet
Print only essential messages. Note that earlier versions of dchroot-dsa did not include this option.
-v, --verbose
Print all messages. Note that earlier versions of dchroot-dsa did not include this option.
-V, --version
Print version information.

CONFIGURATION

INCOMPATIBILITIES

Debian dchroot prior to version 1.5.1

  • This version of dchroot-dsa uses schroot.conf to store the configuration for available chroots, rather than the dchroot.conf file used historically. dchroot-dsa supported automatic migration of dchroot.conf to the schroot.conf keyfile format with its --config option from versions 0.2.2 to 1.5.0; support for the old format is now no longer available.

DSA dchroot

  • Log messages are worded and formatted differently.
  • dchroot-dsa provides a restricted subset of the functionality implemented by schroot, but is still schroot underneath. Thus dchroot-dsa is still subject to schroot security checking, including PAM authentication and authorisation, and session management, for example, and hence may behave slightly differently to earlier versions of dchroot-dsa in some circumstances.

Debian dchroot

A dchroot package provides an alternative dchroot implementation.
  • All the above incompatibilities apply.
  • This version of dchroot has incompatible command-line options, and while some of those options are supported or have equivalent options by a different name, the -c option is required to specify a chroot. It also allows a shell script to be used as the option instead of a single absolute path, and allows multiple command options instead of a single option.

DIRECTORY FALLBACKS

dchroot-dsa will select an appropriate directory to use within the chroot based upon whether the --directory option is used. When explicitly specifying a directory, only one directory will be used for safety and consistency, while for a login shell or command several possibilities may be tried. Note that due to multiple fallbacks being considered for commands, it is dangerous to run commands using dchroot-dsa; use schroot instead. The following subsections list the fallback sequence for each case. CWD is the current working directory, DIR is the directory specified with --directory.

Login shell or command

Transition
(Host → Chroot)Comment

CWD → passwd pw_dir Normal behaviour (if --directory is not used)
CWD → / If passwd pw_dir is nonexistent
FAIL If / is nonexistent

--directory used

Transition
(Host → Chroot)Comment

CWD → DIRNormal behaviour
FAILIf DIR is nonexistent

No fallbacks should exist under any circumstances.

Debugging

Note that --debug=notice will show the internal fallback list computed for the session.

EXAMPLES

$ dchroot-dsa -l␍ Available chroots: sarge, sid

$ dchroot-dsa --listpaths␍ /srv/chroot/sarge /srv/chroot/sid

$ dchroot-dsa -q sid -- /bin/uname␍ Linux

$ dchroot-dsa sid␍ I: [sid chroot] Running login shell: "/bin/bash" $

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.

TROUBLESHOOTING

If something is not working, and it's not clear from the error messages what is wrong, try using the --debug=level option to turn on debugging messages. This gives a great deal more information. Valid debug levels are 'none', and 'notice', 'info', 'warning' and 'critical' in order of increasing severity. The lower the severity level, the more output.

If you are still having trouble, the developers may be contacted on the mailing list:
Debian buildd-tools Developers
<[email protected]>

BUGS

On the mips and mipsel architectures, Linux kernels up to and including at least version 2.6.17 have broken personality(2) support, which results in a failure to set the personality. This will be seen as an "Operation not permitted" (EPERM) error. To work around this problem, set personality to 'undefined', or upgrade to a more recent kernel.

FILES

The system-wide schroot definition file. This file must be owned by the root user, and not be writable by other.

AUTHORS

Roger Leigh.

This implementation of dchroot-dsa uses the same command-line options as the dchroot found on machines run by the Debian System Administrators for the Debian Project. These machines have a dchroot-dsa source package which provides a dchroot-dsa package, written by Ben Collins <[email protected]> and Martin Schulze <[email protected]>.

COPYRIGHT

Copyright © 2005-2012 Roger Leigh <[email protected]>

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 3 of the License, or (at your option) any later version.