Taking time to check your sums

I’ve got an old laptop that is currently running Windows XP (that was installed on it when it was given to me a few months ago) and at long last I’m getting round to carrying out my intention (which I’ve had ever since I received it and managed to get it to actually work) of putting Linux on there instead.

Since it is a fairly old laptop (a Sony Vaio from either the late nineties or the early naughties, as far as I can tell) and consequently somewhat lacking in system resources by today’s standards, it is likely to work best with a relatively lightweight Linux distribution.  I’ve decided to try out #! (aka. Crunchbang), a variant of Debian built around the Openbox window manager.  This is supposed to be fairly light in its demands on resources so should work ok with limited memory, processor speed and disk space.  If even this proves too much for the old machine, I’ll have to try one of the truly lightweight distros, such as DSL, instead.

I downloaded the ISO file for the latest version of #! last night, via bittorrent as this seems to be the way forward for large downloads.

Fortunately, I’ve adopted the habit of checking the MD5 checksum of any large download I make (I don’t always bother for smaller ones).  The Wikipedia page I just linked to will give you plenty more detail if you want it but, essentially, MD5 is a cryptographic hash function that provides a 32 digit hexadecimal integer (or checksum) corresponding to any input datastream (such as a computer file), in such a way that any change in the data will result in a completely different checksum.  By providing the MD5 checksum of the file as it is supposed to exist, the person sending you the file (or from whose website you download it) enables you to check that the file you have received is the same as the original.  Although MD5 is no longer cryptographically secure (i.e. it is vulnerable to deliberate attack) it still provides a pretty reliable way of checking whether your data has become corrupted in transit.

The reason I mention all this is that, on checking my shiny new Linux ISO file’s MD5 checksum against the one listed on the #! website for the same file, I discovered that it was different.  That meant that my download hadn’t been entirely successful and I was able to discover this fact before wasting time writing the file to a CD (since my laptop is too old to support booting from USB drives) and trying to run it (#! is, I believe, a Live CD distribution that can be installed to the hard drive later if you so choose – as is common with many contemporary flavours of Linux).

At this point, I expected to have to download the whole file (nearly 1GB worth) again and hope for better luck next time.  However, I discovered that bittorrent (using the Transmission client on Linux) had a function to validate my local copy of the file and, when it found a discrepancy, it was able to figure out which bits of the data were missing or corrupted and download them (again?) to create a working file.  On the second attempt, my MD5 checksum matched the expected one, so I am confident that the ISO I now have is a full working copy of the one from the #! website (which presumably should work ok).  Of course, bittorrent’s validate feature probably obviates the need to run a separate check on the MD5 checksum but it’s still nice to be able to get independent confirmation that the file is sound (and it would also still be useful for checking downloads that I haven’t got using bittorrent).

The next stage is to burn the ISO file onto a CD and then have a go at booting my laptop with it.  That’s probably going to be my main task for later this evening.



The Joys (and Sorrows) of Pi

Yesterday was quite a mixed day for me and my Raspberry Pi.

As I mentioned the other day, I’ve been running my Pi headless and accessing it via ssh since I didn’t have suitable input/output hardware to connect to it directly. I also mentioned that I’d obtained a USB keyboard and ordered an HDMI cable and HDMI/DVI converter to allow me to connect up my Pi directly using my monitor at work (strictly during my lunch break, of course ;)).

Shortly after writing that post, my HDMI cable arrived (the converter had in fact got here already), so it was with some excitement yesterday that I took my Pi and related bits along to work with me. Exercising great self-discipline, I managed to resist the temptation to start playing with my Pi during the morning (despite the fact that my boss was safely away at a meeting down in Cardiff) and got on with my actual work until lunchtime. At that point I lost no time in setting up the equipment only to find that the combined length of the HDMI/DVI converter and the connector at the end of my shiny new HDMI cable was slightly greater than the available space in the recessed area at the back of the monitor where the cables are supposed to plug in. In short, there was no physical way of plugging the cable into the monitor.

Scouting around the rest of the building, I discovered that none of the other available monitors had a DVI or HDMI input that I could use. However, I did manage to find one with a composite video socket, as well as a suitable cable, so I was able to connect the Pi that way and have a bit of a direct-connect session with it. I wasn’t vastly impressed with the video quality (and the monitor in question is in a cold part of the building and not easy to move) so I think I probably won’t take the Pi to work again until the new HDMI/DVI cable I’ve now ordered arrives (this one will have a DVI connector wired in directly at one end so it should fit my monitor with no trouble).

Returning home in the evening, I was able to make some progress on the headless connection front which put an altogether more positive spin on the day’s adventures with my Pi. Up to now, I’ve been using ssh to access it via my local network. This is great for command line stuff (which is where I spend quite a lot of my time in Linux anyway) and I recently discovered how to enable the use of programs with a GUI (essentially, adding the “-X” switch to the ssh command, which lets your local X server handle the graphics on behalf of the remote programs). However, it doesn’t seem to let you run a full graphic desktop environment (it could be that I’m just missing something).

While reading around the subject, I recently came across the concept of Virtual Network Computing (VNC), which seems to allow fuller graphic support for a remote system than ssh (I don’t fully grok the technical details yet). I managed to find a couple of good tutorials on setting up and accessing a VNC server on a Raspberry Pi (I mostly used the Penguin Tutor one and filled in some extra details with the eLinux one).

I haven’t yet had much time to play with it, but so far it seems to be working quite well. I suspect that, until such time as I upgrade to a new monitor with HDMI (or at least DVI) capability at home, I’ll continue to access my headless Pi mostly by ssh and use it mostly from the command line. It will, however, be handy to have the option of using a full graphic interface for it if I want to.

A tasty slice of Pi

Last year I was quite excited to hear about the new Raspberry Pi, a computer designed to be small and cheap. Its main aim is, apparently, to provide an accessible and stimulating route into computer programming for young people (rather like the ZX Spectrum and other microcomputers of my youth, although I’m not sure if that was one of their design goals or just a side effect of the fact that you had to type in commands just to get a program to load and the easy accessibility of a programming environment if you wanted to take things further) but it is also a quite capable general purpose computer. The thing that most immediately attracted me to the Pi was the presence of a GPIO port, allowing easy access to hardware control.

As with several other items of new technology, including my Android phone and my Kindle, I waited until I had got my hands on one or two Raspberry Pis (or Pies – I’m not sure if there’s an official plural form) belonging to other people before I purchased one of my own. In many ways this wait served me well, as they doubled the amount of onboard RAM fairly late in 2012 and so, by waiting until the cusp of the new year, I ended up with 512MB instead of 256MB. Mine is a Raspberry Pi Model B, which comes with a built-in ethernet adapter and 2 USB ports so is (IMHO) well worth the extra cost against a Model A (about £10 cheaper but with 1 USB port and no ethernet – actually I don’t recall seeing any of those for sale, so I don’t know if they are still doing them).

The Pi comes with composite video and HDMI outputs for graphics. Unfortunately I don’t have a TV at home (to use the composite video signal) and my monitor is VGA-only (for which HDMI adaptors are expensive). Also I didn’t, until last week, have a USB keyboard. This meant that I couldn’t plug my I/O peripherals directly into the Pi and have had, instead, to resort to running it headless and accessing it via an ssh connection from my PC. This is no great problem except that my PC is in my bedroom, my router is in the kitchen and I therefore have to keep running in and out to get to the Pi (or I could trail an extra-long network cable through the house but I’d rather not). I have now procured a USB keyboard and have an HDMI cable with DVI converter on order, so that I’ll be able to take the Pi into work (I have a DVI-capable monitor in my office) and play with it directly during my lunch breaks, but for now I’ll be sticking to headless / ssh use when I’m playing with it at home.

To start with, I decided to run my Pi with the recommended operating system – a customised version of Linux called Raspbian (which, as the name suggests is based on Debian, one of the most established Linux distributions). I’ve been running Linux, on and off, pretty much since I first got my own PC about 12 years ago and it (in the flavour of Linux Mint 11, aka. Katya) is currently my main OS on my home PC, so Raspbian is pleasantly familiar. At some point, I may try out one or more of the other Pi-based Linuxes (or Linuces or whatever – again, I’m unsure about the plural form). If so, I’ll probably wait to get a new SD card first. One of the attractions of the Pi is the fact that all the software resides on an SD card, so you can effectively have a different machine set up just by swapping out to a different card. One of the ways I can foresee playing around with my Pi is to have several different versions of Linux set up on different cards with a nice stable one (probably Raspbian) I can fall back on and others to be more experimental with.

As I mentioned before, the thing that first drew my attention to the Pi was the GPIO port and, indeed, I have already started to play with that. Since this post is getting a bit long, I’ll postpone further details for a bit.