Creating schroots

Chroot jails are a neat way of building for target Linux distros without having to run the distro in a vm. For example, in my case, I can host the filesystem for RHEL on my Arch linux machine and then build binaries for RHEL that will be compatible. All I need to install is rpm and yum and because it’s not native to Arch which I got from the Arch user repository. A program call schroot makes the configuration and mounting the chroot environment easier and less error prone. It will mount /dev and /proc and /home from the host into the chroot and copy basic system database files over so that when you log into the chroot your home directory from the host is automatically mounted inside the chroot guest and you’ll be able to use the system like it is a native (insert name of guest chroot here) distribution.


This is how I setup the RHEL chroot on Arch. Obviously I installed schroot, rpm and yum previously. How you install those programs depends on your distro.

sudo mkdir /srv/chroot/rhel
wget http://<some yum repo>/packages/redhat-release-server-6Server-
sudo rpm --root=/srv/chroot/rhel --nodeps -i redhat-release-server-6Server-

Then configure yum on the chroot to point to the yum repository you want to use. For example:

$ cat /srv/chroot/rhel/etc/yum.repos.d/rhel-ericsson.repo

Then install yum in the chroot.

sudo yum --installroot=/srv/chroot/rhel6.6/ install -y yum

Now configure schroot for this guest. Create an entry like the following in /etc/schroot.conf.

description=RHEL 6.6

The keys are fairly self-explanatory. The type is directory because well the guest is layed out in, yes you guessed it, a directory /srv/chroot/rhel. users are the users you want to allow access to the chroot. root-users are users on the host you want to allow to login as root inside the guest. profile is the name of the schroot profile described next. See man schroot.conf for a full description of all keys.

Next create a directory with the same name assigned to profile.

sudo mkdir /etc/schroot/rhel

Add the following files in that directory. For example:

sashan@phoenix ~/code  > cat /etc/schroot/rhel/nssdatabases
# System databases to copy into the chroot from the host system.
# <database name>
sashan@phoenix ~/code  >
sashan@phoenix ~/code  > cat /etc/schroot/rhel/copyfiles
# Files to copy into the chroot from the host system.
# <source and destination>
sashan@phoenix ~/code  > cat /etc/schroot/rhel/fstab
# fstab: static file system information for chroots.
# Note that the mount point will be prefixed by the chroot path
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/proc           /proc           none    rw,bind         0       0
/sys            /sys            none    rw,bind         0       0
/dev            /dev            none    rw,bind         0       0
/dev/pts        /dev/pts        none    rw,bind         0       0
/home           /home           none    rw,bind         0       0
/tmp            /tmp            none    rw,bind         0       0

sashan@phoenix ~/code  >

Then you are done. Now you can login to the chroot as your username or root. For example:

schroot -u sashan -l rhel -s /bin/bash


schroot -u root -l rhel -s /bin/bash

Once inside you might need to run

$ rpm -vv --rebuilddb

to make sure the rpm database works nicely.

A new OS

I was investigating cloud foundry because I wanted to see how it differed from OpenSAF. I watched their presentation and posted a question to their mailing list. It hasn’t arrived yet and it’s been 24 hours. And then I wanted to install a private cloud foundry instance. It looks like I should be able to do it. But then I realized that it required something to run multiple virtual machines and I was running linux in a vm on windows. Not keen to run a vm inside a vm or run multiple machines from my Windows host because I can’t be bothered using Windows as development environment anymore, I decided to pull out an 8 year old hard drive from a dead computer lying around and stuck it into my 2.5 year old desktop machine, installed Arch on it, decided to use i3 and not Gnome, found some cool colorschemes from, wrote a script to randomly pick a colorscheme when I open a new urxvt terminal via mod+enter in i3, installed the nvidia drivers so I can do some coding on the GTX680 inside, discovered the Red Screen of Death when using nvidia-libgl, fixed RSOD, found out that my Cougar 700K gaming keyboard literally halts when I press any of the special keys on it and I have to reset it by unplugging it from the USB port, found out that my ASUS Phoebus gaming sound card doesn’t work at all in Linux and my gazillion button gaming R.A.T mouse works like a 3 button mouse. I named my new Linux machine Phoenix because it rose from the derelict remains of an 8 year old disk drive. And then the weekend ended along with my cloud foundry investigation.


less is more

‘less is more’ except when LESS_IS_MORE, then less really is more!

The above is a nerdy joke I made up. Pretty pleased with myself. I’m fairly sure I made it up. Let me know if you’ve seen it before.

5 years

I’ve been running my server, the one that hosts this webpage, for 5 years. It was running on Centos 5 and I kept telling myself to upgrade it and rebuild the server but kept postponing the task because I knew what a pain it would be to move all the config from apache, postfix, mysql etc on to the new server. Fortunately, for people who have to do this regularly there is Puppet and Saltstack which integrates with the applications like apache and merge their config from the old to the new server. Me – I’ve been spending the weekend doing this manually. I backed up what I thought I needed from /etc and the wordpress database, rebuilt the server to run Centos 7, discovered more than I wanted to know about systemd, discovered that mysql is now called maria and now wordpress looks like it’s up and running. But shit it got me thinking about config management. The approach Puppet takes is fine but I wonder about another approach that allows tighter integration. Anyway this post is more of a test to see if wordpress is working again.


Recently stumbled across this plugin for vim. It’s replaced my use of command-t and fuzzyfinder. CtrlP is able to find files or buffers and let you switch to them in an intuitive manner. It also keeps a list of most recently used files or buffers. For example entering the command :CtrlPMRU brings up the list of MRU buffers.

Bochs and a Kernel

There’s a basic tutorial here here on how to get started with a kernel. It uses Bochs as 32 bit emulator. However recent versions of Bochs have been updated so that this line in the config file:

romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xf0000

must change to this:

romimage: file=/usr/share/bochs/BIOS-bochs-latest

Expert F# Errata

It’s good when you find errors in text books. It means you understand the subject matter. On page 231 of Expert FSharp 2.0

attempt { let! n1 = failIfBig inp1
let! n2 = failIfBig inp2
let sum = n1 + n2
return sum };;

desugars to this:

attempt.Bind( failIfBig inp1,(fun n1 ->
attempt.Bind(failIfBig inp2,(fun n2 ->
attempt.Return sum)))))

but it should be this:

attempt.Bind( failIfBig inp1,(fun n1 ->
attempt.Bind(failIfBig inp2,(fun n2 -> let sum = n1 +  n2 in
attempt.Return sum)))))

I confirmed it on stackoverflow ( and via email with one of the authors (Don Syme).