Category Archives: raspberrypi

First steps after you got your Raspberry Pi

Those are the very first steps that you should do right after you received your Raspberry Pi, downloaded the SD images, booted it and randomly played with it for one week. 😀

Change the password: most important step if the Raspberry Pi will be connected to the Internet.

$ passwd

Quick configuration: these are available in Raspbian‘s raspi-config script.

# dpkg-reconfigure keyboard-configuration
# dpkg-reconfigure locales
# dpkg-reconfigure tzdata

Test your SD card:

# dd if=/dev/mmcblk0 of=/dev/null bs=512k count=256 iflag=direct
256+0 records in
256+0 records out
134217728 bytes (134 MB) copied, 6.13969 s, 21.9 MB/s
# dd if=/dev/zero of=/root/test bs=512k count=64 oflag=direct
64+0 records in
64+0 records out
33554432 (34 MB) copied, 10.4764 s, 3.2 MB/s
# rm /root/test

SD card performance should match its class. My SD card is a class 4, so write speed must be around 4 MB/s. Also, slow read speeds could indicate problems.

Update your distro:

# apt-get update
# apt-get upgrade

Improve network configuration: this makes the Pi less dependent on having an external router by adding a permanent static IP address and activating NAT. Skip the network configuration if your Raspberry will always have a router around.

# echo net.ipv4.ip_forward=1 >> /etc/sysctl.conf
# cat << EOF >> /etc/network/interfaces
iface eth0:fixed inet static
 up iptables -t nat -A POSTROUTING -o eth0 -s -j MASQUERADE
 down iptables -t nat -D POSTROUTING -o eth0 -s -j MASQUERADE

This extra entry (together with the default dhcp interface rule) allows the following scenarios: rasp pi directly connected to your internet modem (using DHCP address); rasp pi connected to computer (using static address); rasp pi connected to a modem (using DHCP address) and computer (using static address and doing internet connection sharing); rasp pi connected to modem and computer, only the computer connected to the internet (the difference in this case is that the computer got the DHCP address from the modem first).

Now write the startup script:

# cat << EOF > /etc/ifplugd/action.d/ifupdown-more
 set -e

if [ "$1" != "eth0" ]; then

case "$2" in
 /sbin/ifup $1:fixed
 /sbin/ifdown $1:fixed
# chmod +x /etc/ifplugd/action.d/ifupdown-more

This is similar to the standard “ifupdown” script and allows automatic interface configuration.

Configure the static connection to Raspberry Pi on your main desktop machine:

# cat "/etc/NetworkManager/system-connections/Raspberry NAT"

The dns line above needs to have some random DNS server, for example, I used Google’s (alternatively install DNS proxy support in the Pi). Use the above connection profile in your main machine when using the Pi as a router.

Add a friendly name to Raspberry Pi:

# echo prosraspberry >> /etc/hosts

This is also in the desktop machine, an easy name to find the Pi. Now connect both machines together and test ssh:

# ssh pi@prosrasperry
The authenticity of host 'prosraspberry (' can't be established.
 RSA key fingerprint is 33:95:41:c6:d4:06:8b:79:7e:e4:01:fb:17:39:ed:93.
 Are you sure you want to continue connecting (yes/no)? yes
 Warning: Permanently added 'prosraspberry' (RSA) to the list of known hosts.
 pi@prosraspberry's password:
 Linux raspberrypi 3.2.27+ #160 PREEMPT Mon Sep 17 23:18:42 BST 2012 armv6l
pi@raspberrypi ~ $

Finally, copy the public key from your main machine to the Pi.

$ scp ~/.ssh/ pi@prosraspberry:id_rsa.tmp
$ ssh pi@prosraspberry
$ cat id_rsa.tmp >> ~/.ssh/authorized_keys
$ rm id_rsa.tmp

And that’s it. The main point of this initial configuration is that now Raspberry Pi should be completely usable anywhere. You just need a power cable and an ethernet cable to connect to it ! 🙂


I own a Raspberry Pi !

Last week I received my Raspberry Pi. It was not that easy, me and some coworkers tried to import them directly from the UK, but they were not available and we would need to wait for weeks. We were able to cancel the order and buy from Farnell small stock here in Brazil. So it’s true, Raspberry Pies do reach Brazil !

For curiosity, and also to show the Brazilian broken imports regulation, each Raspberry cost us US$ 83,00 (€ 64,00) !!! That’s almost two and a half times the price of a Raspberry, mainly because of the import taxes at 60%. This tax is supposed to protect the Brazilian semiconductor industry, but that industry is non existent. On top of that there is another tax that further expands the value of the import tax, the two combined reaching almost 100%. If we had managed to import it directly from UK, it would have been even more expensive, at around US$ 100,00.

Now for the pictures !

First impressions: I had some goals for the Raspberry Pi. First was to use it as a general server and router at home. The second was to use it as a portable cool “pseudo-notebook”. The third was to have an ARM machine, for study and for fun. My initial view is that the Raspberry Pi is somewhat disappointing for some of these goals, specially number two. In particular I noticed that the board is unable to do web browsing at reasonable performance, taking many seconds to respond to interactive use.

Taking a look at the forums, this is confirmed by a general agreement that rasppi had the specific goal as being a learning device for students and never meant to do web browsing in general. Also I’ve noticed that the rasppi is very dependant on the SD card performance, the minimum officially recommended (a class 4 SD card) not being enough for my goals. At least, there’s some effort being done to overcome part of the performance issues. 🙂