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 |
---|
19 | dchroot \- 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 |
---|
33 | environment. If no command is specified, a login shell will be started in the |
---|
34 | user's home directory inside the chroot. |
---|
35 | .PP |
---|
36 | The command is one or more arguments which will be run in the user's default |
---|
37 | shell using its \fI\-c\fP option. As a result, shell code may be embedded |
---|
38 | in this argument. If multiple command options are used, they are concatenated |
---|
39 | together, separated by spaces. Users should be aware of the shell quoting |
---|
40 | issues this presents, and should use \fBschroot\fP if necessary, which does not |
---|
41 | have any quoting issues. |
---|
42 | .PP |
---|
43 | The directory the command or login shell is run in depends upon the context. |
---|
44 | See \fI\-\-directory\fP option below for a complete description. |
---|
45 | .PP |
---|
46 | This version of dchroot is a compatibility wrapper around the |
---|
47 | .BR schroot (1) |
---|
48 | program. It is provided for backward compatibility with the dchroot |
---|
49 | command-line options, but schroot is recommended for future use. See the |
---|
50 | section \[lq]\fIMigration\fP\[rq] below for help migrating an existing dchroot |
---|
51 | configuration to schroot. See the section \[lq]\fIIncompatibilities\fP\[rq] |
---|
52 | below for known incompatibilities with older versions of dchroot. |
---|
53 | .PP |
---|
54 | If no chroot is specified, the chroot name or alias \[oq]default\[cq] will be |
---|
55 | used as a fallback. If using the configuration in \fI@DCHROOT_CONF@\fP, the |
---|
56 | first 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 |
---|
62 | Show help summary. |
---|
63 | .TP |
---|
64 | .BR \-a ", " \-\-all |
---|
65 | Select all chroots. |
---|
66 | .TP |
---|
67 | .BR \-c ", " \-\-chroot=\fIchroot\fP |
---|
68 | Specify a chroot to use. This option may be used multiple times to specify |
---|
69 | more than one chroot, in which case its effect is similar to \fI\-\-all\fP. |
---|
70 | .TP |
---|
71 | .BR \-l ", " \-\-list |
---|
72 | List all available chroots. |
---|
73 | .TP |
---|
74 | .BR \-i ", " \-\-info |
---|
75 | Print detailed information about the specified chroots. Note that earlier |
---|
76 | versions of dchroot did not include this option. |
---|
77 | .TP |
---|
78 | .BR \-p ", " \-\-path |
---|
79 | Print location (path) of the specified chroots. |
---|
80 | .TP |
---|
81 | .BR \-\-config |
---|
82 | Print configuration of the specified chroots. This is useful for testing that |
---|
83 | the configuration in use is the same as the configuration file. Any comments |
---|
84 | in the original file will be missing. Note that earlier versions of dchroot |
---|
85 | did not include this option. |
---|
86 | .TP |
---|
87 | .BR \-\-directory=\fIdirectory\fP |
---|
88 | Change to \fIdirectory\fP inside the chroot before running the command or login |
---|
89 | shell. If \fIdirectory\fP is not available, dchroot will exit with an error |
---|
90 | status. |
---|
91 | .IP |
---|
92 | The default behaviour is as follows (all directory paths are inside the |
---|
93 | chroot). Unless the \fI\-\-preserve\-environment\fP option is used to preserve |
---|
94 | the environment, the login shell or command will run in the user's home |
---|
95 | directory, 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 |
---|
97 | current working directory, again falling back to \fI/\fP if it is not |
---|
98 | accessible. If none of the directories are available, dchroot will exit with |
---|
99 | an error status. |
---|
100 | .TP |
---|
101 | .BR \-d ", " \-\-preserve\-environment |
---|
102 | Preserve the user's environment inside the chroot environment. The default is |
---|
103 | to use a clean environment; this option copies the entire user environment and |
---|
104 | sets it in the session. |
---|
105 | .TP |
---|
106 | .BR \-q ", " \-\-quiet |
---|
107 | Print only essential messages. |
---|
108 | .TP |
---|
109 | .BR \-v ", " \-\-verbose |
---|
110 | Print all messages. Note that earlier versions of dchroot did not include this |
---|
111 | option. |
---|
112 | .TP |
---|
113 | .BR \-V ", " \-\-version |
---|
114 | Print version information. |
---|
115 | .PP |
---|
116 | Note that earlier versions of dchroot did not provide long options. |
---|
117 | .SH CONFIGURATION |
---|
118 | The dchroot configuration file, \fI@DCHROOT_CONF@\fP, used by earlier versions |
---|
119 | of dchroot, has the following format: |
---|
120 | .IP \[bu] |
---|
121 | \[oq]#\[cq] starts a comment line. |
---|
122 | .IP \[bu] |
---|
123 | Blank lines are ignored. |
---|
124 | .IP \[bu] |
---|
125 | Chroot 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] |
---|
128 | The first chroot is also the default chroot. |
---|
129 | .PP |
---|
130 | An 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 |
---|
143 | This 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] |
---|
146 | personality, 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 |
---|
148 | if 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] |
---|
152 | Log messages are worded and formatted differently. |
---|
153 | .IP \[bu] |
---|
154 | The parsing of \fI@DCHROOT_CONF@\fP uses a smaller list of allowed whitespace |
---|
155 | characters (space and tab), which may cause a parse error during tokenising if |
---|
156 | the file contains odd characters as separators, such as carriage returns, |
---|
157 | vertical tabs and form feeds. |
---|
158 | .IP \[bu] |
---|
159 | .BR su (1) |
---|
160 | is no longer used to run commands in the chroot; this is done by dchroot |
---|
161 | internally. This change may cause subtle differences. If you find an |
---|
162 | incompatibility, please report it so it may be corrected. |
---|
163 | .IP \[bu] |
---|
164 | dchroot provides a restricted subset of the functionality implemented by |
---|
165 | \fBschroot\fP, but is still schroot underneath. Thus dchroot is still subject |
---|
166 | to schroot security checking, including PAM authentication and authorisation, |
---|
167 | and session management, for example, and hence may behave slightly differently |
---|
168 | to older dchroot versions in some circumstances. |
---|
169 | .SS DSA dchroot |
---|
170 | Machines 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] |
---|
173 | All the above incompatibilities apply. |
---|
174 | .IP \[bu] |
---|
175 | This version of dchroot has incompatible command-line options, and while some |
---|
176 | of those options are supported or have equivalent options by a different name, |
---|
177 | the \fI\-c\fP option is not required to specify a chroot, and this version of |
---|
178 | dchroot cannot implement this behaviour in a backward-compatible manner |
---|
179 | (because if \fI\-c\fP is omitted, the default chroot is used). DSA dchroot |
---|
180 | uses the first non-option as the chroot to use, only allowing one chroot to be |
---|
181 | used at once. |
---|
182 | .IP \[bu] |
---|
183 | This version of dchroot has an incompatible format for \fIdchroot.conf\fP. |
---|
184 | While 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 |
---|
187 | needed, please use \fI@SCHROOT_CONF@\fP and add the allowed users there, as |
---|
188 | shown in \[lq]\fIMigration\fP\[rq] below. |
---|
189 | .SH MIGRATION |
---|
190 | To migrate an existing \fBdchroot\fP configuration to \fBschroot\fP, perform |
---|
191 | the following steps: |
---|
192 | .IP 1 |
---|
193 | Dump 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 |
---|
202 | Edit \fI@SCHROOT_CONF@\fP to add access to the users and/or groups which are to |
---|
203 | be allowed to access the chroots, and make any other desired changes to the |
---|
204 | configuration. See |
---|
205 | .BR schroot.conf (5). |
---|
206 | .IP 3 |
---|
207 | Remove \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 |
---|
251 | Use \fI\-\-\fP to allow options beginning with \[oq]\-\[cq] or \[oq]\-\-\[cq] |
---|
252 | in the command to run in the chroot. This prevents them being interpreted as |
---|
253 | options for dchroot itself. Note that the top line was echoed to standard |
---|
254 | error, and the remaining lines to standard output. This is intentional, so |
---|
255 | that program output from commands run in the chroot may be piped and redirected |
---|
256 | as required; the data will be the same as if the command was run directly on |
---|
257 | the host system. |
---|
258 | .SH TROUBLESHOOTING |
---|
259 | If something is not working, and it's not clear from the error messages what is |
---|
260 | wrong, try using the \fB\-\-debug=\fP\fIlevel\fP option to turn on debugging |
---|
261 | messages. 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 |
---|
264 | level, the more output. |
---|
265 | .PP |
---|
266 | If you are still having trouble, the developers may be contacted on the mailing |
---|
267 | list: |
---|
268 | .br |
---|
269 | \f[CR]Debian\ buildd-tools\ Developers |
---|
270 | .br |
---|
271 | <buildd-tools-devel@lists.alioth.debian.org>\fP |
---|
272 | .SH BUGS |
---|
273 | On the \fBmips\fP and \fBmipsel\fP architectures, Linux kernels up to and |
---|
274 | including at least version 2.6.17 have broken |
---|
275 | .BR personality (2) |
---|
276 | support, which results in a failure to set the personality. This will be seen |
---|
277 | as an \[lq]Operation not permitted\[rq] (EPERM) error. To work around this |
---|
278 | problem, set \f[CI]personality\fP to \[oq]undefined\[cq], or upgrade to a more |
---|
279 | recent kernel. |
---|
280 | .SH FILES |
---|
281 | .TP |
---|
282 | \f[BI]@DCHROOT_CONF@\fP |
---|
283 | The system-wide \fBdchroot\fP chroot definition file. This file must be owned |
---|
284 | by the root user, and not be writable by other. If present, this file will be |
---|
285 | used in preference to \fI@SCHROOT_CONF@\fP. |
---|
286 | .TP |
---|
287 | \f[BI]@SCHROOT_CONF@\fP |
---|
288 | The system-wide \fBschroot\fP definition file. This file must be owned by the |
---|
289 | root user, and not be writable by other. It is recommended that this file be |
---|
290 | used in preference to \fI@DCHROOT_CONF@\fP, because the chroots can be used |
---|
291 | interchangeably with schroot, and the user and group security policies provided |
---|
292 | by schroot are also enforced. |
---|
293 | .SH AUTHORS |
---|
294 | Roger Leigh. |
---|
295 | .PP |
---|
296 | This implementation of dchroot uses the same command-line options as the |
---|
297 | original \fBdchroot\fP by David Kimdon \f[CR]<dwhedon@debian.org>\fP, but is an |
---|
298 | independent implementation. |
---|
299 | .SH COPYRIGHT |
---|
300 | Copyright \(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 |
---|
303 | the terms of the GNU General Public License as published by the Free Software |
---|
304 | Foundation, either version 3 of the License, or (at your option) any later |
---|
305 | version. |
---|
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: |
---|