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.
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
- Download the Raspian image from the Raspberry Pi foundation.
- Get the SD card out of your Pi and put it into your laptop.
- The following steps are only if you have a current SD card OS for the Pi:
- 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.
- Backup your card with Winimage (or whatever you have).
- Carrying on, we’re going to install Raspian onto the card.
- 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 😉
- 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.
- Insert a USB stick, preferably one that is 2GB or more.
- Download the gparted Linux ISO.
- Using either Winimage, Win32DiskImager, unetbootin or the LinuxLive USB Creator (my preferred method), install the ISO you downloaded to the USB stick.
- 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.
- Once the gParted OS is up, just follow the instructions and steps until you get the desktop.
- 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.
- 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.
- 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!).
- Make sure you apply the changes and wait for it to finish.
- Shutdown the gParted OS desktop. This should turn your laptop off.
- Remove the USB stick. Your SD card should stay in for now.
- Start up your laptop again to Windows.
- Download the Linux firmware for the USB WiFi dongle you are going to use.
- My dongle runs on the ZD1211 firmware so I downloaded it from Sourceforge.
- Unzip/untar the firmware into a folder on Windows.
- Copy the folder onto the SD card.
- Remove the SD card safely.
First Pi start-up
- Put the SD card carefully into the Pi.
- 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!
- Put the power lead in, try not to get motion-sick from the Linux start-up scrawl.
- When the prompt comes up, use the ‘root’ username. There won’t be a password at the moment.
- This should give you the shell/command line prompt.
- 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.
- 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.
- ls /dev – get the name of the mmc device to put into the mmc*** space below.
- mkdir /mnt/sd
- mount /dev/mmc*** /mnt/sd
- mkdir /lib/firmware/zd1211
- cp /mnt/sd/zd1211/* /lib/firmware/zd1211/
- You should now have your firmware in the right place.
- 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.
- When the Pi comes back up, your firmware should have loaded and your dongle should now be active.
- 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:
- apt-get install wpa-supplicant
- But it is, so I don’t have to.
- You now need to know the ID of your router (the SSID to be more exact) and the connection password.
- Now, you will need to edit the file /etc/wpa_supplicant.conf
- I use vi, you don’t have to. I’m going to assume you’re using ‘nano’ which is easier to use.
- nano /etc/wpa_supplicant.conf
- This will create a new file.
- Add the following to the file:
network={
ssid=”your router SSID”
psk=”your router connection password”
} - Save the file & exit.
- Type the following at the prompt:
- wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext &
- (The & means it is a background process – if you don’t do this, you end up stuck in the command).
- Once it comes up with text that makes it sound like you’ve successfully connected, type:
- dhclient wlan0
- (This gets your IP address)
- 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.
- You should now be on the Internet.
Update the operating system and get a decent WiFi interface
- At the prompt, type:
- apt-get update
- This will update the package database so you can update your operating system.
- Once that’s done, do:
- apt-get upgrade
- This will upgrade any module that needs it. It will take some time.
- Once that’s done, do:
- apt-get install wicd-curses
- 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.
- 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.
- Do another ‘reboot’ and when the Pi comes back up, login as root again and do:
- shutdown -h 0
- 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.
>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
http://www.debian.org/distrib/packages
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.
http://wiki.debian.org/WiFi/HowToUse
http://wiki.debian.org/NetworkConfiguration
Hi,
I don’t know if you’re interested, but I just made a Raspberry Pi Web Server: http://www.techspect.co.uk/ 🙂
What a nice site you have here, and a very informative article. I’ll bookmark this for future reference! 😀
Thanks for visiting 🙂 I’ve added your site to the Running On a Pi list on this blog 🙂