Setting up a chroot Baserock

First, install the following packages from your distribution:

  • chroot
  • schroot

Clone the baserock-chroot setup git repository:

$ git clone git://git.baserock.org/baserock/baserock/baserock-chroot

Generate the tools

Now we build and install the manage-baserock and enter-baserock tools. First, change to the baserock-chroot directory:

$ cd baserock-chroot

Debian based

On Debian based systems, you can create and install a .deb package:

$ sudo apt-get install debhelper
$ make pkg
$ cd ../

Now you should have baserock-chroot_3_all.deb.

$ sudo apt-get install socat
$ sudo dpkg -i baserock-chroot_3_all.deb

Other

On other systems, the tools can be created and installed as follows:

$ sudo make install

Running Baserock

The first step is to add a baserock chroot, using the manage-baserock tool.

$ manage-baserock add 14-22 http://download.baserock.org/baserock/baserock-current-build-system-x86_64-chroot.tar.gz

Here we use manage-baserock with the add command, and create an installation with the name 14-22 from the URL given. Note that on Debian-based systems you may need to run /usr/sbin/manage-baserock.

The location of the chroot is in /opt/baserock.

Finally, we enter Baserock as follows:

$ enter-baserock

Note: on Debian-based systems you may need to run /usr/sbin/enter-baserock.

Note: In Arch-based systemd you need to comment networks in /etc/schroot/baserock-[yourchrootname]/nssdatabases

Your development system is now running in the chroot: return to the 'Quick start' page and follow the instructions there to finish configuring it it.

Deploying a Build

To add a new build it must be deployed as a tar. For example the following cluster morphology could be used to deploy the devel system on 64-bit x86.

name: devel-system-x86_64-chroot
kind: cluster
systems:
- morph: systems/devel-system-x86_64-chroot.morph
  deploy:
    devel-system-x86_64-chroot:
      type: extensions/tar
      location: /src/devel-system-x86_64-chroot.tar

Once deployed leave the chroot and add the new system to the chroot tool, in this example it has been named devel

$ manage-baserock add devel /opt/baserock/src/devel-system-x86_64-chroot.tar

The new system is entered as follows:

$ enter-baserock devel

Removing a Chroot

In order to properly remove a Baserock chroot use

$ manage-baserock rm <name of chroot to be removed>

For example, to remove the devel system from the previous example do

$ manage-baserock rm devel

Notes on using Baserock in a chroot

  • Running modprobe btrfs outside the chroot may be necessary, to ensure that the kernel support for btrfs is available. This is needed to e.g. morph deploy to a raw image from within the chroot.
  • Morph can deploy to a tar file suitable for installing with manage-baserock. Just set type: extensions/tar in the deployment morphology.
  • When installing from a local tar file, run manage-baserock add <name> <path> and then use enter-baserock <name>