Customizing CoreOS images

For quite a while I’m impressed by the Docker and CoreOS projects and it has been quite a while on my todo list to look into it…

Since I’ve access to some playground with some old Workstations… I decided to start playing around with it, using PXE boot (this was already set up on that environment).

So I followed the instructions for PXE as described on the CoreOS PXE Boot page, although it kept complaining about an “invalid or corrupt kernel image“, while the checksums (MD5/SHA1) were OK. Since the TFT server is running on RHEL5, I did had an old version of pxelinux, so after the downloading the latest syslinux binary from the system booted.

After I had the system booted the system ‘alerted’ me on the fact that the test-environment is using an MTU of 9000 (JumboFrames)…

This could not be fixed by the cloud-config configuration over HTTP method as far as I consider… because the cloud-config is loaded by the OS and therefore it requires up-and-running network-interface (with a correct MTU set);

So I  had to modify the CoreOS initrd, to update the MTU in /usr/lib/systemd/network/


So the we need to unpack the initial ramdisk.

Unpacking the CoreOS Ramdisk

Step 1) Create a temporary location in /tmp:

# mkdir -p /tmp/coreos/{squashfs,initrd,original,custom}

Step 2) Download or copy the ramdisk /tmp/coreos/original:

# cd /tmp/coreos/original/
# wget

Step 3) unzip the ramdisk:

# gunzip coreos_production_pxe_image.cpio.gz
# cd ../initrd
# cpio -id < ../original/

Step 4) Unsquash the squash filesystem and move the original-container:

# cd ../squashfs/
# unsquashfs ../initrd/usr.squashfs
# mv ../initrd/usr.squashfs ../usr.squashfs-original

Please note… that you need at least the squashFS 4.0 tools… but you can download the source and compile the binaries (at least it works on RHEL5).

And now you can access the unpacked image via /tmp/coreos/squashfs/squashfs-root and perform modifications, but please use the path minus the usr-prefix and relative to /tmp/coreos/squashfs/squashfs-root. So summarized:

/usr/lib/systemd/network/ can be found in:

So hack around and apply modification where needed.

Packing the CoreOS Customized Ramdisk

Now we have to repack the ramdisk, so we can load it…

Step 1) Repack the squashfs 

# cd /tmp/coreos/squashfs
# mksquashfs  squashfs-root/ ../initrd/usr.squashfs -noappend -always-use-fragments

Please ensure you use squashfs tools 4.0!

Step 2) Make it all a cpio archive and zip it

# cd /tmp/coreos/initrd
# find . | cpio -o -H newc | gzip > ../custom/coreos_CUSTOM_pxe_image.cpio.gz

Now boot it and use the custom image as initrd. 


Use maildrop to forward a mail to another mail box

I recently had the need to forward e-mail based on the from field to another mailbox. I know, it’s possible with a simple .forward in your $HOME, but that will forward all the mail. :-(

So after some further searching I end up with the following rule for your maildrop filter… it simply checks if the mail (in this example) is from [email protected]  and will forward it to [email protected]:

if ( /^From: .*[email protected]*/ )
        dotlock “forward.lock” {
          log “Forward mail”
          to “|/usr/sbin/sendmail [email protected]

And that’s all you need to put add to your $HOME/.mailfilter

Use Picasa RSS Feed to show album on my own website

Recently I’ve moved the web albums of my kids from my own webserver to Google Picasa. But… I wanted to keep my nice javascript based carousel :-)

In the current code I already had some PHP-code that creates the content of the carousel using an array. Now I added two new features in the ‘website’.

  1. Config files
  2. Downloading the RSS (XML) feed and cache it
  3. Extract the URLs with the photos from the XML feed.

1. Config files

One ‘global’ config:

 $cacheTTL = 60;

Per album I’ve a config.php in that directory, so for example we’ve the following content:

  $AlbumDescription=”Rick de Rijk”;

2. Download the RSS (XML) feed and cache it:

# Code that takes care of the caching
if (!(file_exists($xmlFile) &&
    (time() – $cacheTTL < filemtime($xmlFile))
  )) {
    $data = file_get_contents($xmlURL);
    $f = file_put_contents($xmlFile, $data);

3. Extract the URLs with the photos from the feed

$foto_array = array();
$xml = new SimpleXMLElement($xmlFile, null, true);

$urls = $xml->xpath(“channel/item/enclosure/@url”);

foreach ($urls as $image_url)
  array_push($foto_array, $image_url);

That’s all :-)

Mozilla Labs Weave

In one of the last Linux Magazine issues, there was an article with the title “Untangling the Web with Mozilla Weave“. I really recognized the issue of having several Firefox instances with their own bookmarks/tabs/et cetera.

So I thought… let’s give it a try, and so far… it works fine for me. I’ve now set up Weave on my Linux Laptop and Linux workstation at home. The upcoming week I will set up weave for my Linux workstation at work and on my Portable Apps Firefox on ahum Windows Vista workstation.

Bleeding edge, is indeed bleeding edge

Yesterday I thought let’s play with FC12 (aka Rawhide, aka FC11.90). So I enabled the Rawhide-repositories on my FC11 laptop and entered “yum -y update”. And after a while it was there… bleeding edge kernel and other packages.

The first issue I run into, was that Firefox 3.5 was not able to run, it caused a segfault. :-( There seems to be a bug in the xulrunner package. So I was able to fix it, by “downgrading” Firefox to 3.0.11, but that one crashed on pages using “Adobe Flash plugin”. So I removed the flash plugin, because I wanted bleeding edge Fedora. So having that “sort out” I wanted to suspend my laptop, and guess what… It didn’t want to suspend… so after some hacking around… it still didn’t work.

So my final decision was Go back to FC11. I was able to “downgrade” my system in about 60 minutes. At home I’ve a mirror repository with al the backups, so during installation I added these repositories, so I also had all the updates in one go.

Lesson learned: “Bleeding edge… is indeed bleeding edge!”

I need my work for my daily work… If I won’t need it for my daily work I would have keep FC12 (aka Rawhide, aka FC11.90) on it to participate in developing FC12.