Category Archives: Wheezy

Folder sharing with NFS

If you’re running out of space on your Pi’s SD memory card or want to share folders under Linux, you should consider using the Linux network file system (NFS). All you need to do is to install rpcbind, nfs-common and nfs-kernel-server on your Pi.

On a freshly installed you must enable the rpcbind service before you can start the nfs-kernel-server:

$ sudo update-rc.d rpcbind enable

The network file system is particularly useful if you want to merge folders across your home network which reside on different systems. In order to listen to my ogg/mp3 music collection I’ve attached a Raspberry Pi to the AUX input of my Hi-Fi equipment. The collection resides on a USB stick and can be accessed with the music player daemon (mpd) and Minion, so that I can use my smartphone as a remote. Another music collection resides on my AVM Fritz Box, which acts as a mediaserver and NAS.

Continue reading Folder sharing with NFS

What performs better on a RasPi: Apache, Lighttpd or Nginx?

As I’m hosting my blog on a Raspberry Pi, I did some research on the web about it’s performance as a server. I started this site with Apache and migrated after a while to Lighttpd which already reduced server response time (3.6 seconds, according to Google’s PageSpeed Insights it reached 72/100 points) and improved performance. With an DSL upload speed of only 676 kbit/s one shouldn’t expect miracles anyway. Google’s PageSpeed results, which suggested to make a couple of changes to my site, and a comparison of Lighttpd vs. Nginx convinced me to migrate to Nginx.

Continue reading What performs better on a RasPi: Apache, Lighttpd or Nginx?

Connecting a DS18S20 temperature sensor to RasPi

I’ve been a little reluctant to connect a DS18S20 temperature sensor to my RasPi, since there were rumors that the w1_gpio.ko kernel module exclusively requires a connection to GPIO #4, because of being hard coded. At least that’s what Lady Ada’s tutorial says about it and what one can read in several user forums. Unfortunately GPIO #4 was already occupied on my Pi. Therefore I searched through several Blogs for advice how to change the hard-coded GPIO in the kernel module. It turned out that I wasn’t the only one – so here’s the good news: In Raspbian Wheezy with Kernel 3.10.25+ it is possible to pass the desired GPIO in /boot/cmdline.txt to the kernel using the option:


To be able to read temperatures from the sensor, modprobe the wire, w1_gpio and w1_therm kernel modules. The temperature can be read from /sys/bus/w1/devices/<device_serial_number>/w1_slave.

I’m using the the sensor for outdoor temperature measurement. I soldered about 1 m wire to the sensor (TO92 housing), insulated the solder joints with heat shrink tube and embedded the sensor into an old metal ballpoint cap using epoxy glue.

WiFi trouble with smsc95xx

In the /var/log/messages file of my Raspberry Pi, which is connected through WiFi to my home WLAN, I repeatedly noticed this error message:

smsc95xx 1-1.1:1.0 eth0: unexpected urb length 0

Furthermore, I got “no route to host” messages when attempting to ssh to my  RasPi. At the same time I couldn’t connect to lighttpd. Some research with Google suggested, that there might be a problem with the USB driver. Symptoms are characterized by fluctuating transfer rates and response times as well as bad WiFi connection quality leading to delayed keyboard response or garbled input when using ssh. Fortunately, there is a  workaround:

Continue reading WiFi trouble with smsc95xx

RasPi lighttpd and server tweaks

This blog is hosted on a Raspberry Pi using the lighttpd (lighty) webserver. Since I haven’t been satisfied with the response time until a page is loaded, I applied some tweaks to increase its performance.

If you need details about your RasPi server, you can test it’s performance with Google’s online PageSpeed Insight tool. Then, follow the recommendations of the analysis results.

Most important for a good WordPress performance appears to be  CSS and Javascript concatenation/compression as well as installation of a cache plugin, such as Autoptimize and

/boot/cmdline.txt, /etc/fstab

Although I use an “ultra” Sony Class 10 (94 MB/s) SD card, performance of the ext4 journaling file system has been an issue. To increase file system throughput, I added:


to /etc/cmdline.txt, and:

/dev/mmcblk0p2  /  ext4  defaults,noatime,nodiratime,barrier=0

to /etc/fstab. These options disable storing of access times to the file system. Using data=writeback mode extends the time from when a file is written to when it is pushed out to disk to 120 seconds. Be aware that you’ll lose all cached data on a file system crash!


To tell the system to use less IO/RAM, I placed these options into my /etc/sysctl.conf

vm.dirty_background_ratio = 20
vm.dirty_expire_centisecs = 0
vm.dirty_ratio = 80
vm.dirty_writeback_centisecs = 1200
vm.overcommit_ratio = 2
vm.laptop_mode = 5
vm.swappiness = 10


Disabling keep-alive might help lighttpd if it suffers from a large number of open file descriptors. Select an event handler which takes care of notifying the server that one of the connections is ready to send or receive.

Since we want to send out a file from the webserver, it doesn’t make any sense to copy the file into the webserver just to write it back into a socket in the next step. Therefore, we enable linux-sendfile to minimize the work in the application and push the file directly into the network card.

With the help of gamin (sudo apt-get install gamin) you can use kernel events to assure that your stat cache is up to date.

server.max-keep-alive-requests = 0
server.event-handler = "linux-sysepoll" = "linux-sendfile"
server.max-fds = 1024
server.stat-cache-engine = "fam"
server.max-worker = 0

After applying these tweaks, lighty responds much faster and I observed less “The site could be temporarily unavailable or too busy. Try again in a few moments.” messages.