Adventures in Raspberry Pi


In early May 2012 I got my name on the RS Components waiting list for a Raspberry Pi, in late June I was invited to purchase one, and in mid October it finally arrived and the reality of knowing nothing at all about Linux finally set in.  I had a vague idea that I would try to make the Pi run as a Network Attached Storage (NAS) drive, or maybe a media server (what is that exactly?), or a thing that plays the internet on my TV (except I don't have a TV), but I had no idea at all about how to do any of these things or if they were even possible.  It turns out that all are possible and so far I've done two of the three, and more besides.

In case you are in the same position as I was 7 days ago -- a Windows (former MSDOS) user with a new Raspberry Pi and no idea what or how to do anything with it -- here is what I did, in roughly chronological order... at least what I can remember.

OS is Boss

Nothing will happen unless you already have the OS on SD card as there is no BIOS built into the Pi. I used a 2 GB microSD card from an old phone fitted into a SD card converter and that works just fine so far.

You can grab the OS from http://www.raspberrypi.org/downloads and their recommended instructions for installing it can be found here but consider following Simon the Pi Man's guidance instead.

I found that getting the OS onto the SD card was a bit tricky because with the recommended software the built in SD reader on my old Dell Inspiron 6400 laptop couldn't see the SD drive. I used the alternative approach, but I suspect if I'd followed Simon's instructions it would have been straight forward.

Plug stuff into all the holes

Having the laptop already dusted off was very useful for this stage too, because I had to raid the wireless USB keyboard + mouse, the screen, and the Ethernet cable from my desktop PC to plug into the Pi, and would have been flying blind without it (the horror!). A BIOS-looking screen comes up the first time, so Simon to the rescue again.  Don't change the boot_behaviour at this time because 1) you can start the GUI by typing startx and 2) you'll want to change it back later anyway. But anyway, we have contact!  I did exactly the opposite of this and soon realised that the GUI was not something I wanted to spend a lot of time with, but still you should check it out: just type startx from the command prompt.

I found that my mouse worked fine, but the keyboard was either endless repeating the previous keystroke, or ignoring them altogether. I have a MS Wireless Multimedia Keyboard 1.1 and I think the receiver is unable to draw enough power from the Pi's USB port. This is quite a big problem, but then, bless him, Simon pointed me to the perfect solution...

Setup Remote Access

Setting up remote access (via SSH) totally solved all the keyboard problems, but also gave me back my desktop PC while I went about tinkering with the Raspberry Pi. It is also the first exposure to the Linux operating system that I'd had, but its a great introduction because its so well explained. Do it!

No more keyboard problems; and welcome back desktop PC, I'd missed you.  You can even copy-paste from Windows into the command line.  Two computers, one screen, this is truly the future I'd dreamed of.

Note:  If you want the GUI / Remote Desktop type access then that is possible too, check out either Simon's instructions or these instructions or these instructions until you get something that works. I came upon this much much later in the process while trying to use the Pi as an internet gateway, but it makes more sense to mention it here. You need to have the XLaunch or Xming program running first, then you can use PuTTY to SSH into the Pi commandline-style, and from there start the GUI that you want to. It can take a few seconds to appear, but its very cool, the Linux application window comes up in Windows as if it is native.

NAS!

Having been thrilled by the remote command line access and being rather unimpressed by the GUI on offer, I turned my attention to getting the Raspberry Pi to mate with my powered Western Digital USB hard drive.

I had heard of Samba servers, but had no idea what they were, and this is what you end up setting up when you follow instructions from Simon or elinux.org. This is the stage that gave me the most trouble, as I was getting the Windows error "The account is not authorised to log in from this station" when trying to map the server to a drive letter.  I eventually solved it, but I'm not sure which of the several changes I made worked.

On the Windows side I followed this:

My /etc/samba/smb.conf file includes these settings (some commented parameters also shown):
[global]
workgroup = HOME
server string = %h server
wins support = yes
;wins server = w.x.y.z
dns proxy = no
security = user
encrypt passwords = true
unix password sync = yes
[RaspPi]
path = /mnt/disk1
writeable = Yes
only guest = Yes
create mask = 0777
directory mask = 0777
browseable = Yes
public = Yes

I don't know what most of these settings actually do, but I know that it finally worked when I changed encrypt passwords back to true after having disabled encryption at some point during the goose chase.

Now it is recognised by Windows and my Android devices and I have set up a scheduled remote backup to it using Fbackup. I can keep files on here that I want to be always accessible to the network and the Pi can be left on permanently to serve them.  The Pi now has a purpose, good on you, Pi.

Your media, sir.

I don't actually know what a Media Server is, but I think it is a way of streaming video, music, or photos over a network. I guess there is some special codec or handshake or something. Perhaps it is a way to preserve DRM. I don't know. But its easy to set up by using DLNA by following this nice set of instructions.

After doing this I can access my media server "RaspberryPi" (originality 0/10) from Windows Media Player (ugh), my PS3, and a video player app on my tablet, and stream video/music/photos over the network from the Pi's hard drive.

Torrent Box 

"Torrent Box", that sounds like a thing, and if it is, it is a thing that I want. The universal answer to using bit-torrent on Raspberry Pi seems to be a program called Transmission, and it was pretty simple to install by reading the advice of these nice people, mainly the first link I think.

The Transmission UI is an HTML file hosted by the Raspberry Pi and accessible to any device on the network. It would be possible to make it accessible from outside the network too, but the security required to do that is well beyond my ambition. Its a pretty nice interface and can handle .torrent files (and can 'watch' a folder for new ones) and magnet links.

Private Trackers

The only thing with Transmission that I had trouble with was getting it to work with a private tracker when the torrent file was downloaded from the browser of my desktop PC. The tracker refuses the torrent with an "invalid passkey" message. I came up with two good ways to get around this:

1.    Use the Raspberry Pi's web browser

If I log into the tracker website using the Raspberry Pi's web browser then the passkey matches and the torrent downloads.  Sounds easy, but with only the text SSH console it meant using the text browser Lynx, which while quite amazing and functional, is not a permanent solution.

While setting up solution 2 below I found that there is a way to 'remote desktop' into the Pi using SSH and X11 forwarding (explained in the Setup Remote Access section above) that means I can use a graphical browser instead.  Luxury!

2.    Use the Raspberry Pi as a proxy for my PC browser

This is the cooler way of doing it.  I usually use Chrome so I downloaded Firefox to use as a permanent 'via the Raspberry Pi' browser.  I know there are smarter ways to do this, but this works for me.  In Firefox I set up a Manual Proxy by following the ridiculously convoluted Tools > Options > Advanced > Network > Settings, enabling Manual Proxy and setting the SOCKS host to 127.0.0.1, its port to 8080, and crucially (!) changing to SOCKS v4. I did this just a few hours ago but for some reason I can't find the exact instructions I followed, however this site is very similar.

In either case you need to log into the Pi using PuTTY, but the tracker is now satisfied that my torrents are being used by the right person.

In a box, under the bed...

And that's as far as I've got so far.  Its been an excellent week of tinkering and exploration and hopefully there is more to come.  I haven't attempted any of the Media Centre side of things yet so that is certainly on the cards for the future.

But the best single thing about all this is that my Raspberry Pi is going to be something I shove under the bed and forget about.  One Ethernet cable, one power cable, one USB harddrive, and a tiny black box that are always on, use hardly any power, and make no sound.  Although I often have reasons to do so, I never leave my PC on when I'm out, so the Pi really fills a practical gap as well as being a fantastic new toy to tinker with.

Finally, I should mention that I'm absolutely impressed by the Raspberry Pi hardware (which hasn't crashed once), by the painless way that Linux updates and installs software packages, and by the amount of guidance people have put on the net about the Pi and Linux in general that is simple enough for relative beginners to digest.  Have fun with your own adventures in Linux and Raspberry Pi!

Richard
21/10/12

Comments