== HOWTO set up a porting dchroot on a debian.org machine == The script 'upgrade-porter-chroots' has expectations about naming conventions for new porter chroots. The current list it searches for are: {{{ lenny squeeze wheezy sid \ lenny_i386 squeeze_i386 wheezy_i386 sid_i386 \ lenny_amd64 squeeze_amd64 wheezy_amd64 sid_amd64 \ sid_s390x \ }}} Please make sure that new chroots meet the expectations of the script, or update the script accordingly (it lives in the debian.org.git repo) This example is for setting up a $DIST dchroot on paer.debian.org, adjust accordingly. Do the following as root: {{{ echo -n 'Dist: ' && read DIST && export DIST && echo -n 'Mirror: ' && read MIRROR && export MIRROR && default_arch="$(dpkg --print-architecture)" && echo -n "Arch [$default_arch]: " && read ARCH && if [ -z "$ARCH" ]; then ARCH="$default_arch"; fi && export ARCH }}} * create the chroot {{{ cd /srv/chroot && mkdir "${DIST}_${ARCH}" && debootstrap --keyring /usr/share/keyrings/debian-archive-keyring.gpg --include="apt" --variant=buildd $DIST ./"${DIST}_${ARCH}" http://$MIRROR/debian && cp /etc/hosts "${DIST}_${ARCH}"/etc/ }}} * enter the chroot and create the chroot tag: {{{ chroot "${DIST}_${ARCH}" echo $DIST > /etc/debian_chroot #*) echo 'Acquire::PDiffs "false";' > /etc/apt/apt.conf.d/local-pdiff echo 'APT::Install-Recommends 0;' > /etc/apt/apt.conf.d/local-recommends echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/local-no-lang # # not sure this one's a good idea, -- weasel 20080829 # ##echo 'DPkg::Post-Invoke { "(sleep 1; apt-get clean) &"; };' > /etc/apt/apt.conf.d/local-cleanup # #*) deploy a policy-rc.d script: apt-get update && apt-get install policyrcd-script-zg2 && cat > /usr/local/sbin/policy-rc.d << EOF && #!/bin/sh # policy-rc.d script for chroots. # Copyright (c) 2007 Peter Palfrader while true; do case "$1" in -*) shift ;; makedev) exit 0;; *) echo "Not running services in chroot." exit 101 ;; esac done EOF chmod +x /usr/local/sbin/policy-rc.d #*) install and setup locales and install libnss-db apt-get install locales-all # (if locales-all is not feasible on the machine because of say # disk constraints then install just locales and enable at # least "en_US.UTF-8 UTF-8" and "en_US ISO-8859-1".) # #*) setup nsswitch.conf to properly use the ldap stuff # [dchroot]: apt-get install libnss-db && # sed -i -e 's/^passwd:\[[:space:]]\+compat$/passwd: compat db/; # s/^group:\[[:space:]]\+compat$/group: db compat/; # s/^shadow:\[[:space:]]\+compat$/shadow: compat db/' \ # /etc/nsswitch.conf # # # *) apt-get install vim fakeroot devscripts gdb zsh dialog tcsh # edit the sources.list in the chroot and add contrib/non-free to the # primary source, a security updates source, and deb-src entries for both. # It should end up looking something like ( echo "deb http://$MIRROR/debian $DIST main contrib non-free" echo "deb-src http://$MIRROR/debian $DIST main contrib non-free" if [ "$DIST" != "sid" ] ; then echo "deb http://security.debian.org $DIST/updates main contrib non-free" echo "deb-src http://security.debian.org $DIST/updates main contrib non-free" fi ) > /etc/apt/sources.list apt-get update && apt-get upgrade # # # *) # exit the chroot exit }}} * [dchroot only] edit /etc/fstab on the system root and add entries to mount /proc and /home in the chroot, there will be existing ones for the other chroots, just copy and adjust. Then mount them (from the system root). {{{ :e.g: : proc-etch /srv/albeniz.debian.org/chroot/etch/proc proc defaults,nosuid,nodev,noexec 0 0 : proc-lenny /srv/albeniz.debian.org/chroot/lenny/proc proc defaults,nosuid,nodev,noexec 0 0 : proc-sid /srv/albeniz.debian.org/chroot/sid/proc proc defaults,nosuid,nodev,noexec 0 0 : : home /srv/albeniz.debian.org/chroot/etch/home none bind,defaults : home /srv/albeniz.debian.org/chroot/lenny/home none bind,defaults : home /srv/albeniz.debian.org/chroot/sid/home none bind,defaults : : devpts-etch /srv/albeniz.debian.org/chroot/etch/dev/pts devpts defaults,noexec,nosuid 0 0 : devpts-lenny /srv/albeniz.debian.org/chroot/lenny/dev/pts devpts defaults,noexec,nosuid 0 0 : devpts-sid /srv/albeniz.debian.org/chroot/sid/dev/pts devpts defaults,noexec,nosuid 0 0 : : shm-etch /srv/albeniz.debian.org/chroot/etch/dev/shm tmpfs defaults,nosuid,nodev 0 0 : shm-lenny /srv/albeniz.debian.org/chroot/lenny/dev/shm tmpfs defaults,nosuid,nodev 0 0 : shm-sid /srv/albeniz.debian.org/chroot/sid/dev/shm tmpfs defaults,nosuid,nodev 0 0 : : tmp /srv/albeniz.debian.org/chroot/etch/tmp none bind,defaults : tmp /srv/albeniz.debian.org/chroot/lenny/tmp none bind,defaults : tmp /srv/albeniz.debian.org/chroot/sid/tmp none bind,defaults }}} * [schroot] set up /etc/schroot/chroot.d/ correctly. [dchroot]: edit /etc/dchroot.conf in the system root, add an entry for $DIST, and update the stable and testing pointers * [dchroot]: run ud-replicate so the new chroot is setup (this would happen via cron eventually, this is just to speed things up) {{{ ud-replicate }}} * as a normal user, test that the new chroot works: "dchroot $DIST" or "schroot $DIST", test that the stable and testing pointers work.