Page MenuHomePureOS Tracker

Howto Build PureOS images
Updated 1,395 Days AgoPublic

PureOS provides convenient pre-built images for use installing on computers, Virtual Machines, and containers. You can find those images here;

It is also possible to build a PureOS image from scratch from the PureOS repos. Purism does this when we want to test the reproducibility of a PureOS image.

Reproducible ISOs Use this document to read more detail about how we check byte-for-byte reproducible images.

Build a PureOS image

  1. Prepare an appropriate environment.

If you're already running PureOS on your build machine, then you're all set. If you're running another GNU/Linux distribution it is likely best to set up a chroot or to use a tool like debspawn (discussed below.)

  1. Install live-build and other tools
$ apt install live-build git ca-certificates
  1. Clone via git our configuration for PureOS
$ cd /srv && git clone https://source.puri.sm/pureos/infra/make-live.git
$ cd /srv/make-live

Currently we build a number of images; gnome-live, gnome-oem, plasma-live. Exporting the type of image you want into your environment is needed if you want to override the default;

$ export FLAVOR="gnome-oem"

If no FLAVOR variable is set, the GNOME Live Flavor will be built by default.

  1. Run lb config
  2. Run lb build
  3. Have fun with a fresh new PureOS image!

Building images with Debspawn

The above steps can be sped up a lot and be automated by using debspawn, which is used to create the official PureOS images in a controlled environment.

In order to use debspawn, just follow these steps:

  1. Run sudo apt install debspawn
  2. Then run debspawn create amber
  3. Create a new "build-pureos.sh" file with the following contents:
#!/bin/sh
set -e
set -x

export FLAVOR="gnome-live"
export DEBIAN_FRONTEND=noninteractive
apt-get install -y git ca-certificates
apt-get install -y live-build

git clone --depth=2 https://source.puri.sm/pureos/infra/make-live.git /srv/build/lb
cd /srv/build/lb/

lb config
lb build

b2sum *.iso *.contents *.zsync *.packages > checksums.b2sum
sha256sum *.iso *.contents *.zsync *.packages > checksums.sha256sum
mv *.iso /srv/artifacts
mv -f *.zsync /srv/artifacts
mv -f *.contents /srv/artifacts
mv -f *.files /srv/artifacts
mv -f *.packages /srv/artifacts
mv -f *.b2sum /srv/artifacts
mv -f *.sha256sum /srv/artifacts
  1. Make the .sh file executable and set the FLAVOR you want.
  2. Tell debspawn to run the build and where to place the build result:
debspawn run --external-command --artifacts-out=/where/to/put/the/built/image amber /path/to/build-pureos.sh

This should give you a replica of what our autobuilders did. You can also take a look at the actual code in Spark:
image_build.py

Troubleshooting

Should you get an error regarding the PureOS Keyring when building with debspawn;

I: Keyring file not available at /usr/share/keyrings/pureos-archive-keyring.gpg; switching to https mirror https://deb.debian.org/debian   
I: Retrieving InRelease
I: Retrieving Release       
E: Failed getting release file https://deb.debian.org/debian/dists/green/Release

This is easily fixed if you're on a PureOS system. Simply install via apt the keyring;

$ apt install pureos-archive-keyring

Otherwise you can download and install the deb from here: https://repo.pureos.net/pureos/pool/main/p/pureos-archive-keyring/

Errors with debootstrap
If you receive this error;

E: No such script: /usr/share/debootstrap/scripts/green

it simply means that the 'green' script (for building PureOS Green) is not in your version of deboostrap. You can get it from here; https://source.puri.sm/snippets/73

Last Author
jeremiah.foster
Last Edited
Jan 25 2021, 08:56

Event Timeline

jeremiah.foster edited the content of this document. (Show Details)May 17 2019, 08:14
jeremiah.foster edited the content of this document. (Show Details)May 17 2019, 09:13
jeremiah.foster edited the content of this document. (Show Details)May 17 2019, 10:24
jeremiah.foster added a subscriber: fsfsysadmin.
jeremiah.foster edited the content of this document. (Show Details)May 17 2019, 11:23
jeremiah.foster edited the content of this document. (Show Details)Jan 25 2021, 08:56
jeremiah.foster added projects: Restricted Project, Restricted Project.