Creating Alpha buildd for sid

  • Install some packages

      # aptitude install schroot debootstrap sbuild buildd ntp ntp-doc
    
  • Put the script ?debian-ports into /usr/share/debootstrap/scripts That tells debootstrap how to use debian-ports unreleased dist and its keyring. sbuild-createchroot is a great program for creating chroots but it won't use packages from the unreleased distribution and unfortunately at the moment gcc-4.6 is only in unreleased, so currently can't use sbuild-createchroot. The following mimics what sbuild-createchroot does.

  • So run debootstrap (the following creates the chroot sid-alpha-sbuild in the current directory):

      # debootstrap --variant=buildd --include=fakeroot,build-essential debian-ports sid-alpha-sbuild
    
  • Add a hosts file in the chroot (You will probably want to also add a line to /etc/hosts with your hostname specified to also use 127.0.0.1.)

      # cat > sid-alpha-sbuild/etc/hosts
      127.0.0.1   localhost
      EOF
    
  • Don't allow anything to start in the chroot

      # cat > sid-alpha-sbuild/usr/sbin/policy-rc.d
      #!/bin/sh
      echo "All runlevel operations denied by policy" >&2
      exit 101
      EOF
    
      # chown root: sid-alpha-sbuild/usr/sbin/policy-rc.d
      # chmod 0775 sid-alpha-sbuild/usr/sbin/policy-rc.d
    
  • Edit /etc/apt/sources.list to something useful (e.g. add in source file lines and incoming.) I have the following. I am running approx on port 9999 of the buildd to cache package downloads.

      # cat sid-alpha-sbuild/etc/apt/sources.list
      deb http://imago.phys.waikato.ac.nz:9999/ports/ unstable main
      deb http://imago.phys.waikato.ac.nz:9999/ports/ unreleased main
      deb http://incoming.debian-ports.org/buildd unstable main
      deb-src http://ftp.debian.org/debian unstable main
      deb-src http://incoming.debian-ports.org/buildd unstable main
    
  • Add an schroot config file below. Where /srv/chroot/sid-alpha-sbuild.tar is the path to the tar file you will create below. You can use compressed tar files (e.g. gzipped) but I found that on my 1.25GHz Alpha it took 12s to prepare a new chroot snapshot when using gzipped tar files, but only 5s if using an uncompressed tar file. Given that I did not care about the chroot file size I decided the speed increase of an uncompressed tar file was worth it.

      # cat > /etc/schroot/chroot.d/buildd-sid-alpha
      [sid-alpha-sbuild]
      description=Debian sid buildd chroot
      users=buildd
      root-users=buildd
      aliases=unstable-alpha-sbuild
      type=file
      file=/srv/chroot/sid-alpha-sbuild.tar
      profile=buildd
      EOF
    
  • I also had in my schroot config the line below:

      command-prefix=eatmydata
    
  • And I had installed the package eatmydata into the chroot. This replaces calls to fsync() with a no-op as some packages (including apparently dpkg) have excessive use of fsync() which can greatly slow down disk access. Whether it is worth or not I do not know. Some DDs seem to swear by it and others raise concerns that it might lead to the occasional build failure. I think I might try not using it in my new chroots and see how it goes. By specifying the option below in the schroot config I am assuming that the buildd package is installed into the host system. That provides in the buildd profile to schroot (I think).

      profile=buildd
    
  • Now add sbuild user and group to chroot.

      # getent passwd sbuild >> sid-alpha-sbuild/etc/passwd
      # getent group sbuild >> sid-alpha-sbuild/etc/group
    
  • Now make the tar file of the chroot:

      # tar -cf sid-alpha-sbuild.tar -C sid-alpha-sbuild ./
    
  • And you can then delete the chroot directory. (Or just rename it out of the way. I did that because I wanted to make sure it worked before I smoked it. Bill)

      # rm -rf sid-alpha-sbuild
    
  • If everything has been done correctly you should be able to chroot into the new chroot. To create a snapshot chroot you do:

      # schroot -c sid-alpha-sbuild
    
  • When you exit that chroot the snapshot will be deleted and all changes made in the snapshot chroot will be lost. To enter the source chroot to make permanent changes (say to run apt dist-upgrade periodically) do

      # schroot -c source:sid-alpha-sbuild
    
  • Indeed, test that now and in the chroot run:

      # apt-get update
      # apt-get dist-upgrade
      # apt-get clean
    

(I run apt-get clean in the source chroot as I use the approx package cache and there is no point double caching downloaded packages.)

    # apt-get install fakeroot build-essential debconf
    # dpkg-reconfigure -plow debconf

Answer the debconf questions as follows:

   interface
          choose 6/Noninteractive

   priority
          choose 1/Critical

When you quit the chroot you will notice it take some time --- that's schroot rewriting the source tar file with your changes.

  • Also note that by default the snapshot chroots get unpacked into a directory in /var/lib/schroot/mount. By default the build will be in the root partition. Since I have a separate partition for the builds I have done the following:

      # cat > /etc/schroot/buildd/config
      CHROOT_FILE_UNPACK_DIR=/srv/chroot/unpacks
      EOF
    

and have mounted the partition for builds at /src/chroot/unpacks.