Short takes: SSH, custom ports, root and Synology NASs

This blog has been much maligned of late… I’d like to get more time to write and I have literally hundreds of part-written posts, some of which are now just a collection of links for me to unpick…

In the meantime, a couple of snippets that may be useless, or may help someone one day…

Using SSH with a custom port number

My Synology NAS complains about poor security if I leave SSH enabled on port 22. It’s fine if I change it to another port though (security by obscurity!). Connecting then needs a bit more work as it’s ssh user@ipaddress -p portnumber (found via the askubuntu forums)

Logging on to a Synology NAS from SSH as root

On a related topic, I recently needed to SSH to my NAS as root (not admin). ssh root@ipaddress -p portnumber wasn’t authenticating correctly and then I found Synology’s advice on how to login to DSM with root permission via SSH/Telnet. It seems I have to first log on as admin, then sudo -i to elevate to root.

Preventing dnsmasq from running as a daemon (service) on a Raspberry Pi

Some time ago, I wrote a post about running a Raspberry Pi as a home infrastructure server (DNS, DHCP, TFTP, etc.). Now my Synology NAS is doing that for me (well, the DNS and DHCP at least – TFTP is less critical as my Cisco 7940 IP Phone just sits there taking up desk space most of the time) so I don’t need the Pi to provide those services.

Unfortunately, when I migrated DNS and DHCP a few months ago, I just stopped the service with sudo service dnsmasq stop so, after a power outage last week, when the Pi came back up, so did dnsmasq – and having two DNS/DHCP servers on the network produced some strange results (as might be expected…).

So, to do the job properly, I ran sudo nano /etc/default/dnsmasq and changed the ENABLED=1 line to ENABLED=0. That should prevent dnsmasq from running as a service but leaves the configuration intact if I ever need to bring it back online.

A quick sudo reboot and sudo service dnsmasq status is all that’s needed to check that dnsmasq stays disabled.

dnsmasq, not running

Using rsync to keep folders in sync on a Synology Diskstation NAS

Now I have backups working between my Synology Diskstation NAS and a storage account in Microsoft Azure (with over half a TB of photos so far backed up in the cloud), the next stage is to consolidate some more images into the folder that the backup works from.

I don’t want to remove them from their source (which in this case is the copy of my OneDrive data on my home drive) but I do want to archive all of the iPhone images I have there to the master photos folder so they are included in the backup.

Reading around the Synology forums suggests that this is not as straightforward as one might think. It appears there’s no easy way to synchronise two folders on the same NAS within the DSM software; but then I stumbled across Zarino Zappia (@zarino)’s post about a Synology-flavoured rsync backup script.

By following Zarino’s advice and using ssh to connect to the box as admin, I was able to achieve what I wanted with the following command:

rsync --itemize-changes --archive --progress --verbose --inplace --exclude '*@SynoResource' --exclude '@eaDir' --exclude '*.vsmeta' --exclude '.DS_Store' --exclude 'Thumbs.db' /volume1/homes/mark/OneDrive/iPhone\ Photos/ /volume1/photos/Digital\ Photos\ \(Master\)/Mark\'s\ iPhone/

(BTW, right click is the way to paste text to the command line in PuTTY!)

Some people on the Synology forums had suggested synchronising via another computer on the network would be fast! That sounds strange to me – logically a copy will always be faster on a single device with no network in between. For reference, it took about 20 minutes to rsync 32GB of images/videos on my on my DS916+.

Incidentally, the Error 23 in the screen shots was actually a typo in my command (missing space before one of the –exclude options). I re-ran with –dry-run to see which files were not transferred…

The next step will be to script this and get it running as a scheduled task but that can wait for another day…

RasPi Wi-Fi

Way back in the autumn of 2012, I was getting all excited about my Raspberry Pi. I even hacked around to get it working over Wi-Fi but never got around to publishing the post!  So, a year and a bit later, here are a few notes based on some links I recorded at the time. Your mileage may vary (the Raspberry Pi has come a long way since then and I was running Debian Squeeze rather than Raspbian) but if you’re having difficulties getting RasPi Wi-Fi to work, hopefully some of this will help.

The Wi-Fi adapter that I used was an Edimax EW-7811Un nano USB adapter which I seem to recall I originally purchased from Maplin before returning it when I realised it was much less expensive online.  There are some good notes on the Raspberry Pi verified peripherals list that may help (much better than when I was working on this in 2012).

Tomasz Miklas’ post provided a ton of information on configuring the operating system to work with the adapter, as did this guide on elinux.org.  If you have trouble with the Realtek drivers, there’s a post that may help – you might want to read it in conjunction with these notes on the Raspberry Pi forums.  I also found that I had to use the sudo bash scriptname.sh command, rather than just sudo scriptname.sh. The final resource I found in my notes was Mr Engman’s “idiots guide” to RTL8188CUS Wi-Fi setup.

So, there you have it – ingredients but no method, I’m afraid.  I also found that the WiFi reliability depended on which other peripherals were plugged in to the RasPi (for example I use a cheap mini wireless keyboard and mouse set from Maplin) and I had some success with a powered USB hub (a Logik LT4HUB10).  Since then, I’ve switched over to a 1500mA power supply from The Pi Hut but am not sure it’s made much difference.

Installing a 64-bit guest operating system on Oracle Virtual Box

With no need to run a Windows infrastructure at home these days, recently, I began to plan to move from a Windows Server at home to a Linux-based machine for basic services like DNS, DHCP and TFTP.  Initially, I plan to build a virtual machine before switching back to native configuration when I’m happy that all is working as it should be.

The target hardware is the “low-power” server that I built a few years ago, based on an Intel Atom 330 dual core CPU. Whilst this does provide 64-bit processing capabilities, it lacks VT-x so is unsuitable for Hyper-V.  Consequently I installed Oracle Virtual Box as a free type 2 hypervisor and began to install an Ubuntu Server (12.04 LTS) virtual machine.  This failed, complaining that the underlying architecture was i586 and that the 64-bit image I was using needed an i686 CPU.

According to a post on the Ubuntu forums, to run a 64-bit guest in Virtual  Box, I need to enable Intel VT-x (or AMD-V). As that’s not an option for me, I had to revert to 32-bit build but it’s something useful to remind myself of as my virtualisation knowledge is a little rusty these days…

Installing Ubuntu 12.04 on an old laptop without PAE

Initially perfect for young children (portable, cheap, small keyboard), the screen resolution (1024×576) on my sons’ netbook is becoming too restrictive and, with no Flash Player, some of the main websites they use (Club Penguin, CBeebies) don’t work on the iPad.  Setting up an external monitor each time they want to use the computer is not really practical so I needed to find another option – for now that option is recycling my the laptop that my wife replaced a couple of years ago (and which has been in the loft ever since…)

The laptop in question is an IBM ThinkPad T40 – a little long in the tooth but with a 1.5GHz Pentium M and 2GB of RAM it runs OK, although hundreds of Windows XP updates have left it feeling a little sluggish. Vista and 7 are too heavyweight so I decided to install Ubuntu (although I might also give ChromeOS a shot).

Unfortunately, the Ubuntu 12.04 installer stalled, complaining about a lack of hardware support:

This kernel requires the following features not present on the CPU:

pae

Unable to boot – please use a kernel appropriate for your CPU

So much for Linux being a lightweight operating system, suitable for use on old hardware (in fairness, other distributions would have worked). As it happens, it turns out that this is a known issue and there are a few workarounds – the one that worked for me was to use the non-PAE mini.iso installer (I wasn’t prompted to select the generic Linux kernel, but I did have to select the Ubuntu Desktop option).

Once Ubuntu was installed, Joey Sneddon (@d0od) has a useful article on the OMG! Ubuntu site listing 10 things to do after installing Ubuntu 12.04 – this helped with things like installing Codecs, Adobe Flash and better Libre Office menu integration – now to see how the family gets on with a non-Windows OS… I suspect the kids will hardly notice the difference.

Getting started with Raspberry Pi (#RasPi): Take 2

Raspberry Pi is a trademark of the Raspberry Pi FoundationA couple of months ago, I wrote about getting started with Raspberry Pi but I have to admit it wasn’t exactly successful. In true open source style the Raspberry Pi FAQ (since updated) contradicted the downloads page/quickstart guide and an official blog post suggested that Fedora was the recommended distro.  I had some issues with Fedora, not least that a graphical login seemed to fail (there’s a forum post that suggests why that might be a problem) but also with getting hold of Scratch (which is something I want to use the Pi for, with my sons).

Last night I tried again, reflashing my Pi’s SD card using the Debian 6 “Squeeze” distro from the Raspberry Pi downloads page. There are various tools to do this (I used Win32DiskImager, also recommended on the downloads page, although the Softpedia download site is UX disaster, but Linux and Mac users already have dd and there is a Windows port of dd that Element 14 are distributing).

With the SD card flashed, I booted the system, logged in (username pi, password raspberry) and set about resizing the 2GB image to fill my 8GB SD card.  There’s good advice for resizing flash partitions on the Embedded Linux Wiki and the steps I took were:

  1. Edit the partition table:
    sudo fdisk -cu /dev/mmcblk0
    p (to view the partition table)
    d (to delete a partition)
    3 (to select partition 3)
    d (to delete a partition)
    3 (to select partition 2)
    n (to create a new partition)
    p (to make it a primary partition)
    2 (to create partition 2)
    157696 (to set the starting position to match the old partition table – see the output from the p command earlier)
    Press the Enter key (to set the maximum available partition size)
    w (to write the partition table)
  2. Then, reboot:
    sudo shutdown -r now
  3. After logging in again, resize the partition:
    sudo resize2fs /dev/mmcblk0p2
  4. Finally, check the new size:
    df -h

With a working system, I launched the LXDE graphical user interface with startx. and found that there is a decent amount of software (including Scratch, Python, etc.) already installed. It’s also possible to access the Raspberry Pi remotely and run the GUI on another system with X Windows/SSH.

Back in the command line, I wanted to install a twitter client (so that my Pi can tweet status updates) and Twidge is my favourite (CLI-based) client on a Linux system.  Romilly Cocking has written about installing Twidge on the Pi (Tweety Pi!) but I found I needed to run sudo apt-get update before I could successfully complete the sudo apt-get twidge command (without the update, there were lots of 404 errors for missing dependencies). As I was running Terminal inside the LXDE environment, I could use Midori to authorise Twidge via the Twitter API, completing the twidge setup process, before sending a couple of tweets.  If you don’t like Midori, I couldn’t find a suitable version of Firefox but I understand Google Chromium can be installed on the RasPi using the sudo apt-get install chromium-browser command).

I’m much happier with the Pi now it’s running Debian – and tonight’s activity involves creating a case for it out of an old business card box (an Altoids tin won’t fit!) – watch this space for more details!

Getting started with Raspberry Pi (#RasPi)

Raspberry Pi is a trademark of the Raspberry Pi FoundationMuch to my manager’s disgust (he has a programming background, whilst I’m an infrastructure guy “by trade” – although I did write code in my youth!), my Raspberry Pi arrived last week. Despite the botched launch, I still think this is one of the most exciting products we’ll see this year because, well, because it’s a fully functioning computer for around £25 (Model B) and that means the potential addressable market is enormous. Actually, that’s not quite right – the Pi is around £25 (plus VAT) and then you’ll need some peripherals – although they should be relatively easy to lay your hands on:

  • A micro-USB mobile phone charger (I use the one that came with my Nokia Lumia 800 but any 5V supply that can feed a micro-USB cable will do)
  • A USB keyboard
  • (Optionally) a mouse
  • (Optionally) some speakers
  • (Optionally) a USB hub (powered)
  • A wired network connection
  • An SD card
  • A display – but watch out as Raspberry Pi supports HDMI and component out (RCA) – not VGA.

My monitors are mostly VGA (I have one that will take DVI) and my TV is far too old for HDMI (it’s a 14-year-old Sony Trinitron 32″ widescreen CRT!) so I set the Pi up to use the analogue  connection to the TV.

Installing the operating system

I selected a Linux distro (the Raspberry Pi blog suggests that Fedora Remix is the recommended distro, as does the FAQ, although there is extensive discussion about whether to use Fedora or Debianthe Raspberry Pi quick start guide suggests that developers should use Debian and there are alternative downloads too). Eventually, I managed to install the Raspberry Pi Fedora Remix on my SD card (my Ubuntu machine recognised the SD card, but the Python version of the Fedora ARM Image Installer didn’t*; meanwhile my work laptop installed an image on the SD card but it wouldn’t boot – I suspect that’s down to the disk encryption software we use; finally I managed to run the Windows version of the Fedora ARM Image Installer on another Windows 7 PC).

Once I had an operating system installed, I booted and the RasPi picked up an IP address from my DHCP server, registered itself in DNS (raspi.domainname) and set to work expanding its disk to fill the 8GB SD card I’m using.

*getting this installer to work involved installing the python-qt4 package in the Ubuntu Software Centre, then running ./fedora-arm-installer.

Switching displays

Unfortunately, standard definition CRT TVs are no better at working with Raspberry Pi’s than they are with any other computer (except a games console) – and why I thought that should be the case is a mystery…

With only part of the display visible via component out (and not exactly easy to read) I started to investigate options for use of the HDMI port.  It turns out that HDMI to VGA is too expensive, but an HDMI to DVI cable cost just £2.39 at Amazon (thanks to Chromatix, The EponymousBob and GrumpyOldGit on the Raspberry Pi forums for sharing this info). With the RasPi hooked up to my only digital monitor, everything was much easier, although I did have to plug the cable directly into the monitor and I’m now waiting for delivery of a DVI-I female to female gender changer so that it’s a bit easier to swap the monitor cable between my computing devices.

So, what’s it like to use then?

Did I mention that the Raspberry Pi is a fully functioning computer for around £25? Well then, what’s not to like? Sure, performance is not lightning fast – the Raspberry Pi FAQs suggest:

“… real world performance is something like a 300MHz Pentium 2, only with much, much swankier graphics”

but that’s plenty for a bit of surfing, email and teaching my kids to write code.

I am finding though that I’m struggling a little with my chosen distro. For example, I haven’t yet managed to install Scratch and it doesn’t seem to be one of the recognised packages so I may have to resort to compiling from source – hardly ideal for getting kids started with coding. For that reason, I might switch to Debian (I’m downloading it as I write) but for now I’ll continue to explore the options that the Fedora Remix provides.

I’m sure there will be more RasPi posts on this blog but if you’re one of the thousands waiting for yours to arrive, hopefully this post will help to prepare…

And once the educational models are available, I’ll be encouraging my sons’ school to buy a lab full of these instead of a load more netbooks running Windows XP…

Some useful stuff to install on a Linux machine

Last year, I decided to take my netbook out of hibernation and install Ubuntu Linux (11.04) on it. It still doesn’t get used much (the iPad is just so much easier than a netbook – except perhaps for typing) but before I blow it away and install something else… like Windows 8, or Android perhaps… I wanted to capture a few notes from the bits and pieces I installed.

Apologies if these notes are not much use to anyone else but, then again, they might be handy for someone…

Command Line Twitter client (Twidge)

I’ve previously highlighted the existence of Twidge and it’s a useful tool to install on a Linux box. Ubuntu Manual has outlined the steps for installing Twidge on Linux (specifically Ubuntu) but the basic steps are:

Update the sources list:

sudo gedit /etc/apt/sources.list

and add the following lines:

deb http://ftp.de.debian.org/debian squeeze main
deb-src http://ftp.de.debian.org/debian squeeze main

then install the package:

sudo apt-get update
sudo apt-get install twidge

From this point on, twidge --help and twidge lscommands should tell you all you need to know.

Password manager (LastPass)

LastPass works with a variety of Linux browsers so just head on over to the download page and follow the instructions.

File sync (Dropbox)

Dropbox has Linux packages for a variety of Linux distros (download and then double-click on the installer) and of course there’s the option to compile from source too.  The download page also includes command line instructions and a script for controlling Dropbox from the command line but I haven’t tried that yet…

Music (Spotify)

There isn’t a fully-supported Spotify client for Linux but, because so many of their devs use it, there is a “preview version” available. More details are available on Spotify’s previews page but the basic steps are:

Update the sources list:

sudo gedit /etc/apt/sources.list

and add the following lines:

deb http://repository.spotify.com stable non-free
deb-src http://repository.spotify.com stable non-free

Optionally, verify the package with

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4E9CFF4E

Either way, install the package with:

sudo apt-get update
sudo apt-get install spotify-client-qt

I’ve not had any problems, but I did spot Ross Warren’s post about Spotify on Linux crashing at startup.  If this happens, then you might need to clear the cache:

rm -r ~/.cache/spotify

Mobile communications

The last items is probably not that useful to other people but I managed to get an O2 3G dongle working (Sierra Wireless Compass 889). Unfortunately, Sierra Wireless have updated their website and the Linux support has gone AWOL… but I found some information on a third party website suggesting that Sierra Wireless submits driver updates and patches to the public Linux distribution found at www.kernel.org. Using Network Connections, I was able to create a mobile broadband connection with the following settings:

  • Number: *99#
  • Username: o2web
  • Password: password
  • APN: mobile.o2.co.uk

Obviously, these settings will vary according to the carrier but many providers are included in the New Mobile Broadband Connection “wizard” (is it called a wizard on Linux?), so it may just be a case of picking the appropriate carrier, billing plan and APN.

An alternative enterprise desktop

Earlier this week, I participated in an online event that looked at the use of Linux (specifically Ubuntu) as an alternative to Microsoft Windows on the enterprise desktop.

It seems that every year is touted as the year of Linux on the desktop – so why hasn’t it happened yet? Or maybe 2011 really is the year of Linux on the desktop and we’ll all be using Google Chrome OS soon. Somehow I don’t think so.

You see, the trouble with any of the “operating system wars” arguments is that they miss the point entirely. There is a trilogy of people, process and technology at stake – and the operating system is just one small part of one of those elements. It’s the same when people start to compare desktop delivery methods – thick, thin, virtualised, whatever – it’s how you manage the desktop it that counts.

From an end user perspective, many users don’t really care whether their PC runs Windows, Linux, or whatever-the-next-great-thing-is. What they require (and what the business requires – because salaries are expensive) is a system that is “usable”. Usability is in itself a subjective term, but that generally includes a large degree of familiarity – familiarity with the systems that they use outside work. Just look at the resistance to major user interface changes like the Microsoft Office “ribbon” – now think what happens when you change everything that users know about using a PC. End users also want something that works with everything else they use (i.e. an integrated experience, rather than jumping between disparate systems). And, for those who are motivated by the technology, they don’t want to feel that there is a two tier system whereby some people get a fully-featured desktop experience and others get an old, cascaded PC, with a “light” operating system on it.

From an IT management standpoint, we want to reduce costs. Not just hardware and software costs but the costs of support (people, process and technology). A “free” desktop operating system is just a very small part of the mix; supporting old hardware gets expensive; and the people costs associated with major infrastructure deployments (whether that’s a virtual desktop or a change of operating system) can be huge. Then there’s application compatibility – probably the most significant headache in any transformation. Yes, there is room for a solution that is “fit for purpose” and that may not be the same solution for everyone – but it does still need to be manageable – and it needs to meet all of the organisation’s requirements from a governance, risk and compliance perspective.

Even so, the days of allocating a Windows PC to everyone in an effort to standardise every single desktop device are starting to draw to a close. IT consumerisation is bringing new pressures to the enterprise – not just new device classes but also a proliferation of operating system environments. Cloud services (for example consuming software as a service) are a potential enabler – helping to get over the hurdles of application compatibility by boiling everything down to the lowest common denominator (a browser). The cloud is undoubtably here to stay and will certainly evolve but even SaaS is not as simple as it sounds with multiple browser choices, extensions, plug-ins, etc. If seems that, time and time again, it’s the same old legacy applications (generally specified by business IT functions, not corporate IT) that make life difficult and prevent the CIO from achieving the utopia that they seek.

2011 won’t be the year of Linux on the desktop – but it might just be the year when we stopped worrying about standardisation so much; the year when we accepted that one size might not fit all; and the year when we finally started to think about applications and data, rather than devices and operating systems.

[This post originally appeared on the Fujitsu UK and Ireland CTO Blog.]