Upgrading to Raspbian Jessie

Thu 01 September 2016

I got a nasty surprise a few days ago when I found out that Raspbian Wheezy (the OS running on my Raspberry Pi) was effectively EOLed when Jessie came out in September 2015. I had assumed that, being based on Debian, it would receive security updates until 2018. But due to shortage of resources and manpower the raspbian team have decided to move straight over to Jessie, which makes sense.

Unfortunately that means I have been running my Pi without any security updates for almost a year. Since I now use the Pi (hooked up to a large USB hard drive) as my primary home server and also have SSH access to it from the outside world this made me break out in a cold sweat. I only allow public key authentication for SSH but a year is a long time to go without security updates in the internet age for any type of server accessible over the internet. I had to get over to Jessie ASAP.

I knew that a clean installation was the recommended way to upgrade to Jessie but I did not have physical access to the Pi to do this. I also really didn't want to start from scratch and re-configure everything to the way I wanted. So the only other option was to do the upgrade remotely over SSH, something I haven't done before. After doing some googling, the process appeared to be fairly straightforward so I decided to go ahead with it. In a tmux session I effectively did the following:

# Make sure system is already updated
sudo aptitude update
sudo aptitude safe-upgrade

# Modify sources
sudo sed -i /deb/s/wheezy/jessie/g /etc/apt/sources.list
sudo sed -i /deb/s/wheezy/jessie/g /etc/apt/sources.list.d/raspi.list

# Do the upgrade
sudo aptitude update
sudo aptitude full-upgrade


It it important to run the above in a screen or tmux session in case your internet connection breaks during the upgrade process. The upgrade process took a few hours during which time I was asked to upgrade or keep certain configuration files. The process was faily straightforward and I didn't encounter any issues which is a testament to the Debian team since they have made some major changes under the hood (most importanly being the shift to systemd). After doing a reboot following the upgrade everything appeared to be running as normal.

Removing GUI

I also wanted to remove the GUI on the Pi as I always access it via the command line over SSH. Doing the following got rid of all GUI and Xorg packages:

sudo aptitude purge ~ilibx11


Booting appears to be much quicker now thanks to systemd:

pi@raspberrypi:~$ systemd-analyze time
Startup finished in 11.819s (kernel) + 36.814s (userspace) = 48.634s

Migrating to Pelican

Sat 23 July 2016

I've been considering for a while to port this site to a static site generator like Jekyll from the bottle based mini blogging/CMS engine I created a few years back to learn web development. I finally decided to make the plunge this weekend, although I decided to go with Pelican instead of Jekyll. The migration process has been much quicker and easier than expected. Half of my blog posts have been shifted over and I've re-created most of the other site content and design too. So all the major hurdles are out of the way.

Static site generators

So why move from a working solution to something new? The main reason was poor python support from my web hosting provider. I had no choice but to use CGI to get things to work (yay 1999)! This always irked me and made me feel dirty. I definitely should have done better research into the "python support" they claimed to provide.

Static site generators provide an elegant solution to this kind of problem (and have whole host of other benefits too). They effectively allow you to generate HTML pages via templates. No need to worry about databases, security holes or language support. It's just HTML/CSS/Javascript being served up by your web server (many have been using Github pages)! Further, the workflow is completely command line driven and you can write your blog posts in markdown in vim too! Understandably because of this, all the cool geek kids (and even some big companies) are doing it!

Pelican

Initially, I was considering Jekyll as that appears to be the most popular static site generator. But being a python guy I thought that there must be a decent python equivelant (Jekyll is ruby based). I set off Googling and discovered that Pelican was the most actively developed and used in the python world. It uses the jinja2 templating engine which I have experience with and generally looked sensible and simple to use. So I opted for that.

Migration

It took me a few hours of reading to understand the basics of Pelican and I was able to start moving things over. Most of the hard work was actually adapting one of the pelican themes (notmyidea-cms) to resemble my old site design and making it mobile friendly. Bit of a hacky process but it's mostly done.

Since I wasn't a very prolific blogger I'm just copy pasting my blog posts over.

Conclusion

So far I'm quite happy about making the move and I would definitely recommend bloggers who're technically inclined to explore static site generators and Pelican in particular. If you're using something like wordpress I believe there are scripts to make the migration process simpler. The documentation is good and there are plenty of tutorials on the web to help you out too.

Toshiba Chromebook 2

Sat 24 October 2015

I recently decided to purchase a chromebook as I wanted a cheap, portable laptop to browse on and do some casual development on the go. I came across the Toshiba chromebook 2 which had good reviews and was very affordable. I decided to buy the HD version.

I've had it for a few weeks now and here are some quick thoughts on it.

Hardware and specs

The laptop is slim, stylish and relatively lightweight. It is made of silver plastic and does feel a bit on the delicate side but considering the price this is acceptable in my opinion. The battery life is excellent running up to 8-9 hours. The skullcandy tuned sound is surprisingly good and listenable. The 13 inch HD is screen is excellent presenting vivid, sharp video, images and text. Unfortunately the resolution sometimes feel a bit too high as you can find yourself squinting to read text while browsing but this can be easily solved by increasing the text size.

As it is a chromebook it as a has cut-down non-standard keyboard which may initially pose issues (i.e no function keys or home/delete/insert etc.). You do get quickly used to this though. I've not fully explored the ports yet but it includes a USB 3.0, USB 2.0 and HDMI port along with a headphone socket and a SD card reader.

In terms of raw specs, it comes with 4GB RAM, 16GB SSD and an Intel Celeron N2840 CPU. This is more than ample for casual browsing, music, video and CLI based development. One of the features that particularly attracted me to this model is the absence of fans - the cooling is entirely passive. The silence is a welcome change to the constant whines of fans. And you don't have to ever worry about your system overheating due to clogged fan vents.

The 16 GB disk space is very small but I haven't encountered any issues yet as the aim is to have everything stored on the cloud (Google drive).

Chromeos and Crouton

Initially, I wanted to wipe the shipped Chromeos and put a GNU/Linux on it but then came across crouton. This is a way to run GNU/Linux alongside chromeos using the power of chroots (Chromeos is a Linux based OS like Android).

Setting up the crouton is relatively easy but you need to enable developer mode first which gives you access to developer shell. There are plenty of instructions on the net. I recommend starting with the crouton github page. I opted for to run Debian Jessie Xfce as I'm a Debian fanboy. I've not yet fully explored getting i3 running on it but it appears to be possible through some cursory googling.

What is surprising is that I've found myself spending most of my time within Chromeos. It is very usable and just works. I now usually access the crouton through a bash session ("sudo enter-chroot"). This effectively gives me the best of both worlds, I get to be within a user-friendly OS that just works with full access to a full-featured GNU/Linux environment. Kind of like the Mac but a lot cheaper!

There is also a command line SSH client which I frequently use to log into servers. I recommend installing the crosh window extension as the developer terminal that comes with chromeos swallows keypresses like ctrl-n as it runs in the browser. The crosh windows eliminates this.

Areas to improve

Unfortunately the file manager appears rudimentary and you can only access the Downloads folder in your filesystem. You cannot access CIF/Windows shares out of the box or Dropbox without third party extensions (although these are very easy to install). The Openvpn support is also a bit disappointing as the GUI doesn't support ovpn files (you can get around this by using the CLI client and some bash scripting). There also is no rdp client and I have to fire up an X session on my crouton to run the rdesktop application. Hopefully Google will address some of these issues in the future.

Google Play Book Store

Thu 26 February 2015

I finished reading Dune a few weeks ago which, for those not in the know, is a famous Sci-Fi novel by Frank Herbert published in 1965. It's considered a modern Sci-Fi classic but it's been laying on my reading list for the past 10+ years, until I discovered the Books section on Google Store.

I'm no newcomer to ebooks and have been using FBReader to read free EPUBs downloaded from the net on my PC and Android phones for several years. But the Google Play Book Store completely escaped my notice until recently. When I discovered it, I decided to give it a trial run by purchasing Alex Ferguson's biography which was on sale for £4.30, a quite reasonable price. The purchase process is simple enough, with several payment methods. I chose to pay via my Mobile Network Operator (EE) as it seemed the easiest at the time. I was asked to enter my password and confirm after which the ebook opened automatically. I was impressed. No hoops or complications to jump through at all. Google really has worked on making this as simple as possible and deserves credit. As someone who deals with broken, half-working software systems on a routine basis this was a breath of fresh air.

The ebook itself was of professional quality (no annoying OCR errors) and the Google ebook reader was top-notch too, making the reading experience a pleasant and effortless one. The only feature that I felt was missing was an invert colour option for the late night reading session.*

After devouring Fergie's biography (which I'll probably leave for another post) I decided to explore the Google Play Books library. It is decidedly massive containing pretty much everything on my reading list. I found Dune and decided to make the purchase immediately. To me, the prospect of being able to hop on to any book on my long neglected, creaking reading list is quite exciting.

I'm sure most of us have those certain books that we never got around to reading. Well, now you can, almost anywhere you want. As long as you have an Android phone, which is most phones these days, with a data connection. You don't need a specialist device like a Kindle or even a tablet. Ebooks have long been heralded as a revolutionary medium for literature but I think it may be Google who become the dominant force here by making them truly available and accessible. And this is from someone who has grown increasingly sceptical of the company over their recent antics.

As for Dune, it was everything I expected it to be. Epic and engrossing. Can't wait to dive into the rest of the series. I also now know where George Lucas got his “inspiration” for Star Wars!


* Actually, I just discovered this feature last night along with other display options. It seems I completely missed it. So I have no complaints with the Play Books Reader.

i3 Window Manager

Sun 08 February 2015

I've been giving the i3 window manager a spin for the last few days after noticing a lot of buzz about it on the webs. I have to say I am very impressed. So impressed I've decided to switch to it from specrwm.

The first thing you notice when you login is that it isn't an ultra-minimalist tiling wm. It comes preconfigured with a status bar which displays some useful system information (no need for Conky) and a system tray at the bottom (no need for trayer). It also has a task bar at at the top (both based on dmenu I believe). It sports some nice, low profile window decorations. It comes with stacked, tabbed and tiling modes which is very handy. It also has a scratchpad facility to keep rarely used windows out of sight (although this wasn't configured by default on Debian Jessie - see below). The config file is simple and easy to understand and the documentation on the site is excellent.

To get the scratchpad, screenlocking and the volume and backlight keys working I added the following to my config file (~/.i3/config):

# Scatchpad - http://build.i3wm.org/docs/userguide.html#_scratchpad
# Make the currently focused window a scratchpad
bindsym $mod+Shift+minus move scratchpad

# Show the first scratchpad window
bindsym $mod+minus scratchpad show

# Volume Keys
bindsym  XF86AudioMute exec amixer sset Master toggle
bindsym  XF86AudioLowerVolume exec amixer set Master 5%-
bindsym  XF86AudioRaiseVolume exec amixer set Master 5%+

# Backlight
bindsym XF86MonBrightnessDown exec exec xbacklight - 10
bindsym XF86MonBrightnessUp exec exec xbacklight + 10

# Lock Screen
bindsym Ctrl+Mod1+l exec xscreensaver-command -lock

I'm still exploring the different options and facilities but I am very impressed on the whole. Time for a screenshot: