<<

2020/11/14 08:05 1/3 Install sbuild + initial setup

This setup was guided by the following page: http://wiki.debian.org/sbuild?rev=19

(Since then, that Debian wiki page evolved, update my be need on our side…)

Install sbuild + initial setup

apt-get install sbuild

user=neyron

sbuild-adduser $user

# this needs "entropy"... Do weird things and think different, waiting for it to complete... sbuild-update --keygen

# share the deb archives among schroots... /var/cache/apt/archives /var/cache/apt/archives none rw,bind 0 0 >>/etc/schroot/sbuild/fstab

# create a fake disk and format it as btrfs (btrfs is still experimental...) if=/dev/zero of=/home/schroot-btrfs bs=1M count=1 seek=$((20 * 1024 -1 )) losetup /dev/loop0 schroot-btrfs mkfs.btrfs /dev/loop0 losetup -d /dev/loop0

# setup the mount of our btrfs disk in /src/ -p /srv/chroot <>/etc/fstab /home/schroot-btrfs /srv/chroot btrfs defaults 0 0 EOF mount /src/chroot

Create a schroot

# set the Debian distribution: sid, wheezy, squeeze... distribution=sid # set the architecture: amd64, i386... architecture=amd64 # set the debian mirror to use mirror=http://ftp2.fr.debian.org/debian

# create the sub-volume for this schroot btrfs subvolume create /srv/chroot/$distribution-$architecture-sbuild

# create the schroot

OAR - https://kameleon.imag.fr/ Last update: 2020/09/28 15:30 wiki:sbuild-debian https://kameleon.imag.fr/wiki:sbuild-debian

sbuild-createchroot --arch=$architecture $distribution /srv/chroot/$distribution-$architecture-sbuild $mirror

# modify the schroot config to say it's btrfs ! mkdir -p /srv/chroot/snapshots sed -i "s,type=directory,type=btrfs-snapshot,; /directory=/ d" /etc/schroot/chroot.d/$distribution-$architecture-sbuild* cat >>/etc/schroot/chroot.d/$distribution-$architecture-sbuild* <

# example of result: cat /etc/schroot/chroot.d/sid-amd64-sbuild-9MUbaK [sid-amd64-sbuild] type=btrfs-snapshot description=Debian sid/amd64 autobuilder groups=root,sbuild root-groups=root,sbuild profile=sbuild btrfs-source-subvolume=/srv/chroot/sid-amd64-sbuild btrfs-snapshot-directory=/srv/chroot/snapshots source-root-groups=root,sbuild,admin

Create a schroot for crossbuilding for another arch

First install the latest version of qemu_user_static (e.g. from sid).

# set the Debian distribution: buster (sid does not work) distribution=buster # set the architecture: amd64, i386... architecture=arm64 #or ppc64el # set the debian mirror to use mirror=http://ftp2.fr.debian.org/debian # create the sub-volume for this schroot btrfs subvolume create /srv/chroot/$distribution-$architecture-sbuild

sbuild-createchroot --debootstrap=qemu-debootstrap --arch=$architecture $distribution /srv/chroot/$distribution-$architecture-sbuild $mirror

Then see above to finish (switch to btrfs…).

In case of problems, hopefully this page may help:

https://danielstender.com/blog/qemu-ppc64el-trouble/ (vanished) https://web.archive.org/web/20161119015128/http://www.danielstender.com/blog/qemu-ppc64 el-trouble.html (archive)

https://kameleon.imag.fr/ Printed on 2020/11/14 08:05 2020/11/14 08:05 3/3 Install sbuild + initial setup Using the schroots!

See your schroot:

schroot -c chroot:centos5-amd64 source:centos5-amd64 chroot:centos6-amd64 source:centos6-amd64 chroot:sid-amd64-sbuild source:sid-amd64-sbuild chroot:sid-i386-sbuild source:sid-i386-sbuild chroot:squeeze-amd64-sbuild source:squeeze-amd64-sbuild chroot:squeeze-backports-amd64-sbuild source:squeeze-backports-amd64-sbuild chroot:squeeze-backports-i386-sbuild source:squeeze-backports-i386-sbuild chroot:squeeze-i386-sbuild source:squeeze-i386-sbuild chroot:wheezy-amd64-sbuild source:wheezy-amd64-sbuild chroot:wheezy-backports-amd64-sbuild source:wheezy-backports-amd64-sbuild chroot:wheezy-backports-i386-sbuild source:wheezy-backports-i386-sbuild chroot:wheezy-i386-sbuild source:wheezy-i386-sbuild

chroot:* are stateless chroot, everything is lost once a session is ended source:* are the bases for the chroot, modification (upgrades, etc) are persistant see schroot manual

Using sbuild sbuild is to build Debian packages. See debian packaging.

Examples:

# build a package in a schroot sbuild -As -d sid --arch amd64 oar_2.5.3-1.dsc

# upgrade a schroot sbuild-update -ugd sid

More info: see sbuild manual

From: https://kameleon.imag.fr/ - OAR

Permanent : https://kameleon.imag.fr/wiki:sbuild-debian

Last update: 2020/09/28 15:30

OAR - https://kameleon.imag.fr/