Chroot build environment
Working on this as I build a new virtual machine for semi-automated Linux and Windows builds.
Our "weekly" builds are done in a virtual machine with a chroot prison for 32 and 64 bit builds and wine for the Windows build. Here I document step by step how to set one up. I write this as I go, so it is incomplete.
Make snapshots after every section or so.
Install Ubuntu Trusty in a virtual machine. Straightforward :) Pick LVM in the setup options so you can resize partitions later.
Install bzr and (optinal, I use it for remote access) ssh and stuff:
sudo apt-get update sudo apt-get install bzr ssh schroot
Add common volume to host builds
Edit: These steps are provided as is because I set my system up that way. They're not required. /mnt/builds on the root system side can be any old directory.
Use LVM to add a new volume. My VM has 150 G total space:
lvcreate -L 100G -n builds ubuntu-vg mkfs.ext4 /dev/ubuntu-vg/builds
If there is not enough space, reduce existing volumes. This needs to be done from a Live CD:
resize2fs /dev/ubuntu-vg/root 50G lvresize /dev/ubuntu-vg/root 50G
Add the new volume to fstab:
/dev/mapper/ubuntu--vg-builds /mnt/builds ext4 errors=remount-ro 0 1
This new volume will be mounted into the chroots for easy access.
Set up chroot environments
Follow this documentation:  You can stop before "Setting up a dchroot (non-root) environment"
 description=Ubuntu 64 Bit location=/var/chroot/64 priority=3 users=manuel groups=sbuild,root root-groups=root
 description=Ubuntu 32 Bit location=/var/chroot/32 priority=3 users=manuel groups=sbuild,root root-groups=root personality=linux32 aliases=dokochroot,default
Creating the actual installations:
debootstrap --variant=buildd --arch i386 trusty /var/chroot/32 http://archive.ubuntu.com/ubuntu/ debootstrap --variant=buildd --arch amd64 trusty /var/chroot/64 http://archive.ubuntu.com/ubuntu/
To change into the new environments, you can do "schroot -c 32" or "schroot -c 64".
Create mount points for the shared files in the chroots:
mkdir /var/chroot/32/mnt/builds mkdir /var/chroot/64/mnt/builds
Add bind mounts for them into /etc/fstab:
/mnt/builds /var/chroot/32/mnt/builds none bind /mnt/builds /var/chroot/64/mnt/builds none bind
Mount them with "mount -a". Inside the chroots, you should now see /mnt/build.