Hardware Linux

Yard Sale: Raspberry Pi’s

Today I’m selling Raspberry Pi’s.


4 are unused, new, in packaging. I have a couple more (about 6) who got used for a couple of hours, but never anything serious.

I am also selling the power adapter and the laser cut casing.

 IMG_20140417_172914_2 IMG_20140417_172909_2

Raspberry Pi: €30,49/item (type B – 512 Mb RAM)

PSU: €4.45/item

Casing: €4/item

Possible on invoice.

Contact: [email protected]

Hardware Linux Software

Munin + Raspberry Pi + temperature: updated

I got a mail in my inbox about a week ago from Anthony, telling me how to improve my Munin & temp script for a RPi:


I just read your (old) blog post about monitoring the temperature of the Raspberry Pi with munin[1].

I had the exact same error as you did when I was trying to let munin do the job all by himself:

> temp.value VCHI initialization failed)

It turns out the solution was quite easy: in


You simply need to tell munin that it needs to run as root for this specific plugin:

> [pisense_]

> user root

(the plugins also tracks clock speeds and voltages but any other will work just fine as long as the “user root” is set in the munin-node plugin config file : [2]). Probably the easiest way to check if it’s working is to use munin-run command before and after the change.

“Demo”: [3]

By the way, “Connect different LANs over openVPN” is pretty tempting, I always wondered what the performances would be like through a USB-to-ethernet adapter.

Have a nice one !



And indeed, I knew it was a permission issue, but instead of running this script as root, I tried adding Munin to a group that was supposed to be able to run  vcgencmd (which didn’t work out).

But, let’s look at a simpler solution:

  1. Go to /etc/munin/plugins and create a file temp with this content (and some indentation yourself):
    case $1 in
    cat <<'EOM'
    graph_category system
    graph_title Temperature
    graph_vlabel temp
    temp.label Celsius
    exit 0;;
    echo -n "temp.value "
    /opt/vc/bin/vcgencmd measure_temp | cut -d "=" -f2 | cut -d "'" -f1
  2. As you noticed, this doesn’t require any more scripts to run from cron (and thus, in case you used my previous script, remove it from cron)
  3. chmod +x temp
  4. Make sure it runs as root; in /etc/munin/plugin-conf.d create the file temp.conf with this content:
    user root
  5. Test it:
    # munin-run temp
    temp.value 59.5

Tadaaaa. Simpler.

Thanks Anthony 🙂


Why historical data matters (and is just cool to look at)

CPU temperature from a Raspberry Pi (behind the display, in the wall).

temp(zoom in)



Linux Networking Software www

Raspberry Pi + ad blocking + nginx

There’s this howto that explains how to set up the RPi as ad blocker.

I’ve two RPi’s acting a router and was already running dnsmasq. I decided to give it a try. Note that this howto can actually be used on any DNS serving Linux server.

First of all, don’t go with the pixelserv as it crashes after a few minutes.

Apache is an option that worked fine. A general hint: if you’re already running Apache or whatever on port 80, just add a 2nd static IP and make Apache listen to that.

For example (/etc/network/interfaces) — be sure it’s in the same subnet:

auto eth0:0
iface eth0:0 inet static
 broadcast is the Apache IP that just serves a HTTP 200 (or 204).

Here’s the relevant config part (note the HTTP 204 code, more info on that later):

<VirtualHost adblock:80>
 ServerAdmin [email protected]
 DocumentRoot /var/www
 <Directory />
 Options FollowSymLinks
 AllowOverride All
 <Directory /var/www/>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
 RewriteEngine on
 RedirectMatch 204 (.*)$
 ErrorDocument 204 " "

ErrorLog ${APACHE_LOG_DIR}/error.log
 LogLevel warn
 CustomLog ${APACHE_LOG_DIR}/access.log combined

And edit /etc/hosts to add “adblock”: adblock.local adblock

If I had used the IP instead of adblock I would have had this error:

# apache2ctl configtest
[Mon Sep 16 20:27:21 2013] [error] (EAI 2)Name or service not known: 
Failed to resolve server name for (check DNS) 
-- or specify an explicit ServerName
Syntax OK

With the HTTP 200 code, some browsers expect some content/file in return. So it’s generally safer to use HTTP 204 “No Content“; which basically means “all good but I have nothing to serve you.”

Now, I call myself an nginx fan. Running Apache on a RPi is a no go (at least for me). I could’ve ran nginx on the RPi, but decided to run it on a remote server with an additional IP. At least for now. To preserve resources on the RPi.

Here’s the relevant config to run it on nginx (and be sure this config is the first file nginx parses; or it might redirect all the domains to some other site):

server {
 listen 80;
 server_name _;
 access_log /var/log/nginx/pixel.access.log;
 error_log /var/log/nginx/pixel.error.log;
 expires max;
 autoindex off; 
 rewrite ^(.*)$ /;
 location / {
  return 204 'pixel';

And if we test it, this is what we get:

HTTP/1.1 204 No Content
Server: nginx/1.4.0
Date: Mon, 16 Sep 2013 18:36:52 GMT
Connection: close
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000

And that’s it.

<3 nginx

The only downside is that this won’t work with HTTPS. You can run your webbrowser with a self signed certificate, but this will throw errors…

The result:


Hardware Linux Software

Munin + Raspberry Pi + temperature

Quick hack to get Munin to graph the cpu temperature.


First of all, install Munin and make sure it’s working.

Then follow these steps:

1) We’ll use cron to write the current temp to a log file. We do this because I wasn’t able to get Munin to directly execute the command (error: temp.value VCHI initialization failed)

Execute crontab -e and add this line (this has to be on one line):

*/5 * * * * /opt/vc/bin/vcgencmd measure_temp | cut -d "=" -f2 | cut -d "'" -f1 > /tmp/.temp

2) Go to /etc/munin/plugins/, and create a file temp, and add this content:

case $1 in
cat <<'EOM'
graph_category system
graph_title Temperature
graph_vlabel temp
temp.label Celsius
exit 0;;
echo -n "temp.value "
cat /tmp/.temp

Save and exit the editor.

I’m not sure this is needed, but better do it: chmod +x temp

3) restart munin-node (/etc/init.d/munin-node restart)

4) test if it’s working:

# telnet localhost 4949
Connected to localhost.
Escape character is '^]'.
# munin node at
fetch temp
temp.value 57.3

That’s it. Your munin daemon/host should now correctly graph the temperature.

Edit (8/2/2014): updated script can be found here.