07 Jul 2010, 11:39

mini-buildd and Linux-Vserver

Share

After discovering mini-buildd, a tiny Debian buildd, I’ve tried to set it up inside some vservers. mini-buildd uses LVM-Snapshots to avoid duplicate work when creating build chroots. I will setup a base debian chroot once and create a snapshot each time a build chroot is needed. This, however, is where the fun begins. The problem is that Linux-Vserver prevents its guests from performing most of the syscalls and ioctls needed by lvm2.

I didn’t manage to get the setup fully working so far but I wanted to share my experience in case anyone tries the same!

The basic setup of mini-buildd is quiet easy. I’ve decided for a setup with three versers, one for the repository, one buildd for amd64 and ond buildd for i386.

vs-buildd-rep - 192.168.10.1
vs-buildd-amd64 - 192.168.10.2
vs-buildd-i386 - 192.168.10.3
First we need to create these vservers:
newvserver –ip 192.168.10.124 –domain localdomain –hostname vs-buildd-rep –vsroot /srv/vserver/ –mirror http://ftp.de.debian.org/debian –interface eth0 –dist lenny –arch amd64
newvserver –ip 192.168.10.224 –domain localdomain –hostname vs-buildd-amd64 –vsroot /srv/vserver/ –mirror http://ftp.de.debian.org/debian –interface eth0 –dist lenny –arch amd64
newvserver –ip 192.168.10.324 –domain localdomain –hostname vs-buildd-i386 –vsroot /srv/vserver/ –mirror http://ftp.de.debian.org/debian –interface eth0 –dist lenny –arch i386
After installing the vservers we need make some adjustments for LVM and set some capabilities:
cp -a /dev/loop* /srv/vserver/vs-buildd-amd64/dev/
cp -a /dev/mapper/control /srv/vserver/vs-buildd-amd64/dev/mapper/
echo “SECURE_MOUNT” >> /etc/vserver/vs-buildd-amd64/ccapabilities
echo “SECURE_REMOUNT” >> /etc/vserver/vs-buildd-amd64/ccapabilities
echo “ADMIN_CLOOP” >> /etc/vserver/vs-buildd-amd64/ccapabilities
echo “ADMIN_MAPPER” >> /etc/vserver/vs-buildd-amd64/ccapabilities
echo “MKNOD” >> /etc/vserver/vs-buildd-amd64/bcapabilities
echo “SYS_RESOURCE” >> /etc/vserver/vs-buildd-amd64/bcapabilities
echo “SYS_ADMIN” >> /etc/vserver/vs-buildd-amd64/bcapabilities
cp -a /dev/loop* /srv/vserver/vs-buildd-i386/dev/
cp -a /dev/mapper/control /srv/vserver/vs-buildd-i386/dev/mapper/
echo “SECURE_MOUNT” >> /etc/vserver/vs-buildd-i386/ccapabilities
echo “SECURE_REMOUNT” >>  /etc/vserver/vs-buildd-i386/ccapabilities
echo “ADMIN_CLOOP” >> /etc/vserver/vs-buildd-i386/ccapabilities
echo “ADMIN_MAPPER” >> /etc/vserver/vs-buildd-i386/ccapabilities
echo “MKNOD” >> /etc/vserver/vs-buildd-i386/bcapabilities
echo “SYS_RESOURCE” >> /etc/vserver/vs-buildd-i386/bcapabilities
echo “SYS_ADMIN” >> /etc/vserver/vs-buildd-i386/bcapabilities
Please note that these capabilities give the vs-buildd guests pretty much control over the host, so be careful how far you trust your buildds!

Now start the vservers, fix some broken defaults, upgrade to squeeze and install the requried packages.

When editing the sources.list you should replace all occurences of lenny by squeeze like so:

:%s/lenny/squeeze/g
The reason for not installing squeeze directly with newvserver is that, at the time of this writing, newvserver can not handle squeeze.

For the repository vserver:

vserver vs-buildd-rep start
vserver vs-buildd-rep enter
update-rc.d cron defaults; /etc/init.d/cron start; vi /etc/apt/sources.list; aptitude update && aptitude install aptitude apt && aptitude updgrade; aptitude dist-upgrade; aptitude install mini-buildd-rep vim htop screen ssh exim4
a2endmod userdir
dpkg-reconfigure tzdata
dpkg-reconfigure locales
dpkg-reconfigure exim4-config
The Vservers need some way of sending mail, so the best would be to setup a mailserver somewhere, e.g. in the host, and then confiure it as a smarthost inside the vservers.

The next one is the amd64 buildd:

vserver vs-buildd-amd64 start
vserver vs-buildd-amd64 enter
dpkg-reconfigure locales; update-rc.d cron defaults; /etc/init.d/cron start; vi /etc/apt/sources.list; aptitude update && aptitude install aptitude apt && aptitude updgrade; aptitude dist-upgrade; aptitude install mini-buildd-bld vim htop screen ssh exim4
a2endmod userdir
dpkg-reconfigure tzdata
dpkg-reconfigure exim4-config
And the same for i386:
vserver vs-buildd-i386 start
vserver vs-buildd-i386 enter
dpkg-reconfigure locales; update-rc.d cron defaults; /etc/init.d/cron start; vi /etc/apt/sources.list; aptitude update && aptitude install aptitude apt && aptitude updgrade; aptitude dist-upgrade; aptitude install mini-buildd-bld vim htop screen ssh exim4
a2endmod userdir
dpkg-reconfigure tzdata
dpkg-reconfigure exim4-config
The setup of the mini-buildd is a bit tricky since the repository and the buildds depend on each other. So after performing the above steps you’ll probably need to reconfigure each.
  • in vs-buildd-rep: dpkg-reconfigure mini-buildd-rep
  • in vs-buildd-amd64 and vs-buildd-i386: dpkg-reconfigure mini-buildd-bld

To be continued!

Thats it for now. Howevery, so far I didn’t manage to get the buildds working. There are still some issues with the LVs. I’ll update this post as soon as I figure out how to fix this.