RPM-OSTree, a new deployment mechanism for RPM-based systems

WARNING: This page is outdated. Please see the official documentation at www.projectatomic.io.

Today, I was told by Colin Walters about his newest project: RPM-OSTree.
He actually announced fedostree today as well.

NOTE: The commands in this blog post are outdated. Although the ideas themselve are still the same, the tools have slightly different names and syntax.

He asked me if I could quickly test the instructions he has put on the Fedora RPM-OSTree info page, but after trying it, I thought it was too awesome to stop there.
So I decided to setup my own builder and host for RPM-OSTree trees.

My builder is building a Fedora 20 and a Fedora Rawhide tree every three hours with a set of packages which I use for development.

I have just configured one of my laptops to pull these trees down, and to boot from it, with the rawhide tree as default and 20 as always-available fallback for when rawhide is broken for some reason.

Some major advantages are that I always know which packages were installed on my laptop at any point in time, and I can always fallback to a previous, known-good, tree if for some reason the latest update broke something and that reinstalling will consist only of installing a minimal Fedora installation and then pulling my trees, and I am back in the running.
Also, after migrating my other laptop, I will always have the same set of packages installed on any of my systems.

How to deploy

For myself, I have written a deployment script, and I can reinstall a new laptop for myself by executing a single command, if you are interested, you can view it here.
BE WARNED: this does not ask for any confirmation or anything, and uses my personal trees, so you should only use this for reference or starting point, and not as-is.

ALSO NOTE: my trees contain some self-built packages to create a user and do some more stuff, so you should not use my trees on your own computer!

I will explain here, piece by piece, what is happening.
Please note that most of these instructions are modifications from the ones on the fedostree installation page by Colin Walters.

First, you need to install the ostree package:

yum install ostree

Next up, initialize the ostree deployment directory and add the remote server url:

ostree admin os-init fedora
ostree remote add --set=gpg-verify=false $servername $serverurl
with $servername being some name by which you refer to this server (fedostree in the fedostree case) and $serverurl being the URL of the published repo (http://rpm-ostree.cloud.fedoraproject.org/repo for fedostree, read on to see how to create your own repository). Next up, pulling the bits, be warned, this might take a long time on big trees:
ostree pull $servername $tree
with $repo being the name of the repository. For fedostree, check [here](https://github.com/cgwalters/rpm-ostree/blob/master/fedostree/products.json) for the names under products, and prepend it with fedostree/$version/$arch/, with $version being the Fedora version you want and $arch the repository. For example, to install the fedostree Fedora 20 64-bit gnome basic system, use "fedostree/20/x86_64/workstation/gnome/basic". After this completes, you need to deploy the ostree:
ostree admin deploy --os=fedora $tree --karg-proc-cmdline --karg=selinux=0
The --kargs-proc-cmdline makes ostree install the file with the correct kernel arguments, and --karg=selinux=0 sets selinux=0 (which is currently required, unfortunately). Now you have the complete tree in /ostree/deploy/fedora/current/, but you still need to tweak some things. To automate this, I wrote a python script, which is available [here](http://patrick.uiterwijk.org/files/2014/01/ostree-post-deploy.py), as it requires fiddling around with grub configuration files etc. This script is safe to use, as it does not modify the host system. What this script does is: 1. Copies /etc/fstab to within the ostree deployment 2. Asks for a root password and sets it for the ostree 3. Installs a [grub config](http://patrick.uiterwijk.org/files/2014/01/01_ostree) file that loads the required modules into grub 4. Runs grub2-mkconfig >/boot/grub2/grub.cfg to update the grub configuration After this all is done, you can reboot. If all gone well, you should now see a grub boot entry "ostree:fedora:0 Fedora 20 (Heisenbug)" (or something like that), which should be bootable into your just downloaded tree. Congratulations! ## How to create your own custom trees If you want to create your own trees, you should have a machine available with some disk space (two minimal Fedora trees (20 and rawhide) in my case are 562MB, but this will also grow over time) running Fedora 20 or rawhide. For now, you need to add a COPR repository, available [here](http://copr.fedoraproject.org/coprs/walters/rpm-ostree/) (just download the file linked to under "Yum Repo" for your distribution, and put that in /etc/yum.repos.d/ as rpm-ostree.repo). After this, execute the following command the install the required packages:
yum install ostree rpm-ostree

Now, there are two ways of building a new treeset, but I have only used the "autobuilder" method, because I really like the fact that it uses a json file to indicate which trees to build and which packages to install in the trees, so I will explain that.

You might want to create a directory where to put everything, which I will from now on call $rootdir.
First, create the products.json file in that directory.
For an example, view the fedostree one.

Please note that ostree does not handle $releasever in yum repo files, so if you get errors that it cannot find the fedora-20 or fedora-rawhide repo, download fedora-20.repo and fedora-rawhide.repo, and put both in /etc/yum.repos.d/.
You can make these files yourself by just copying the fedora.repo to fedora-20.repo and fedora-rawhide.repo and replacing every instance of $releasever with either 20 or rawhide.

We now have everything set up, and can start to build the trees!
Change the directory to $rootdir, and then execute the following command:

rpm-ostree-autobuilder make -n build

This will run a long time, and will run for all trees you defined in products.json.
It prints the tree names as it is working on them, and puts logs in $rootdir/local/build/ .

After this is done, just configure your webserver to server the $rootdir/repo directory and configure the url of this repo directory as $url in the above "How to deploy" steps.

To update the trees, just execute the rpm-ostree-autobuilder command again in $rootdir, and it will go ahead and fetch the latest version of all packages and update all the trees.

You have now created your own personal trees and made them available to install to computers!

Final notes

So far, I really love RPM-OSTree, and am really looking forward to what else it will have to offer.
I will report back on my blog after testing it some more.

If you have any questions regarding this blog post or need help, feel free to email me (patrick@puiterwijk.org) or ping me on IRC (puiterwijk on FreeNode and GIMPNet). Do note however that this page is outdated. Please see the official documentation at the beginning for more up to date info until I write a new blogpost.

(Per request by Colin, here by another link to the announcement email of fedostree: LINK)

Fedora Infrastructure is now a Persona Identity Provider

I am a GNOME sysadmin.. and what have I done?