Package: debian-reference
Severity: wishlist
Tags: patch

Hi,

I'd suggest adding some material to the dchroot section, including notes
about about bind mounts, dchroot, and prompt configuration. I've found all
this information extremely useful.

See included patch (generated using mercurial), against the text version of
the English Debian reference manual (version in Sarge). I've not tried very
hard to integrate this into the material, so this patch is intended as an
example only, but it would be cool if similar material could be included in
whatever form.
   
Thanks.                                                            Faheem.

diff -r 01cb008e3db4 reference.en.txt
--- a/reference.en.txt  Thu Dec  1 00:43:18 2005
+++ b/reference.en.txt  Wed Nov 30 21:46:40 2005
@@ -6991,6 +6991,27 @@
           chroot # vi /etc/apt/sources.list # point the source to unstable
           chroot # dselect  # you may use aptitude, install mc and vim :-)
 
+     Since you will probably want to use your 'main' home directory
+     from within the chroot, you can bind your home directory to the chroot 
home directory
+     
+     You also need to bind the 'main' /tmp to the chroot /tmp in order
+     for X forwarding to work.
+
+     For example, you could add the following to your 'main'
+     /etc/fstab.
+
+     /home           /sid-root/home none  bind            0       0
+     /tmp            /sid-root/tmp none   bind            0       0
+
+
+     In addition, a simple method of making sure that the same users
+     and groups are available in the chroot as in 'main' is to add the
+     following to /etc/fstab.
+
+     /etc/passwd     /sid-root/etc/passwd        ext3    bind,defaults        
0       0
+     /etc/shadow     /sid-chroot/etc/shadow        ext3    bind,defaults       
 0       0
+     /etc/group      /sid-chroot/etc/group         ext3    bind,defaults       
 0       0
+
      At this point you should have a fully working Debian system, where you
      can play around without fear of affecting your main Debian
      installation.
@@ -6999,6 +7020,51 @@
      system without using a Debian install disk, but instead one for
      another GNU/Linux distribution.  See
      http://www.debian.org/releases/stable/i386/ch-preparing#s-linux-upgrade.
+
+8.6.35.1.1 Accessing the `chroot'
+---------------------------------
+
+     The 'dchroot' utility is useful in trying to access the
+     chroot. You need to add your chroot to the dchroot config file.
+
+     # apt-get install dchroot
+     # echo "sid-root /sid-root" >> /etc/dchroot.conf
+
+     You can also configure your ~/.bashrc files so that your bash
+     prompt wil change to indicate when you're in a particular chroot.
+
+     For this to work, you need to add
+
+     # echo "sid-root" >> /sid-root/etc/debian_chroot
+
+     and make sure that lines similar to the following are present in
+     your .bashrc file.
+
+********************************************************************************************
+# set variable identifying the chroot you work in (used in the prompt below)
+if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
+    debian_chroot=$(cat /etc/debian_chroot)
+fi
+
+# set a fancy prompt (non-color, unless we know we "want" color)
+case "$TERM" in
+xterm-color)
+    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;[EMAIL 
PROTECTED]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+    ;;
+*)
+    PS1='${debian_chroot:+($debian_chroot)[EMAIL PROTECTED]:\w\$ '
+    ;;
+esac
+
+# Comment in the above and uncomment this below for a color prompt
+#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;[EMAIL 
PROTECTED]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+*********************************************************************************************
+
+Then you can log into the chroot by doing the following.
+
+main$ dchroot -d
+Executing shell in 'sid-root' chroot.
+(test-root)main$ 
 
 8.6.35.2. Setting up login for `chroot'
 ---------------------------------------
@@ -7017,6 +7083,8 @@
           main # echo "8:23:respawn:/usr/sbin/chroot </sid-root> "\
                  "/sbin/getty 38400 tty8"  >> /etc/inittab
           main # init q    # reload init
+
+# The purpose of this section is not clear to me.
 
 8.6.35.3. Setting up X for `chroot'
 -----------------------------------


-- System Information:
Debian Release: 3.1
  APT prefers oldstable
  APT policy: (500, 'oldstable'), (500, 'stable'), (50, 'unstable'), (50, 
'testing'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.4.27.040914
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to