source: trunk/debathena/third/schroot/man/dchroot.1.in @ 24167

Revision 24167, 11.9 KB checked in by broder, 15 years ago (diff)
Import schroot upstream into subversion.
Line 
1.\" Copyright © 2005-2007  Roger Leigh <rleigh@debian.org>
2.\"
3.\" schroot is free software: you can redistribute it and/or modify it
4.\" under the terms of the GNU General Public License as published by
5.\" the Free Software Foundation, either version 3 of the License, or
6.\" (at your option) any later version.
7.\"
8.\" schroot is distributed in the hope that it will be useful, but
9.\" WITHOUT ANY WARRANTY; without even the implied warranty of
10.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11.\" General Public License for more details.
12.\"
13.\" You should have received a copy of the GNU General Public License
14.\" along with this program.  If not, see
15.\" <http://www.gnu.org/licenses/>.
16.\"
17.TH DCHROOT 1 "@RELEASE_DATE@" "Version @VERSION@" "Debian sbuild"
18.SH NAME
19dchroot \- enter a chroot environment
20.SH SYNOPSIS
21.B dchroot
22.RB [ \-h \[or] \-\-help " \[or] " \-V \[or] \-\-version
23.RB " \[or] " \-l \[or] \-\-list " \[or] " \-i \[or] \-\-info
24.RB " \[or] " \-\-config " \[or] " \-\-location ]
25.RB [ "\-\-directory=\fIdirectory\fP" ]
26.RB [ \-d \[or] \-\-preserve\-environment ]
27.RB [ \-q \[or] \-\-quiet " \[or] " \-v \[or] \-\-verbose ]
28.RB [ "\-c \fIchroot\fP" \[or] "\-\-chroot=\fIchroot\fP"
29.RB " \[or] " \-\-all ]
30.RB [ COMMAND " [ " ARG1 " [ " ARG2 " [ " ARGn ]]]]
31.SH DESCRIPTION
32\fBdchroot\fP allows the user to run a command or a login shell in a chroot
33environment.  If no command is specified, a login shell will be started in the
34user's home directory inside the chroot.
35.PP
36The command is one or more arguments which will be run in the user's default
37shell using its \fI\-c\fP option.  As a result, shell code may be embedded
38in this argument.  If multiple command options are used, they are concatenated
39together, separated by spaces.  Users should be aware of the shell quoting
40issues this presents, and should use \fBschroot\fP if necessary, which does not
41have any quoting issues.
42.PP
43The directory the command or login shell is run in depends upon the context.
44See \fI\-\-directory\fP option below for a complete description.
45.PP
46This version of dchroot is a compatibility wrapper around the
47.BR schroot (1)
48program.  It is provided for backward compatibility with the dchroot
49command-line options, but schroot is recommended for future use.  See the
50section \[lq]\fIMigration\fP\[rq] below for help migrating an existing dchroot
51configuration to schroot.  See the section \[lq]\fIIncompatibilities\fP\[rq]
52below for known incompatibilities with older versions of dchroot.
53.PP
54If no chroot is specified, the chroot name or alias \[oq]default\[cq] will be
55used as a fallback.  If using the configuration in \fI@DCHROOT_CONF@\fP, the
56first chroot in the file is the default.
57.SH OPTIONS
58\fBdchroot\fP accepts the following options:
59.SS Basic options
60.TP
61.BR \-h ", " \-\-help
62Show help summary.
63.TP
64.BR \-a ", " \-\-all
65Select all chroots.
66.TP
67.BR \-c ", " \-\-chroot=\fIchroot\fP
68Specify a chroot to use.  This option may be used multiple times to specify
69more than one chroot, in which case its effect is similar to \fI\-\-all\fP.
70.TP
71.BR \-l ", " \-\-list
72List all available chroots.
73.TP
74.BR \-i ", " \-\-info
75Print detailed information about the specified chroots.  Note that earlier
76versions of dchroot did not include this option.
77.TP
78.BR \-p ", " \-\-path
79Print location (path) of the specified chroots.
80.TP
81.BR \-\-config
82Print configuration of the specified chroots.  This is useful for testing that
83the configuration in use is the same as the configuration file.  Any comments
84in the original file will be missing.  Note that earlier versions of dchroot
85did not include this option.
86.TP
87.BR \-\-directory=\fIdirectory\fP
88Change to \fIdirectory\fP inside the chroot before running the command or login
89shell.  If \fIdirectory\fP is not available, dchroot will exit with an error
90status.
91.IP
92The default behaviour is as follows (all directory paths are inside the
93chroot).  Unless the \fI\-\-preserve\-environment\fP option is used to preserve
94the environment, the login shell or command will run in the user's home
95directory, or \fI/\fP if the home directory is not available.  When the
96\fI\-\-preserve\-environment\fP option is used, it will attempt to use the
97current working directory, again falling back to \fI/\fP if it is not
98accessible.  If none of the directories are available, dchroot will exit with
99an error status.
100.TP
101.BR \-d ", " \-\-preserve\-environment
102Preserve the user's environment inside the chroot environment.  The default is
103to use a clean environment; this option copies the entire user environment and
104sets it in the session.
105.TP
106.BR \-q ", " \-\-quiet
107Print only essential messages.
108.TP
109.BR \-v ", " \-\-verbose
110Print all messages.  Note that earlier versions of dchroot did not include this
111option.
112.TP
113.BR \-V ", " \-\-version
114Print version information.
115.PP
116Note that earlier versions of dchroot did not provide long options.
117.SH CONFIGURATION
118The dchroot configuration file, \fI@DCHROOT_CONF@\fP, used by earlier versions
119of dchroot, has the following format:
120.IP \[bu]
121\[oq]#\[cq] starts a comment line.
122.IP \[bu]
123Blank lines are ignored.
124.IP \[bu]
125Chroot definitions are a single line containing an \f[CBI]identifier\fP,
126\f[CBI]path\fP, and an optional \f[CBI]personality\fP separated by whitespace.
127.IP \[bu]
128The first chroot is also the default chroot.
129.PP
130An example file:
131.PP
132.RS
133\f[CR]# Example comment\fP
134.br
135\f[CR]\fP
136.br
137\f[CR]sarge /srv/chroot/sarge\fP
138.br
139\f[CR]sid /srv/chroot/sid linux32\fP
140.br
141.RE
142.PP
143This file defines a chroot called \[oq]sarge\[cq], located at
144\fI/srv/chroot/sarge\fP, and a second chroot called \[oq]sid\[cq], located at
145\fI/srv/chroot/sid\fP.  The second chroot uses the \[oq]linux32\[cq]
146personality, which allows a 32-bit chroot to be used on a 64-bit system.
147\[oq]sarge\[cq] is the default chroot, because it was listed first, which means
148if the \fI\-c\fP option is omitted this chroot will be used.
149.SH INCOMPATIBILITIES
150.SS Debian dchroot prior to version 0.99.0
151.IP \[bu]
152Log messages are worded and formatted differently.
153.IP \[bu]
154The parsing of \fI@DCHROOT_CONF@\fP uses a smaller list of allowed whitespace
155characters (space and tab), which may cause a parse error during tokenising if
156the file contains odd characters as separators, such as carriage returns,
157vertical tabs and form feeds.
158.IP \[bu]
159.BR su (1)
160is no longer used to run commands in the chroot; this is done by dchroot
161internally.  This change may cause subtle differences.  If you find an
162incompatibility, please report it so it may be corrected.
163.IP \[bu]
164dchroot provides a restricted subset of the functionality implemented by
165\fBschroot\fP, but is still schroot underneath.  Thus dchroot is still subject
166to schroot security checking, including PAM authentication and authorisation,
167and session management, for example, and hence may behave slightly differently
168to older dchroot versions in some circumstances.
169.SS DSA dchroot
170Machines run by the Debian System Administrators for the Debian Project have a
171\fBdchroot-dsa\fP package which provides an alternate dchroot implementation.
172.IP \[bu]
173All the above incompatibilities apply.
174.IP \[bu]
175This version of dchroot has incompatible command-line options, and while some
176of those options are supported or have equivalent options by a different name,
177the \fI\-c\fP option is not required to specify a chroot, and this version of
178dchroot cannot implement this behaviour in a backward-compatible manner
179(because if \fI\-c\fP is omitted, the default chroot is used).  DSA dchroot
180uses the first non-option as the chroot to use, only allowing one chroot to be
181used at once.
182.IP \[bu]
183This version of dchroot has an incompatible format for \fIdchroot.conf\fP.
184While the first two fields are the same, the remaining fields are an optional
185\f[CBI]users\fP, a list of users permitted to access the chroot, instead of the
186\f[CI]personality\fP field allowed by this version.  If access restrictions are
187needed, please use \fI@SCHROOT_CONF@\fP and add the allowed users there, as
188shown in \[lq]\fIMigration\fP\[rq] below.
189.SH MIGRATION
190To migrate an existing \fBdchroot\fP configuration to \fBschroot\fP, perform
191the following steps:
192.IP 1
193Dump the dchroot configuration in schroot keyfile format to
194\fI@SCHROOT_CONF@\fP.
195.PP
196.RS
197\f[CR]# \f[CB]dchroot --config >> @SCHROOT_CONF@
198.br
199.RE
200.PP
201.IP 2
202Edit \fI@SCHROOT_CONF@\fP to add access to the users and/or groups which are to
203be allowed to access the chroots, and make any other desired changes to the
204configuration.  See
205.BR schroot.conf (5).
206.IP 3
207Remove \fI@DCHROOT_CONF@\fP, so that dchroot will subsequently use
208\fI@SCHROOT_CONF@\fP for its configuration.
209.SH EXAMPLES
210\f[CR]$ \f[CB]dchroot \-l\fP\fP
211.br
212\f[CR]Available chroots: sarge [default], sid\fP
213.br
214\f[CR]\fP
215.br
216\f[CR]$ \f[CB]dchroot \-p sid\fP\fP
217.br
218\f[CR]/srv/chroot/sid\fP
219.br
220\f[CR]\fP
221.br
222\f[CR]$ \f[CB]dchroot \-q \-c sid \-\- uname \-smr\fP\fP
223.br
224\f[CR]Linux 2.6.16.17 ppc\fP
225.br
226\f[CR]$ \f[CB]dchroot \-q \-c sid \-\- "uname \-smr"\fP\fP
227.br
228\f[CR]Linux 2.6.16.17 ppc\fP
229.br
230\f[CR]\fP
231.br
232\f[CR]$ \f[CB]dchroot -q -c sid "ls -1 / | tac | head -n 4"\fP\fP
233.br
234\f[CR]var\fP
235.br
236\f[CR]usr\fP
237.br
238\f[CR]tmp\fP
239.br
240\f[CR]sys\fP
241.br
242\f[CR]\fP
243.br
244\f[CR]$ \f[CB]dchroot \-c sid\fP\fP
245.br
246\f[CR]I: [sid chroot] Running login shell: \[lq]/bin/bash\[rq]\fP
247.br
248\f[CR]$ \fP
249.br
250.LP
251Use \fI\-\-\fP to allow options beginning with \[oq]\-\[cq] or \[oq]\-\-\[cq]
252in the command to run in the chroot.  This prevents them being interpreted as
253options for dchroot itself.  Note that the top line was echoed to standard
254error, and the remaining lines to standard output.  This is intentional, so
255that program output from commands run in the chroot may be piped and redirected
256as required; the data will be the same as if the command was run directly on
257the host system.
258.SH TROUBLESHOOTING
259If something is not working, and it's not clear from the error messages what is
260wrong, try using the \fB\-\-debug=\fP\fIlevel\fP option to turn on debugging
261messages.  This gives a great deal more information.  Valid debug levels are
262\[oq]none\[cq], and \[oq]notice\[cq], \[oq]info\[cq], \[oq]warning\[cq] and
263\[oq]critical\[cq] in order of increasing severity.  The lower the severity
264level, the more output.
265.PP
266If you are still having trouble, the developers may be contacted on the mailing
267list:
268.br
269\f[CR]Debian\ buildd-tools\ Developers
270.br
271<buildd-tools-devel@lists.alioth.debian.org>\fP
272.SH BUGS
273On the \fBmips\fP and \fBmipsel\fP architectures, Linux kernels up to and
274including at least version 2.6.17 have broken
275.BR personality (2)
276support, which results in a failure to set the personality.  This will be seen
277as an \[lq]Operation not permitted\[rq] (EPERM) error.  To work around this
278problem, set \f[CI]personality\fP to \[oq]undefined\[cq], or upgrade to a more
279recent kernel.
280.SH FILES
281.TP
282\f[BI]@DCHROOT_CONF@\fP
283The system-wide \fBdchroot\fP chroot definition file.  This file must be owned
284by the root user, and not be writable by other.  If present, this file will be
285used in preference to \fI@SCHROOT_CONF@\fP.
286.TP
287\f[BI]@SCHROOT_CONF@\fP
288The system-wide \fBschroot\fP definition file.  This file must be owned by the
289root user, and not be writable by other.  It is recommended that this file be
290used in preference to \fI@DCHROOT_CONF@\fP, because the chroots can be used
291interchangeably with schroot, and the user and group security policies provided
292by schroot are also enforced.
293.SH AUTHORS
294Roger Leigh.
295.PP
296This implementation of dchroot uses the same command-line options as the
297original \fBdchroot\fP by David Kimdon \f[CR]<dwhedon@debian.org>\fP, but is an
298independent implementation.
299.SH COPYRIGHT
300Copyright \(co 2005\-2007  Roger Leigh \f[CR]<rleigh@debian.org>\fP
301.PP
302\fBdchroot\fP is free software: you can redistribute it and/or modify it under
303the terms of the GNU General Public License as published by the Free Software
304Foundation, either version 3 of the License, or (at your option) any later
305version.
306.SH SEE ALSO
307.BR schroot (1),
308.BR sbuild (1),
309.BR chroot (2),
310.BR schroot-setup (5),
311.BR schroot.conf (5).
312.\"#
313.\"# The following sets edit modes for GNU EMACS
314.\"# Local Variables:
315.\"# mode:nroff
316.\"# fill-column:79
317.\"# End:
Note: See TracBrowser for help on using the repository browser.