Note to self: Installing build
chroots on
Debian quick&dirty (here testing and unstable).
Package:
schroot
Description:
Execute commands in a chroot environment
schroot allows users to execute commands or interactive shells
in different chroots. Any number of named chroots may be
created, and access permissions given to each, including root
access for normal users, on a per-group basis. Additionally,
schroot can switch to a different user in the chroot, using PAM
for authentication and authorisation. All operations are logged
for security.
.
Several different types of chroot are supported, including normal
directories in the filesystem, and also block devices. Sessions,
persistent chroots created on the fly from files and LVM snapshots
are also supported.
.
schroot also integrates with sbuild, to allow building packages with
all supported chroot types, including sessions.
.
schroot shares most of its options with dchroot, but offers vastly
more functionality.
$ apt-get install schroot cdebootstrap
$ mkdir -p /home/chroot/{sid,testing}
$ addgroup sbuild && adduser nion sbuild
$ cat > /etc/schroot/schroot.conf << EOF
[sid]
description=Debian sid (unstable)
location=/home/chroot/sid
priority=3
groups=sbuild
root-groups=root
aliases=unstable,default
run-exec-scripts=true
run-setup-scripts=true
[lenny]
description=Debian lenny (testing) 32-bit
location=/home/chroot/testing
priority=3
root-groups=root
groups=sbuild
aliases=testing,lenny
run-exec-scripts=true
run-setup-scripts=true
EOF
$ # the necessary setup apart from binding directories will be done by schroot now
$ # stable chroots are added in the same way
$ cat >> /etc/fstab << EOF
proc /home/chroot/sid/proc proc defaults 0 0
/home /home/chroot/sid/home none bind 0 0
proc /home/chroot/testing/proc proc defaults 0 0
/home /home/chroot/testing/home none bind 0 0
EOF
$ cdebootstrap --arch i386 testing /home/chroot/testing/ http://ftp2.de.debian.org/debian/
$ cdebootstrap --arch i386 sid /home/chroot/sid/ http://ftp2.de.debian.org/debian/
$ # you need to add (if you are not using unstable)
Suite: lenny
Config: sid
to /usr/share/cdebootstrap/suites, unfortunatly it wasn't added before the etch release.
$ mount /home/chroot/sid/proc && mount /home/chroot/sid/home
$ mount /home/chroot/testing/proc && mount /home/chroot/testing/home
Et voila
$ schroot -c sid
build:~#
You don't need to be root to execute this and you have your home directory available in the chroot because of the mount bind.
The host used for bootstrapping is automatically added to your sources.list in the chroot but you need an apt-get update to install packages afterwards. Suggestions welcome.