Differences between revisions 24 and 25
Revision 24 as of 2012-03-08 01:28:53
Size: 1183
Editor: ?paynalton
Comment:
Revision 25 as of 2012-10-02 17:55:47
Size: 3490
Editor: ?CarlHopkins
Comment: Sync between French and English versions. Rough translation, will need cleanup.
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
'''chroot''' on Unix operating systems is an operation that changes the apparent root directory for the current running process and its children.''([[WikiPedia: en: chroot | Read more ...]])''
Line 5: Line 6:
All chroot does is, for all child processes, replace the root directory with the one specified.  <<TableOfContents(3)>>
Line 7: Line 8:
== Basic Installation ==
Build a "chroot" is very easy in Debian.
Line 8: Line 11:
== Setting up a network inside a chroot /tmp/custom/debian-live/chroot/ == You will need:
 * Install the required packages
{{{
 aptitude install binutils debootstrap
}}}

 * Choose a location
{{{
 mkdir-p / var / chroot / etch
}}}

 * Build the chroot
{{{
 debootstrap - arch i386 etch / var / chroot / etch
}}}

 * Recovery of an "image", decompression and installation of required packages

 * To enter:
{{{
  chroot / var / chroot / etch
}}}

== Configuration ==
In general, it is necessary to create / edit key configuration points

Configuring a chroot is relatively static and very specific, it may be possible to dispense with the command "top-level" and directly edit files.

 * Users defined in the chroot
{{{
  / Etc / passwd
  / Etc / groups
}}}

 * Settings network settings
{{{
  / Etc / hosts
  / Etc / resolv.conf
}}}

 * Mounts filesystems
{{{
  / Etc / fstab
}}}

== Mounting pseudo filesystems ==

=== / Proc ===
 * Check the chrooted system the presence of / proc if the chroot is not likely to be fully operational. A priori, since version debootstrap Debian / Etch integrates natively mount / proc and / sys
{{{
 proc on / proc type proc (rw)
 sysfs on / sys sysfs kind (rw)
}}}

=== / Dev / pts ===

 * It is also advisable to do a "bind" / dev / pts. This prevents error messages like {{{Must be connected to a terminal}}} or {{{Can not access '/ dev/pts/0': No such file or directory of this type}}} with using the control debpkg: screen.

In this case, the primary system, run the command:
{{{
 mount - bind / dev / pts / var / chroot / etch / dev / pts
}}}

=== Default Configurations ===

Generally the file {{{/etc/fstab}}} might look like this:
Line 11: Line 79:
# mount -o bind /sys /tmp/custom/debian-live/chroot/sys
# mount -o bind /proc /tmp/custom/debian-live/chroot/proc
# chroot /tmp/custom/debian-live/chroot/
}}}
Now in the chroot you might need to reset the [[Network|network]] in order for the route/dns stuff to be setup.
{{{
# dhclient eth0
# Cat / etc / fstab | grep chroot
/ Dev / var / chroot / etch / dev auto bind 0 0
/ Dev / pts / var / chroot / etch / dev / pts auto bind 0 0
/ Proc / var / chroot / etch / proc auto bind 0 0
Line 20: Line 85:
This is useful for testing and configuring a system that is to be deployed, e.g.[[DebianLive]]. Therefore mount on the primary system would be:
{{{
# Mount | grep chroot
/ Dev on / var / chroot / etch / dev-type none (rw, bind)
/ Dev / pts on / var / chroot / etch / dev / pts kind none (rw, bind)
/ Proc on / var / chroot / etch / proc type none (rw, bind)
}}}
Line 22: Line 93:
<<Anchor(BuildAChroot)>>
== Build a chroot ==
 * [[Debootstrap]] : Setting up another complete Debian install inside a chroot.
== Adding / removing packages ==
Line 26: Line 95:
 * Eliminate unnecessary packages (all depends on the purpose of the chroot)
{{{
  aptitude install deborphan
}}}
{{{
  deborphan-a
}}}
Line 27: Line 103:
== See also ==
 * Debian reference has some [[http://www.debian.org/doc/manuals/reference/ch09#_chroot_system|"chroot" tips]].
 * [[DebianInstaller]]
 * Wikipedia WikiPedia:Chroot
 * And for example
{{{
  aptitude remove - purge telnet manpages pppconfig ipchains ...
}}}

'' Complementary'' list svgalibg1 whiptail

 * Add a little comfort
{{{
  sudo aptitude install emacs21 local mc
}}}

== Usage ==
Common examples of chroot usage:

 * Recompiling application in a context other than the machine that hosts the chroot ([[Backports | backport]], cross-compiling, ...)

 * Update service production by tilting the old service (host machine) to the new (installed in the chroot)

 * Securing a service "chrooted" from the host machine (and vice versa)
Line 32: Line 125:
ToDo: [[fr/Chroot|Sync with french version]] ToDo - Clean up from French translation.

Translation(s): Deutsch - English - Français - Italiano - Español


chroot on Unix operating systems is an operation that changes the apparent root directory for the current running process and its children.(Read more ...)

Basic Installation

Build a "chroot" is very easy in Debian.

You will need:

 aptitude install binutils debootstrap

 mkdir-p / var / chroot / etch

 debootstrap - arch i386 etch / var / chroot / etch

  chroot / var / chroot / etch

Configuration

In general, it is necessary to create / edit key configuration points

Configuring a chroot is relatively static and very specific, it may be possible to dispense with the command "top-level" and directly edit files.

  / Etc / passwd
  / Etc / groups

  / Etc / hosts
  / Etc / resolv.conf

  / Etc / fstab

Mounting pseudo filesystems

/ Proc

 proc on / proc type proc (rw)
 sysfs on / sys sysfs kind (rw)

/ Dev / pts

In this case, the primary system, run the command:

 mount - bind / dev / pts / var / chroot / etch / dev / pts

Default Configurations

Generally the file /etc/fstab might look like this:

# Cat / etc / fstab | grep chroot
/ Dev / var / chroot / etch / dev auto bind 0 0
/ Dev / pts / var / chroot / etch / dev / pts auto bind 0 0
/ Proc / var / chroot / etch / proc auto bind 0 0

Therefore mount on the primary system would be:

# Mount | grep chroot
/ Dev on / var / chroot / etch / dev-type none (rw, bind)
/ Dev / pts on / var / chroot / etch / dev / pts kind none (rw, bind)
/ Proc on / var / chroot / etch / proc type none (rw, bind)

Adding / removing packages

  aptitude install deborphan

  deborphan-a

  aptitude remove - purge telnet manpages pppconfig ipchains ...

Complementary list svgalibg1 whiptail

  sudo aptitude install emacs21 local mc

Usage

Common examples of chroot usage:


ToDo - Clean up from French translation.