Rechercher une page de manuel
dchroot
Langue: en
Version: 22 Aug 2010 (fedora - 01/12/10)
Section: 1 (Commandes utilisateur)
Sommaire
NAME
dchroot - enter a chroot environmentSYNOPSIS
dchroot [-h[or]--help [or] -V[or]--version [or] -l[or]--list [or] -i[or]--info [or] --config [or] --location] [--directory=directory] [-d[or]--preserve-environment] [-q[or]--quiet [or] -v[or]--verbose] [-c chroot[or]--chroot=chroot [or] --all] [COMMAND [ ARG1 [ ARG2 [ ARGn]]]]DESCRIPTION
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 home directory inside the chroot.The command is one or more arguments which will be run in the user's default shell using its -c option. As a result, shell code may be embedded in this argument. If multiple command options are used, they are concatenated together, separated by spaces. Users should be aware of the shell quoting issues this presents, and should use schroot if necessary, which does not have any quoting issues.
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 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 an existing dchroot configuration to schroot. See the section [lq]Incompatibilities[rq] below for known incompatibilities with older versions of dchroot.
If no chroot is specified, the chroot name or alias [oq]default[cq] will be used as a fallback. If using the configuration in /etc/dchroot.conf, the first chroot in the file is the default.
OPTIONS
dchroot accepts the following options:Basic options
- -h, --help
- Show help summary.
- -a, --all
- Select all chroots.
- -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.
- -l, --list
- List all available chroots.
- -i, --info
- Print detailed information about the specified chroots. Note that earlier versions of dchroot did not include this option.
- -p, --path
- Print location (path) of the specified chroots.
- --config
- 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 earlier versions of dchroot did not include this option.
- --directory=directory
- Change to directory inside the chroot before running the command or login shell. If directory is not available, dchroot will exit with an error status.
- The default behaviour is as follows (all directory paths are inside the chroot). Unless the --preserve-environment option is used to preserve the environment, the login shell or command will run in the user's home directory, or / if the home directory is not available. When the --preserve-environment option is used, it will attempt to use the current working directory, again falling back to / if it is not accessible. If none of the directories are available, dchroot will exit with an error status.
- -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 earlier versions of dchroot did not include this option.
- -V, --version
- Print version information.
Note that earlier versions of dchroot did not provide long options.
CONFIGURATION
The dchroot configuration file, /etc/dchroot.conf, used by earlier versions of dchroot, has the following format:- [bu]
- [oq]#[cq] starts a comment line.
- [bu]
- Blank lines are ignored.
- [bu]
- Chroot definitions are a single line containing an CBI]identifier, CBI]path, and an optional CBI]personality separated by whitespace.
- [bu]
- The first chroot is also the default chroot.
An example file:
- CR]# Example comment
CR]
CR]sarge /srv/chroot/sarge
CR]sid /srv/chroot/sid linux32
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. The second chroot uses the [oq]linux32[cq] personality, which allows a 32-bit chroot to be used on a 64-bit system. [oq]sarge[cq] is the default chroot, because it was listed first, which means if the -c option is omitted this chroot will be used.
INCOMPATIBILITIES
Debian dchroot prior to version 0.99.0
- [bu]
- Log messages are worded and formatted differently.
- [bu]
- 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.
- [bu]
- su(1) is no longer used to run commands in the chroot; this is done by dchroot internally. This change may cause subtle differences. If you find an incompatibility, please report it so it may be corrected.
- [bu]
- 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 older dchroot versions in some circumstances.
DSA dchroot
Machines run by the Debian System Administrators for the Debian Project have a dchroot-dsa package which provides an alternate dchroot implementation.- [bu]
- All the above incompatibilities apply.
- [bu]
- 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 not required to specify a chroot, and this version of dchroot cannot implement this behaviour in a backward-compatible manner (because if -c is omitted, the default chroot is used). DSA dchroot uses the first non-option as the chroot to use, only allowing one chroot to be used at once.
- [bu]
- This version of dchroot has an incompatible format for dchroot.conf. While the first two fields are the same, the remaining fields are an optional CBI]users, a list of users permitted to access the chroot, instead of the CI]personality field allowed by this version. If access restrictions are needed, please use /etc/schroot/schroot.conf and add the allowed users there, as shown in [lq]Migration[rq] below.
MIGRATION
To migrate an existing dchroot configuration to schroot, perform the following steps:- 1
- Dump the dchroot configuration in schroot keyfile format to /etc/schroot/schroot.conf.
- CR]# CB]dchroot --config >> /etc/schroot/schroot.conf
- 2
- Edit /etc/schroot/schroot.conf to add access to the users and/or groups which are to be allowed to access the chroots, and make any other desired changes to the configuration. See schroot.conf(5).
- 3
- Remove /etc/dchroot.conf, so that dchroot will subsequently use /etc/schroot/schroot.conf for its configuration.
EXAMPLES
CR]$ CB]dchroot -lCR]Available chroots: sarge [default], sid
CR]
CR]$ CB]dchroot -p sid
CR]/srv/chroot/sid
CR]
CR]$ CB]dchroot -q -c sid -- uname -smr
CR]Linux 2.6.16.17 ppc
CR]$ CB]dchroot -q -c sid -- "uname -smr"
CR]Linux 2.6.16.17 ppc
CR]
CR]$ CB]dchroot -q -c sid "ls -1 / | tac | head -n 4"
CR]var
CR]usr
CR]tmp
CR]sys
CR]
CR]$ CB]dchroot -c sid
CR]I: [sid chroot] Running login shell: [lq]/bin/bash[rq]
CR]$
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 dchroot 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.
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 [oq]none[cq], and [oq]notice[cq], [oq]info[cq], [oq]warning[cq] and [oq]critical[cq] 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:
CR]Debian buildd-tools Developers
<buildd-tools-devel@lists.alioth.debian.org>
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 [lq]Operation not permitted[rq] (EPERM) error. To work around this problem, set CI]personality to [oq]undefined[cq], or upgrade to a more recent kernel.FILES
- BI]/etc/dchroot.conf
- 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.
- BI]/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 user and group security policies provided by schroot are also enforced.
AUTHORS
Roger Leigh.This implementation of dchroot uses the same command-line options as the original dchroot by David Kimdon CR]<dwhedon@debian.org>, but is an independent implementation.
COPYRIGHT
Copyright © 2005-2010 Roger Leigh CR]<rleigh@debian.org>dchroot 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.
SEE ALSO
schroot(1), sbuild(1), chroot(2), schroot-setup(5), schroot.conf(5).Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre