Creating sbuild chroots for Debian package testing

This is how to setup sbuild chroots for Debian packaging.

The Debian wiki explains this already pretty good.

But here is how I use and setup my chroots.

Setup the chroots

Normal chroot

sudo sbuild-createchroot --include=eatmydata,ccache bullseye /srv/chroot/bullseye-amd64-sbuild http://ftp.fr.debian.org/debian

Experimental chroot

Create the chroot:

sudo sbuild-createchroot --chroot-prefix=experimental --extra-repository='deb http://deb.debian.org/debian experimental main' --include=eatmydata,ccache bullseye /srv/chroot/experimental-amd64-sbuild http://ftp.fr.debian.org/debian

Make sure the packages in backports are preferred above the original ones:

sudo sbuild-shell source:experimental-amd64-sbuild
echo "Package: *\nPin: release a=experimental\nPin-Priority:900" > /etc/apt/preferences.d/experimental.pref
exit

Backports chroot

Create the chroot:

sudo sbuild-createchroot --chroot-prefix=bullseye-backports --extra-repository='deb http://deb.debian.org/debian bullseye-backports main' --include=eatmydata,ccache bullseye /srv/chroot/bullseye-backports-amd64-sbuild http://ftp.fr.debian.org/debian

Make sure the packages in backports are preferred above the original ones:

sudo sbuild-shell source:bullseye-backports-amd64-sbuild
echo "Package: *\nPin: release a=bullseye-backports\nPin-Priority:900" > /etc/apt/preferences.d/bullseye-backports.pref
exit

More about this on this blog post

Use the chroots

cd /home/user/packages/my-package
# Normal dist
sbuild -d bullseye
# Backports dist
sbuild -d bullseye-backports

List chroots

schroot -l

Remove a chroot

rm -r /srv/chroot/experimental-amd64-sbuild
# Find config the file and remove it
rm /etc/schroot/chroot.d/experimental-amd64-sbuild-F28TrU