Add a minimize button to elementary (beta 1)

Note: this script is only for elementary beta 1 users: users of subsequent daily builds only need to run the gsettings command below to get the minimize icon to appear, since it is now included.

The default theme in elementary OS beta1 doesn’t have a minimize icon (by design).

Here is a script (alternative download option here) that will give you a working minimize button in elementary OS.

The file should be unzipped and then executed from within the extracted folder. The script will copy the new minimize icons into the appropriate directory, and the necessary xml file to modify the theme, and finally will implement your choice of gsettings command to add the minimize feature to your window.

After running the script, if you change your mind about the location of the button, you need to provide the appropriate gsettings command to change the gala button layout e.g.
gsettings set org.pantheon.desktop.gala.appearance \
button-layout 'close:minimize,maximize'

Thanks go to Valpskott for providing the script and better minimize icons.

Posted in elementary, Linux, tweaks | 17 Comments

Power monitoring with linux…the low-energy way

Some time ago I acquired a Current Cost CC128 monitor, which, on its own is quite an interesting but limited way to check the current power usage, by glancing at the display, especially to check that devices are turned off before bed.

Crucially, the monitor comes with a RJ45 to USB cable which allows a connected device to collect power and temperature data every 5 seconds. I’ve always wanted to get a better overall idea of power usage but I would need to leave my PC on all of the time – surely that’s against the idea of power-saving?

Some years ago I purchased a linksys nslu2 , an ARM-powered device drawing 5W power. I had already installed debian 5 [3] for my household rsync backups.

I set out to investigate the various methods of extracting data from the device, and plotting the information on a  range of graphs, with the unique limitation that I have a Debian NSLU2 with a 266Mhz de-underclocked ARM processor, and a 2GB filesystem running from a USB stick – so no big databases, heavy web servers or high load. Could such a lightweight device provide for all my requirements?

I found some useful sites that saved me a lot of time in getting this setup , and decided that rrdtool and lighttpd were going to meet my needs. Another great thing about rrd is the tiny database size.

So I started by installing the prerequisites with a

apt-get install libdevice-serialport-perl rrdtool lighttpd ntpdate

Then i created the rrd [7] with help from Paul Mutton’s site – I tweaked the script from the same site to to suit my particular monitor model (additionally with info from here), which writes the data into the rrd every 5 seconds (resulting script) , then added a crontab entry to run a script every five minutes to produce graphs of hourly, weekly and monthly usage.

Finally, I setup a basic index page, served from the lighttpd web server running on the NSLU2, so I can see my graphs all at once.

Here’s my power graphs (10 min, 1hr, 1day, 1 week)

Initially I did this to get an idea of my power usage in a power-efficient way. However, I have a young child and am interested in the temperature of my home. The resulting temperature graphs have helped me to ensure the house doesn’t get too cold overnight in winter, and to set the thermostat suitably – possibly of more use than the power graphs!

I anyone is interested in doing something similar. the raspberry pi model B will be released in early 2012. It will be cheap, have higher specifications that the NSLU2 and can optionally be run from batteries rather than a wall socket.

Posted in Linux, ubuntu-uk | 1 Comment

msttcorefonts on RHEL6 / Centos 6 / SL6

msttcorefonts is a way of obtaining the Microsoft TrueType fonts on Linux. However, version 6 release of Red Hat Enterprise Linux no longer includes a pre-requisite of msttcorefonts package, namely chkfontpath, which in turn, relies on the font server package xfs.

The latest version of msttcorefonts at sourceforge doesn’t cater for this, so in the meantime we can patch the spec file and build it ourselves.

1) Download the spec file from
2) Patch the spec file. Create a file called msttcorefonts.rhel6.patch, containing the following:

--- msttcorefonts-2.0-1.spec	2011-09-05 11:09:57.206756336 +0100
+++ msttcorefonts-2.0-1.1.spec	2011-09-05 11:23:56.925761649 +0100
@@ -19,8 +19,8 @@
 BuildPrereq: %{ttmkfdir}
 BuildPrereq: wget
 BuildPrereq: cabextract
-Prereq: /usr/sbin/chkfontpath
-Packager: Noa Resare <>
+#Prereq: /usr/sbin/chkfontpath
+#Packager: Noa Resare <>
 The TrueType core fonts for the web that was once available from
@@ -152,7 +152,7 @@
 if test $1 -eq 1
-	/usr/sbin/chkfontpath --add %{fontdir}
+	ln -s /usr/share/fonts/msttcorefonts/ /etc/X11/fontpath.d/msttcorefonts
 # something has probably changed, update the font-config cache
 if test -x /usr/bin/fc-cache
@@ -163,7 +163,7 @@
 if test $1 -eq 0
-	/usr/sbin/chkfontpath --remove %{fontdir}
+	/bin/rm -f /etc/X11/fontpath.d/msttcorefonts

3) Patch the spec file by running the following command in the same directory as the .spec file and the .patch file

patch < msttcorefonts.rhel6.patch
Visually inspect the resulting spec file to verify that it no longer requires chkfontpath.

4) Rebuild the rpm package using the new spec file
rpmbuild -bb msttcorefonts-2.0-1.spec

5) Finally, copy the resulting RPM to your local repository, or install locally with
yum localinstall msttcorefonts-2.0-1.noarch.rpm

Posted in Linux, RHEL | Tagged , , , , , , , , | 14 Comments

Disable disk caching in Chromium

Google’s Chromium browser doesn’t offer a menu option to disable disk caching. Users concerned with reducing wear on SSD drives and those with super-fast internet connections may wish to use this facility.
By running chromium with the command line option:


We can effectively disable the chromium cache.

To make the change permanent, edit the Ubuntu launcher for chromium as follows, and then drag to your dock as required.

Since chromium-browser --help doesn’t give us a full list of switches, we can inspect the source code here and find other command line options.

Posted in Linux, tweaks, Ubuntu, Uncategorized | 6 Comments

RHEL/Centos/Scientific Linux 6.0: PXE install fails due to missing network driver

I experienced an issue trying to run a networked install of SL6.0 on a Dell Optiplex 380 with a Broadcom 57780 network card. The install fails to download the kickstart file due to a missing driver in the pxe kernel. This card uses the tg3 driver, which in turn loads the broadcom driver.

Pre-requisites: a kickstart/PXE server, a working RHEL/Centos/SL machine to obtain the broadcom.ko file (found in /lib/modules/`uname -r`/kernel/drivers/net/phy)

To resolve:

#make a scratch dir
mkdir -p $basedir; cd $basedir
# download the initrd.img (i have a copy on my kickstart server)
wget http://kickstart/install/SL60/images/pxeboot/initrd.img
# unpack the file.
gunzip -c --suffix=.img ../initrd.img | cpio -i
#now let's move the original file out of the way
mv initrd.img ../initrd-original.img
# assuming you are on a working 6.0 install, you can do the following
cp /lib/modules/`uname -r`/kernel/drivers/net/phy/broadcom.ko $basedir/modules/`uname -r`/kernel/drivers/net/phy
gzip $basedir/modules/`uname -r`/kernel/drivers/net/phy/broadcom.ko

Now add the word “broadcom.ko” without quotes on a new line to the file: $basedir/modules/`uname -r`/modules.networking

#now run depmod to create modules.dep files
depmod -b $basedir
# finally, ensure we are in $basedir; remove the original initrd.img repackage the initrd
cd $basedir
find ./ | cpio -H newc -o > ../initrd-new.cpio
cd ../
gzip initrd-new.cpio
mv initrd-new.cpio.gz initrd-modified.img

Now scp the file to the /tftpboot directory of your PXE server, and edit your pxe config file to use initrd-modified.img instead of initrd.img (or change this temporarily on the grub command line on your next boot to test)

Update: this is resolved in Scientific Linux 6.1 (therefore Centos and RHEL too)

Posted in Linux, RHEL | Tagged , , , , , | 2 Comments