Operating Systems… So many, and yet so far

Oh, the trials and tribulations (or Tribbleations) of installing an operating system on the Pi. I tried about 5 operating systems before succeeding in my goals including Debian Wheezy, Fedora, Arch, Risc OS… They all failed in some way, mostly to do with a) WiFi and/or b) Bluetooth.

Eventually, I found an image that did work: Debian 6 19-04-12. And, yes, I do realise that this was the recommended one at the time… That’ll teach me to go cutting-edge! With this distro, I got everything working. Since then, the recommended distro has changed to the Raspian version of Debian Wheezy. Here’s the original RPi foundation post.

So, into the wonderful world of Raspian we go! Now, may aim here is to install everything without getting up from the sofa. i.e. No LAN connection

Here are the steps I took to get the Pi up-and-running. I might change tenses throughout, but hopefully I haven’t missed any steps! I’m on Windows 7, 64 bit, so any problems I have running apps on Windows may not affect you.

Installing the Operating System before the Pi starts up

  1. Download the Raspian image from the Raspberry Pi foundation.
  2. Get the SD card out of your Pi and put it into your laptop. 
  3. The following steps are only if you have a current SD card OS for the Pi:
    1. Download Winimage. This is far better than the Win32diskimager, in that it starts up more reliably each time. I do, however, think that it’s a bit of a rip-off at $30. You may find other packages that can backup and restore images, and most of them are fine.
    2. Backup your card with Winimage (or whatever you have).
  4. Carrying on, we’re going to install Raspian onto the card.
    1. Using Winimage/Win32DiskImager, restore the image you downloaded onto the SD card. !!! Make sure you are restoring to the card and not your hard drive 😉
    2. If your SD card is larger than 2GB, you’re going to want to expand the card so that the OS has more room to breathe.
      1. Insert a USB stick, preferably one that is 2GB or more.
      2. Download the gparted Linux ISO.
      3. Using either Winimage, Win32DiskImager, unetbootin or the LinuxLive USB Creator (my preferred method), install the ISO you downloaded to the USB stick.
      4. Reboot your laptop with the USB stick in and have the laptop boot from the USB stick. You can do this in a variety of ways, depending on your laptop. Sometimes, you have to go into the Bios to make this work.
      5. Once the gParted OS is up, just follow the instructions and steps until you get the desktop.
      6. At this point, a window will open showing the partitions on your SD card. You should have a FAT format bit at the beginning, then a Linux partition and then an unused part at the end.
      7. Right-click the Linux partition and choose to Move/Resize. Click and drag the extent of the partition size bar until you have used ALL the disk EXCEPT about 1-2 GB at the end. Click OK or Continue.
      8. Now right click on the smaller unused space and make a new partition. Just use ext2 for now. This will eventually be our swap space (I hope!).
      9. Make sure you apply the changes and wait for it to finish.
      10. Shutdown the gParted OS desktop. This should turn your laptop off.
      11. Remove the USB stick. Your SD card should stay in for now.
  5. Start up your laptop again to Windows.
  6. Download the Linux firmware for the USB WiFi dongle you are going to use.
    1. My dongle runs on the ZD1211 firmware so I downloaded it from Sourceforge.
    2. Unzip/untar the firmware into a folder on Windows.
    3. Copy the folder onto the SD card.
  7. Remove the SD card safely.

First Pi start-up

  1. Put the SD card carefully into the Pi.
  2. Insert your dongle (oo-er, Mrs) into the Pi, and plug in a keyboard and a monitor. You will not get anywhere unless you can see what the Pi is doing and can type stuff in!
  3. Put the power lead in, try not to get motion-sick from the Linux start-up scrawl.
  4. When the prompt comes up, use the ‘root’ username. There won’t be a password at the moment.
  5. This should give you the shell/command line prompt.
  6. Now, you need to mount the SD card, despite it actually being what you’re running off. This is because you want access to the FAT partition where the firmware is.
  7. First of all, you want the number one partition on the SD card. I can’t remember what that is at the moment, but it’s the one in /dev/ that begins with mmc and has a ‘1’ in it.
    1. ls /dev – get the name of the mmc device to put into the mmc*** space below.
    2. mkdir /mnt/sd
    3. mount /dev/mmc*** /mnt/sd
    4. mkdir /lib/firmware/zd1211
    5. cp /mnt/sd/zd1211/* /lib/firmware/zd1211/
  8. You should now have your firmware in the right place.
  9. At the prompt, type ‘reboot’. This will, surprisingly enough, reboot the Pi. Hopefully. If it fails to come back up, pull the power, wait a few seconds and re-insert.
  10. When the Pi comes back up, your firmware should have loaded and your dongle should now be active.
  11. Fortunately, the library necessary for connecting to my WPA-secured router is included in this distribution. If it wasn’t, I’d have to plug it into the LAN and do:
    1. apt-get install wpa-supplicant
  12. But it is, so I don’t have to.
  13. You now need to know the ID of your router (the SSID to be more exact) and the connection password.
  14. Now, you will need to edit the file /etc/wpa_supplicant.conf
    1. I use vi, you don’t have to. I’m going to assume you’re using ‘nano’ which is easier to use.
    2. nano /etc/wpa_supplicant.conf
    3. This will create a new file.
    4. Add the following to the file:
      ssid=”your router SSID”
      psk=”your router connection password”
    5. Save the file & exit.
  15. Type the following at the prompt:
    1. wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext &
    2. (The & means it is a background process – if you don’t do this, you end up stuck in the command).
    3. Once it comes up with text that makes it sound like you’ve successfully connected, type:
    4. dhclient wlan0
    5. (This gets your IP address)
  16. Type ‘ifconfig -a’ at the prompt. The bottom one should be your wifi adapter and you should be able to see an ip address. If you don’t, well, you probably got the ssid/password wrong in the conf file.
  17. You should now be on the Internet.

Update the operating system and get a decent WiFi interface

  1. At the prompt, type:
  2. apt-get update
  3. This will update the package database so you can update your operating system.
  4. Once that’s done, do:
  5. apt-get upgrade
  6. This will upgrade any module that needs it. It will take some time.
  7. Once that’s done, do:
  8. apt-get install wicd-curses
  9. Say yes to it using up the space on the disk. Thanks to the steps with gparted you will have lots of space to play with.
  10. wicd-curses is an interface to wireless networking that you can use to see what other WiFi networks there are in the area and gives you a handy interface to enter passwords, automatically connect etc.
  11. Do another ‘reboot’ and when the Pi comes back up, login as root again and do:
  12. shutdown -h 0
  13. This will shut down your Pi. Wait until it says “System Halted” and then pull the power. (It may just switch off by itself, but once you see that message, it’s safe to pull the plug.

Next time…

We will add the wpa_supplicant commands to rc.local to automatically start-up when we boot. And we will look at getting the Bluetooth keyboard/mouse all working nicely!

3 comments for “Operating Systems… So many, and yet so far

  1. >About the firmware, there are a couple of packages that are already packed for debain with firmware.

    First to locate all of them, you can try this command:

    apt-cache search 'firmware'

    That will list all packages which have firmware in its name.

    So, which are you looking for? If you look into the file /var/log/messages you will see that the kernel wants to load a firmware file when you plug in your USB device. Easiest to see thist is to run this command, and them plug your device in.

    tail -f /var/log/messages

    When you seen what file there are, you search for that one in all firmware packages (or install the one that match your device in the package description).

    To see which package the file exists in, use the

    Search on 'zd1211' and see to it that you check "
    packages that contain files whose names contain the keyword"

    In the answer you see the package 'zd1211-firmware'

    To see more information about a package, use this command

    apt-cache -f show zd1211-firmware

    If it's the right one, just install it as usual.

    All network setting can you set in the file /etc/network/interfaces. Then Debian will can setup your network when the machine boots.

    Just go to http://wiki.debian.org/ and search. Lots of good info there.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.