As we run quite a few machines with Ubuntu installed and we don't want to update each one ourselves, we installed the package unattended-upgrades which updates the package lists and upgrades the installed packages periodically.

To enable unattended-upgrades, add the following lines to /etc/apt/apt.conf.d/10periodic:

I tried to disable the automatic assembly of mdadm during boot in order to assemble it using my own script. A controller has hiccups sometimes and automatic assembly would result in degraded arrays. Unfortunately, the common hints, e.g., adding

DEVICE /dev/null or AUTO -all

to the mdadm.conf, did not work. They don't work because the initramfs script (at least on Ubuntu) does not use the system's mdadm.conf in case there is no ARRAY line in the file and regenerates a new one for the initramfs. In my case, I did not specify an array as auto detection worked perfectly. So, after including an ARRAY statement and updating the initramfs, the arrays did not get assembled automatically anymore.

Assume you have an application that is bound to a machine with a certain hostname, MAC address or hostid. If this machine shall be replaced and you don't want to setup a new (virtual) machine just for this application, you can follow these explanations to start this application in a light-weight container using library preloading and Linux namespaces on an arbitrary machine.

The script and source code can also be found in my Github repository.

To pretend a certain MAC address or hostname, we can use Linux namespaces and create a virtual ethernet device with the required MAC and set an arbitrary hostname without disrupting the operation of other processes. New namespaces for a child process can be created with the unshare command. In this case we create a new network and UTS namespace:

unshare -n -u <child_command>

Afterwards we create a pair of virtual ethernet (host0 and guest0) devices with:

ip link add name host0 type veth peer name guest0

To move the guest0 interface into the new namespace we use the following command:

ip link set guest0 netns $pid_of_child_cmd

In the following, we can set custom IP and MAC addresses on both interfaces.

In order to modify hostname resolution, we build a library that intercepts calls to the libc. The resolution is done by the gethostbyname function. Therefore, we create the following function that first gets the address of the real gethostbyname in libc and then returns either the resolution of "newhost" in case the application requests "oldhost" or the real host for all other names.

struct hostent * gethostbyname(const char *name) {
(!real_gethostbyname) {
= dlsym(RTLD_NEXT, "gethostbyname");
  if (!strcmp(name, "oldhost")) {
else {

To use this library, we have to call our application in the following way:

LD_PRELOAD=/path/to/ myapplication

If the application offers services over the network, one can use well-known port forwarding mechanisms in the host namespace, e.g., iptables or socat.



Create a GPT partition table with gdisk that automatically takes care of 4k disks:

gdisk /dev/sdX

press "n" for "new partition" and choose the defaults for following questions to create a partition that uses the whole disk. Afterwards, write the changes with "w" to the disk.

Create an encrypted LUKS container, ArchWiki suggests to use aes-xts-plain64 instead of aes-xts-plain for disks >2TB:

cryptsetup -c aes-xts-plain64 -s 512 luksFormat /dev/sdX1

"-s 512" sets the encryption to AES-256 (no typo). Afterwards open the container with:

cryptsetup luksOpen /dev/sdX1 mycontainer

This creates a file /dev/mapper/mycontainer that we use as new target to create the Btrfs filesystem:

mkfs.btrfs -L mylabel /dev/mapper/mycontainer

Now mount the new filesystem:

mount /dev/mapper/mycontainer /mnt/mycontainer/


Different guides suggest to immediately create a subvolume as it eases further operations, e.g. rollbacks:

btrfs subvolume create /mnt/mycontainer/main

Afterwards, we set this subvolume as default:

btrfs subvolume set-default main /mnt/mycontainer/main

Unmount and remount the new default volume:

umount /mnt/mycontainer/
mount /dev/mapper/mycontainer /mnt/mycontainer/

If you want to mount the root volume later, use:

mount /dev/mapper/mycontainer /mnt/mycontainer/ -o subvol=/


If you decide that redundancy would be good afterwards, you first add a second device:

btrfs device add /dev/sdY1 /mnt/mycontainer/

and to truly mirror the data, you have to start a balance run with:

btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/mycontainer

The progress of this operation can be checked with:

btrfs balance status /mnt/mycontainer/


After switching to CSSU-thumb, which improves load times and responsiveness on the n900 by using the Thumb2 ISA of ARM, I tried to test the latest Nemo Mobile release. I reinstalled the u-boot bootloader and setup the menu entries. However, after a reboot neither Nemo nor Maemo booted and I only got into the u-boot console. If you don't have your tools/cables at hand to reflash from the PC, you can do the following to boot Maemo with a kernel from a SD card:

  1. Put the SD card into your PC and mount /dev/sdX1 and /dev/sdX3. The latter must use a FAT filesystem (I used a SD card with the Nemo partitions on it).
  2. Get flasher 3.5. As the Nokia website is not available anymore you can use this mirror
  3. Get the latest kernel-cssu package, e.g., this one
  4. Unpack the .deb using
    ar x kernel-cssu_2.6.28-10cssu3_armel.deb
    tar -xvzf data.tar.gz
    and afterwards you'll get a file similar to boot/zImage-
  5. Extract the kernel from this file using
    flasher-3.5 -F zImage- -u
    convert the resulting zimage to an uimage using
    mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n maemo \
    -d zImage uImage
    and place the uimage into the filesystem of /dev/sdX3.
  6. Create a file, e.g., uboot-maemo.cmd, with the following content (remember that \ means you should put the following line at the end of this line without the \ ):
    setenv setup_omap_atag 1
    setenv bootcmd 'fatload mmc 0:3 0x86008000 uimage; bootm 0x86008000;'
    setenv bootargs 'init=/sbin/preinit ubi.mtd=rootfs root=ubi0:rootfs \
    rootfstype=ubifs rootflags=bulk_read,no_chk_data_crc rw console=ttyMTD,log \
    console=tty0 snd-soc-rx51.hp_lim=42 snd-soc-tlv320aic3x.hp_dac_lim=6' boot
  7. With the following command we create a boot.scr from this file that should be placed in /dev/sdX1:
    mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n mybootmenu \
    -d uboot-maemo.cmd boot.scr
  8. Unmount the partitions, put the SD card into the n900, reboot the device and make sure that the keyboard is open (so you'll see the u-boot menu)
  9. Select u-boot console in the menu and type
    run sdboot
    This executes the boot.scr from the SD card and afterwards Maemo should boot and you can reflash a working kernel from within Maemo. Sometimes Maemo doesn't start after the first attempt, please try to boot it 2-3 times in a row before you try something else.



Librapl is a library that simplifies access to the RAPL values in MSR registers of modern Intel CPUs, e.g., SandyBridge or IvyBridge processors. It also contains a sample application that can either print the current energy consumption on the console or write the values with a Gnuplot-friendly format in a file. Currently it provides the consumption of the package, the CPU and GPU as well as peripheral components (uncore).

Source code: librapl on Github

Example of librapl with Gnuplot on a 4-core IvyBridge processor:

RAPL diagram

mplugd is a daemon that listens on events (e.g. xrandr or pulseaudio) and executes user-defined actions on certain events. In contrast to other approaches, it listens to events by registering callback handlers instead of polling and parsing tool output. Event processing is done through a threaded producer/consumer architecture that can be extended by plugins to insert new event types. Actions can be defined using INI-like rule files or simple scripts.

A common use-case is automatic configuration of plugged-in devices like HDMI or DisplayPort displays including switch of audio output using pulseaudio.

Source code: mplugd on GitHub