Dynamic DNS – open up your Pi’s webserver to the World

I’ve installed Raspcontrol by Jacob Clark along with Apache and PHP. I did a guide for that in a previous post.

What I want to do now is to get the webserver running it open to the World.
I’m on a dynamic IP with my ISP (I think!) so I want a way of getting the Pi to use some kind Dynamic DNS  so I can refer to it by hostname.

I looked around for Dynamic DNS providers and found DNSDynamic.org
Looking at http://www.dnsdynamic.org/api.php, I can see they have an API that can be configured with ddclient, whatever that is. It’s got an obscure name, so it’s probably linux!

So first of all:

  • Go to www.dnsdynamic.org and register.
  • Then, once you’ve validated using their registration email, add a new domain.
  • For the purposes of this tutorial, let’s go with
    wibble.dnsdynamic.com

Then:

  • Start the Pi, login as root and then:
  • apt-get install ddclient

That installs and I automatically get an interface pop up on my screen:

So I choose other…

  • Asking me for the name of the provider server, so let’s put in www.dnsdynamic.org
  • DNS Dynamic uses the dyndns2 protocol, so choose that.
  • Enter your username and password.
  • It now asks for the network interface to use. Now, I use Wifi, so I put in wlan0, but if you are using a cabled LAN connection, you’ll use eth0.
  • Now enter your domain – wibble.dnsdynamic.com
  • At this point, ddclient will configure itself. At this point, I rather hope that it tells me what it does next!
  • Okay, so it installs more stuff…
  • Interesting… the installation completes and… tells me nothing…
  • Right, looking at the ddclient documentation it tells me where the configuration file is. Not quite right in the documentation – the config file is at /etc/ddclient.conf
  • Apparently, the way to run it automatically is to add the following to your /etc/rc.local:
    /usr/sbin/ddclient -daemon 300 -syslog
  • The ‘300’ is the number of seconds it should wait before checking to see if the IP address has changed. I think this is fine, even for my wifi connection with it’s customary 2 minute connection delay.
  • So, let’s try it!
You check your IP address by going to dnsdynamic.com, logging in, going to “manage” and editing your existing domains.
If you are behind a router (and let’s face it, who isn’t!?) then this will (incorrectly) show your INTERNAL IP address. (Mine says 192.168.1.80 for instance). We don’t want that, so I found a help page: http://superuser.com/questions/389125/ddclient-updating-to-local-ip-instead-of-public-ip
To fix:
  • Edit /etc/ddclient.conf (for example > nano /etc/ddclient.conf)
  • Change the line
    use=if, if=wlan0
    and add a # in front of it.
  • Add the line
    use=web, web=checkip.dyndns.org
  • Save and quit.

You  need to kill the current ddclient and restart it:

  • ps -ef | grep ddclient
  • Make a note of the process id (which is the first number on the left)
  • kill -9 <process id>
  • Then re-run ddclient by typing:
  • ddclient

This will run it in the background and update the dynamicdns.org IP address to your external ip.

Go back to dnsdynamic.org and check your existing domains again. You should have your external IP address showing now. (I did).
You should now be able to: ping wibble.dnsdynamic.org and get that same IP address back.
The next thing to do is to do a port forward on your router. There are various guides to do this. You will need to point port 80 (HTTP) of your router at your INTERNAL IP address, port 80, or however your router identifies the destination. (Assuming that’s the port your webserver is running on).
I managed to do this on my BT Home Hub without much trouble
Now, to test it. First of all you cannot just put your dynamic DNS hostname into your browser and expect it to work. I think it’s got something to do with looping back to yourself.
So, go to www.proxify.com and type your wibble.dnsdynamic.com into there. You should get your Pi’s homepage! Wahey!

Headless Raspberry Pi – Tell me my IP address!

What is my IP address and can you email it to me?
Instructions for getting your IP address emailed to you can be found on the RPi wiki
It works. Yay.

What is my IP address, and can you tell it to me?
This is to get the Pi to find it’s own IP address and tell you vocally over the 3.5mm audio jack.
First of all, you need to install Festival, which is the text-to-speech converter.

Installation

  • Install the Festival package
    • apt-get install festival
  • Install the alsa utilities/drivers if you do not already have them
    • apt-get install alsa-utils
  • Edit /etc/modules
    • Make sure that
      • snd_bcm2835
    • is in the file.
    • Once it is (it might be already) you do not need to do the modprobe again after each reboot.
  • Push audio to the 3.5mm jack
    • amixer cset numid=3 1
  • (If you want to put it back to automatic, or HDMI, change it to 0 (auto) or 2 (HDMI))

Test out your audio

  • Do the following:
    • su root
    • cd /opt/vc/src/hello_pi
    • ./rebuild.sh
    • cd hello_audio
    • ./hello_audio.bin
  • You should hear something like a siren run through a bad 50s sci-fi tv show.
  • Let’s try testing ‘aplay’ to see if that works. Use one of the ‘alsa’ sample files.
    • aplay /usr/share/sounds/alsa/Front_Center.wav
  • Yes! It works. Dull, but it works.
  • Install mplayer:
    • apt-get install mplayer
  • Edit /etc/mplayer/mplayer.conf. Add the following line:
    • nolirc=yes
  • mplayer /usr/share/sounds/alsa/Front_Center.wav
  • Yes! Works!

Try out Festival

  • To make Festival say hello, try this:
    • echo “Hello” | festival –tts &
  • YES! It spoke to me!!! Woo-hoo!!!

The Script and running it

  • Return to your root folder:
    • cd /root
    • mkdir bin
    • cd bin
  • Create and edit a file called: say_my_ip_address.sh and use this:
#!/bin/sh
# First of all, see if you have an IP address yet
echo `hostname -I` > /tmp/check_ip.out
_CHECK_IP=`cat /tmp/check_ip.out`

# Find the length of the IP address
_LEN=`expr length $_CHECK_IP`

# Check the length of the IP address and make sure it’s sensible
if [ $_LEN -gt 3 ]; then
        # Construct your string to push to Festival
        echo “” > /tmp/shoutout.tmp
        echo “I am, a, Raspberry Pi. My I,P address is. ” >> /tmp/shoutout.tmp

        # This is so the IP address is said ‘nicely’
        for EACH in `hostname -I | grep -o -e “[^.]*”`; do
                for BIT in `echo $EACH | grep -o -e .`; do
                        echo $BIT >> /tmp/shoutout.tmp;
                        echo “. ” >> /tmp/shoutout.tmp;
                done
                echo “dot. ” >> /tmp/shoutout.tmp;
        done

        # And a bit of optional retro War Games!
        echo “. Would you like to play a game?” >> /tmp/shoutout.tmp
        cat /tmp/shoutout.tmp | festival –tts
        rm /tmp/shoutout.tmp
        rm /tmp/check_ip.out
else
        # If the IP address is not valid, report vocally and delayed re-run
        echo “I do not yet have an I,P address” | festival –tts
        sleep 5
        /root/bin/say_my_ip_address.sh 2&>/dev/null
fi

(All those fullstops and commas space out the words so it sounds like an IP address!)
  • Save and quit.
  • Make the file executable:
    • chmod a+x say_my_ip_address.sh
  • Edit /etc/rc.local
  • Add the following lines:
sudo -u root /root/bin/say_my_ip_address.sh &>/dev/null
  • And reboot
  • Don’t forget to have your earphones plugged in!

Command Line experiments

Trying a few things out on my Pi from various blogs.
NB: this is a stream-of-consciousness experimentation post. I will re-post the most exciting part (text-to-speech) in another part, all cleaned up!

RPi Blog – Optimizing for a headless install
Now, I do use the desktop environment, so not doing the first bit.
But, I like the idea of speeding the terminal login up. So:
Result: Yeah, it speeds it up by a couple of seconds.


Fusion Strike – Free up RAM
free -m
sync
edit /proc/sys/vm/drop_caches
change the 0 to 3 and save
free -m
You should see a drop in memory usage.
Result: I did! 3 MB more free

What is my IP address and can you email it to me?
I just followed the instructions from the wiki
It works. Yay.

What is my IP address, and can you tell it to me?
This is to get the Pi to find it’s own IP address and tell you vocally over the 3.5mm audio jack.
First of all, you need to install Festival, which is the text-to-speech converter.

  • apt-get install festival

Takes a while, it’s about 20MB.
Plug your earphones/speakers into the 3.5mm jack
Right, apparently this should work:

  • echo “Hello” | festival –tts

But it doesn’t.
So, moving onto…
http://www.raspberrypi-spy.co.uk/2012/06/raspberry-pi-speakers-analog-sound-test/

  • apt-get install alsa-utils

Well, apparently that’s already installed.

  • modprobe snd_bcm2835
  • amixer cset numid=3 1
  • This last command should turn the analogue output (i.e. the 3.5mm jack) on.
Right, now build the test audio file:
  • cd /opt/vc/src/hello_pi
  • ./rebuild.sh
  • cd hello_audio
  • ./hello_audio.bin
  • You should hear something like a siren run through a bad 50s sci-fi tv show.
Now to get something working properly. Festival would be lovely, but right now I’d settle for anything that could just play SOMETHING without compiling it first!
  • Get mplayer:
    • apt-get install mplayer
  • mplayer doesn’t appear to be able to play the test file I downloaded.
  • Let’s try using aplay… There are some samples in a directory from a package called ‘alsa’, so let’s use one of those.
  • aplay /usr/share/sounds/alsa/Front_Center.wav
  • Yes! Works. Dull, but it works.

Let’s try a different audio package called ‘sox’.

  • sudo apt-get install sox
  • sox /usr/share/sounds/alsa/Front_Center.wav -t alsa default
Nope that didn’t work.
Okay, let’s at least make sure that that modprobe command is automatically sorted out on reboot.
  • Edit /etc/modules
  • Make sure that snd_bcm2835 is in the file.
  • Once it is (it might be already) you do not need to do the modprobe again after each reboot.
Right, let’s get back to the text-to-speech
  • Okay, let’s try mplayer again
  • mplayer /usr/share/sounds/alsa/Front_Center.wav
  • Nope, nothing. Get an error about not being able to open socket…
  • Moving on to  https://bbs.archlinux.org/viewtopic.php?id=40013
  • Edit /etc/mplayer/mplayer.conf
  • Add nolirc=yes
  • And run that mplayer command again.
  • Yes! Works!
  • Try Festival again
  • echo “Hello” | festival –tts &
  • YES! It spoke to me!!! Woo-hoo!!!
  • You can also use ax206geek’s script to use Google’s text to speech engine. Create a file called speech.sh:

#!/bin/bash

say() {
local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols “http://translate.google.com/translate_tts?tl=en&q=$*”; }
say $*
chmod u+x speech.sh
And then call it using: ./speech.sh Hello Dave
That works, too!
Now, I want to get the Pi to email me AND speak the IP address.
I can do that…
  • As root…
  • cd ~/
  • mkdir bin
  • cd bin
  • NB This script works for Google email accounts. Change the smtp server for other email hosts.
  • create/edit a file called ’email_ip_address.py’
import subprocess
import smtplib
import socket
from email.mime.text import MIMEText
import datetime
# Change to your own account information
to = ‘<where you want it sent>’
gmail_user = ‘<google email login address>’
gmail_password = ‘<google email password>’
smtpserver = smtplib.SMTP(‘smtp.gmail.com’, 587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(gmail_user, gmail_password)
today = datetime.date.today()
# Very Linux Specific
arg=’ip route list’
p=subprocess.Popen(arg,shell=True,stdout=subprocess.PIPE)
data = p.communicate()
split_data = data[0].split()
ipaddr = split_data[split_data.index(‘src’)+1]
my_ip = ‘Your ip is %s’ %  ipaddr
msg = MIMEText(my_ip)
msg[‘Subject’] = ‘IP For RaspberryPi on %s’ % today.strftime(‘%b %d %Y’)
msg[‘From’] = gmail_user
msg[‘To’] = to
smtpserver.sendmail(gmail_user, [to], msg.as_string())
smtpserver.quit()
  • Save & quit
  • chmod a+x email_ip_address.py
  • Now create/edit another file: say_my_ip_address.sh
#!/bin/sh
echo `hostname -I` > /tmp/check_ip.out
_CHECK_IP=`cat /tmp/check_ip.out`
_LEN=`expr length $_CHECK_IP`
if [ $_LEN -gt 3 ]; then
        echo “” > /tmp/shoutout.tmp
        echo “I am, a, Raspberry Pi. My I,P address is. ” >> /tmp/shoutout.tmp
        for EACH in `hostname -I | grep -o -e “[^.]*”`; do
                for BIT in `echo $EACH | grep -o -e .`; do
                        echo $BIT >> /tmp/shoutout.tmp;
                        echo “. ” >> /tmp/shoutout.tmp;
                done
                echo “dot. ” >> /tmp/shoutout.tmp;
        done
        echo “. Would you like to play a game?” >> /tmp/shoutout.tmp
        cat /tmp/shoutout.tmp | festival –tts
        rm /tmp/shoutout.tmp
        rm /tmp/check_ip.out
else
        echo “I do not yet have an I,P address” | festival –tts
        sleep 5
        /root/bin/say_my_ip_address.sh 2&>/dev/null
fi
  • Save and quit.
  • (All those fullstops and commas space out the words so it sounds like an IP address!)
  • chmod a+x say_my_ip_address.sh
  • Now we put them in to our start-up routine.
  • Edit /etc/rc.local
  • Add the following lines:
sudo -u root python /root/bin/email_ip_address.py &>/dev/null
sudo -u root /root/bin/say_my_ip_address.sh &>/dev/null
  • And reboot
  • Don’t forget to have your earphones plugged in!

Installing Raspcontrol

I subscribe to a lot of Blogs for the Raspberry Pi.
The newest post that I came across was Jacob Clark’s Raspcontrol.

He’s developed a web-based control panel for headless Pis, so you can see what Pi is doing remotely without going anywhere near a sh terminal or VNC!

Installation

  1. First of all, you will need to be running your Pi off of a decent sized SD card. I’d recommend 8GB+, but you can probably get away with 4GB. You’re going to be turning your Pi into a web server, so you need to install a few packages.
  2. I use WiFi, but as long as your Pi is connected to your network, these instructions should work.
  3. Turn your Pi on, connect a terminal to it (I use Putty) or plug a keyboard in.
  4. Login as the pi user.
  5. Go to the GitHub repository for Raspcontrol
  6. First of all (following the installation instructions at GitHub) install Apache 2 and PHP-5:
    1. sudo apt-get install apache2
    2. sudo apt-get install php5
    3. These take a while and are quite large, hence the recommendation for a decent size SD card.
  7. cd /var/www
  8. sudo mkdir raspcontrol
  9. cd raspcontrol
  10. wget https://github.com/Bioshox/Raspcontrol/zipball/master
  11. This will download the .zip file containing the Raspcontrol code. It will be called ‘master’, so you need to give it the proper extension.
  12. mv master master.zip
  13. unzip master.zip
  14. This will give you a folder starting with Bioshox…
  15. You must add the Apache user “www-data” into your sudoers file, which means they can run Superuser Commands. To do this from the shell type ‘sudo visudo’ scroll to the bottom of the file and on the last line add:
    1. www-data ALL=(ALL) NOPASSWD: ALL
  16. Okay, we now need to remove the master.zip file:
    1. rm master.zip
  17. And move everything from the Bioshox folder into the current /var/www/raspcontrol folder.
  18. (This is a pain, really, but never mind)

Let’s go a-webbing

  1. On your laptop, with a browser, go to http://<the ip address of your Pi>/raspcontrol
  2. You _should_ get the Raspcontrol login screen:
  1. Now go to http://<ip>/raspcontrol/setup.php
  2. You now get a very bare HTML form asking for a password. This is the password you will use on the login screen you saw a minute ago. So, enter a decent password and click the button. This will return you to the login screen.
  3. Login using username “admin” and your password.
  4. You should now see the dashboard!


Install complete!

New update
As I was writing this, I noticed a new update for Raspcontrol
So, first I did:

  • cd /var/www
  • mv raspcontrol raspcontrol_0.1
Then, I got the new sources from github:
  • wget https://github.com/Bioshox/Raspcontrol/zipball/master
  • mv master master.zip
  • unzip master.zip
  • mv Bioshox…. raspcontrol
This means your raspcontrol folder and URL now contains the new code and dashboard. Use the same username/password as you did the first time.
Nice GUI update, and some new bits and pieces! Good job, Jacob.

The Raspberry PiPod – version 1 – finished!

I’m calling an end to Phase 1 of the PiPod project. I have a working device and all the project aims have been completed.
There is a second Phase, but I need to get a couple of parts before I start doing that.

The original post showing the components of the PiPod can be found here.

Some photographs of my “PiPod”

So, this is it, the PiPod. As you can see, it’s a self-contained unit built around a small Really Useful Box. On top, you can see the 3.5″ car rear view monitor. This is held in place with friction from four screws and bolts. It was pretty secure in there, but I added some joined cable ties to reinforce the ‘holder’.
You can see the wires for the screen, including the power inlet (the red thing). You can also see the Belkin WiFi dongle connected using a small USB extension lead so it can be attached to the box.

This is a view of the side of the PiPod showing that I’m using the composite video output to connect to the screen. The white socket is a spare input for the screen, which I’m not using. You can see on the right a Velcro loop that I use to hold the power cable so it doesn’t drop off the table when disconnected. You can also start to see how the Pi is held in place inside the box… Cable ties again.
I hand-cut (with a craft knife) two holes for the sockets that side.

This is an end-on view showing the hole I cut out for the power cable. I know, it’s all a bit rough, but it was fun!

The other end of the PiPod showing the opening for the LAN port and the USB ports. You can just make out the nano Bluetooth adapter. One of the big problems with the Pi is that if your USB device plug is a bit on the large side (or the case of the device is) then it becomes very difficult to fit two plugs in, one on top of the other. That’s why the extension cable came in handy – it was short enough not to lose too much power and meant that the USB port didn’t get damaged.

This is the underneath of the Pi – you can see the SD card and the cable ties. Messy, but it works well.

I love my little flip-up screen! I could take it out of there and mount the screen direct to the lid of the box, but I don’t want to damage the screen by prising it out. It’s nice to have the built-in screen protection anyway.

And the top comes off… I needed to make sure that I could still get the SD card in and out, but to have it inside the box (rather than sticking out, which is how most of the ‘professional cases do it. It’s a bit fiddly, but with the cable tie going diagonally across, it’s still accessible. I cut a few of the small bits of the outer part of the box away so that the cable ties laid in the ‘grooves’ on the corners. I am covering the HDMI port here, with the USB dongle, but made it so you could remove the dongle.

View from the other side.
And it all works! I would’ve put a video up, but forgot to bring the power cable in today.
Speaking of power, the whole thing runs off two power cables – one for the screen (12V) and one for the Pi (5V). I would at some stage like to get the whole lot running off battery, but I think that might be a lot of expense just for this project, which does everything I wanted it to anyway!

In terms of power, the WiFi dongle is slightly underpowered, but my experiments with a powered USB hub were hit-and-miss and I didn’t want to buy another one. It connects to my home and work WiFi nicely anyway.

The last part of recording this project will be a video showing boot-up, X-desktop operations and using the Rii keyboard/touchpad. That’ll be tomorrow!

Raspberry Pi emulation

Taking a quick break from my PiPod project, which is essentially done, bar photos and videos of it actually working!

I’ve decided that having a “virtual Pi” would be handy so that I can mess about with the OS without worrying too much! Plus, it means I don’t have to carry my Pi around with me all the time if I just want to try some Python etc out.

Important note:
For Windows users, it seems that the recommended solution for emulating the Pi is to use qEmu on Windows. Take a look at this Sourceforge project: Raspberry Pi Emulation in Windows.

Virtual Box

Just so you know what you’re installing on your main computer… VirtualBox is a wonderful, free, virtual computer creator and viewer. There are a variety of platforms it works on. I’m actually using a version I already have on my Windows 7, 64-bit machine.

Emulating the Pi

I’m referencing this guide from the Southend Linux User Group to a certain extent. I know, random, but that’s what Google came up with!
I should say before we begin that I’ve tried both the ‘Lenny’ and ‘Sarge’ Debian installs available from virtualboxes.org and neither of them worked (Lenny stopped at “Select and install software”, Sarge gave a rather horrid “Kernel panic”) hence I now use the official Debian site download instead!
  1. Download VirtualBox for your platform.
  2. Download a net install ISO image from debian.org itself.I’ve chosen the i386 small CD in the top-left area. 191MB to download…
  3. Create a new machine on VirtualBox, take the defaults, choose to create a new disk for it.
  4. Start the machine up.
    1. You get the first-time start-up dialogue.
    2. Choose to boot from the ISO image you downloaded.
    3. Choose your language/country etc. Let it run for a bit.
    4. Now, this installer looks very similar to the one that stopped on the Select and Install Software dialog, so hopefully it’ll work better than that one!
    5. Take the defaults all the way through, no need to be picky unless you want to. Set the root password, create a new account, set that password…
    6. Use the guided partitioning mode at the top.
    7. Choose to put all the files on one partition and write the changes to the disks.
  5. Off it goes, partitioning away, installing the ‘base system’. This is where it starts extracting the downloaded packages and going off to download and install the rest of the OS.
  6. This is going to take a while, I can tell!
  7. Now we’re onto ‘Select and Install Software’… Holding my breath…Ooooh. It’s gone to 12% and still running… This could be good. Yep, “Retrieving file” counter still running… Goooood.
  8. Choose the options you like. I just left it as a ‘GUI’ and the recommended/default options.
  9. Some time later…
    Yes, I think I will install the GRUB boot loader. If only because I saw that the absence of this affected installation attempt number 2.
  10. Yay! Installation is complete. I’ll believe it when I see it 😉
  11. Now it’s running clean-up… Oh, I hope it moves on from 65% soon, otherwise… Ah. There we go.
  12. Rebooting automatically.
  13. Hmmm. Get the boot choice again… does that mean it’s going to start the install again? God, I hope not!
  14. I have a black screen… some kind of progress swirly…. Ah! Desktop!
  15. Go ahead and login. Don’t use root, use the ‘other’ account you created.
  16. Love the retro rocket-and-planet motif. Taking a while for anything to happen… Probably just a first-login thing.
  17. Hmmm. Okay… That’s a crappy GUI… no start bar or icon dock or anything… I can soon install something new of course. Oh, I see… there’s a menu bar at the top. Kind of merges into the VirtualBox menu. Some kind of message about Guest Additions came up but I missed it.
  18. Right, let’s see what we’ve got and if we can carry on with the emulation stuff…

Terminal Time

  1. From the Applications->Accessories menu, start up a terminal.
  2. You should get a shell prompt with your ‘other’ username attached to it.
  3. Right, install the qEmu stuff.
    1. su root (use the password you specified during install)I’m doing this because I can’t sudo… because I’m not in that group of users, which is unhelpful.
    2. apt-get update(i.e. update the package database).
    3. apt-get install qemu
      (Go and get and install the qemu package)
    4. Now, qemu is installed. That page I am referencing as a guide (the Southend one) makes it a lot more complicated than it needs to be!
  4. Now, you need to cd ~<other username> to go into the home folder of your ‘other’ user. We need to create a folder to mess around in and store kernels and disk images.
  5. mkdir pi_emu
  6. cd pi_emu
  7. wget xecdesign.com/downloads/linux-qemu/kernel-qemu
  8. This will get the qEmu kernel, which makes everything run. I hope.
  9. You now need to get the current Linux image for the Pi that is recommended by the RPi foundation. The one I am using is the first release of Raspbian Wheezy. But, always check for the latest one at their downloads page. Get the URL of the release and do:
  10. wget <url>
  11. This is NOT a small file – it’s about 440M, so go and get a cup of coffee.
This takes around 10 minutes to install at work, and we’re on a T1 connection. The reason it’s so slow is probably because of where the file is coming from rather than the connection itself.
And we’re back…
  1. Unzip the file your downloaded (you will have to change this filename to whatever is now in your folder.
    1. To get a list of files, the Linux command is ‘ls’.
    2. unzip yyyy-mm-dd-whatever.zip
      (to unzip it)
    3. This takes a while as well as it needs to expand the 440M file to a roughly 2GB file. Gawd bless file compression.
    4. Now, if you are logged in as root (and I was, so you should be!), you will need to make sure that the files in that folder are ‘owned’ by your other user, which will shall call ‘otheruser’. If you don’t do this, the .img file (and therefore the Virtual Raspberry Pi) will be ‘readonly’ when you run it using your otheruser account.
      1. chown otheruser *
      2. chown otheruser *.*
      3. exit
    5. You should now be back at a prompt that looks like
      otheruser@debian:~/pi_emu
  2. Now, going to use a modified version of the command from the Southend site to start it up. Here goes:
    1. qemu-system-arm -kernel kernel-qemu -cpu arm1136-r2 -M versatilepb -no-reboot -append “root=/dev/sda2 panic=1” -hda 2012-07-15-wheezy-raspbian.img
    2. The last argument there is the .img file that you decompressed just now.
    3. Apparently, you can give it more memory by adding the “-m 512” argument to the end, but I just want it started up for now.
    4. I’m getting a few ‘readonly file system errors’, so it’s possible I might have to change permissions on the .img file before it works, but let’s just see…
    5. Not bad so far. Oooh! The usual Raspberry Pi first start-up screen! Yay!
    6. Choose the ‘update raspi-config’ option at the bottom just so you are up-to-date.
    7. Now re-run that utility:
      sudo raspi-config
    8. Choose the SSH server option and enable it. This will let you open a remote terminal to the Pi if you need to. Choose OK afterwards. Then choose ‘Finish’.
    9. Now we do ‘startx’
It’s interesting… the desktop comes up (although it’s blue, rather than raspberry-coloured… Odd). It’s a problem others have come up against.

For Windows users, it seems that the recommended solution is now: Raspberry Pi Emulation in Windows.

Never mind, it was an interesting practical experiment, which sort-of works apart from the colour issue. Non-Windows users may find these instructions still useful, so I will publish this post anyway!