Copy Files to Pogoplug Without The Pogo Software (using scp)

I recently picked up a Pogoplug on sale from John Lewis and thought I’d give it a whirl with my media.

Although it is a neat little device, one of it’s biggest benefits is also it’s biggest flaw in terms of design – and that is how it requires you to sign into pogoplug.com and maintain an account there. It also requires you to mount the pogoplug with their software for transferring and viewing files, rather than acting as a NAS.

Whilst it’s nice to have easy access to media outside of home (without having to fiddle with setting up port forwarding on your firewall and whatnot) it’s a bit of a drag when you’re on your own network. I noticed a severe performance degradation copying media to my pogoplug device using pogoplugfs rather than through a standard means. So I learned that Pogoplug does appear to have a Busybox install and along with that SSH access. In order to enable SSH access, Cloud Engines have been gracious enough to allow this through your my.pogoplug.com portal. You simply go to Security options and enable SSH, and change the password. From there it’s just a simple,

ssh root@<pogoplugIpAddress>

The problem is that there doesn’t seem to be any support for sftp and therefore I couldn’t use ssh in a file manager. Thankfully however ssh provides scp protocol and from there it was just as short script in order to zap files across over local lan without worrying about signing in.

When you attach an external harddrive to the Pogoplug, your files will be installed in a directory similar to ‘/tmp/.cemnt/mnt_sda2/’ where ‘mnt_sda2’ will be the mount point of your media device.

Be aware this script utilises “expect”, but you could use private keys instead.

ppsend.sh:
#!/bin/bash
#set -x
# Provide a list of media extensions to send to pogoplug
extensions=("mp4" "avi" "mkv" "jpg");
ppip="192.168.1.10" # The local ip address of your pogoplug
echo ""
echo "Sending video files to PogoPlug ($ppip) for the following extensions..."
for ext in "${extensions[@]}"; do
echo ${ext}
done
echo ""
for ext in "${extensions[@]}"; do
 expect -c "spawn bash -c \"scp -p *.$ext root@$ppip:/tmp/.cemnt/mnt_sda2/\"
 expect assword ; send \"mysshpassword\r\"; interact"
done

I think the next step for this is to translate it to another language and wrap it up in a GUI for easy access. So watch this space perhaps.

Live Backup of Minecraft

I use Minecraft on Linux, occasionally I find java crashes whilst I’m playing and I lose my world save. I think it has more to do with some buggy hardware currently than the OS after a discussion I had with someone in meatspace.

Anyway, yeah, no matter what’s at fault, losing a Minecraft world is no pleasant thing, so I created the following script to incrementally backup whilst I’m playing. I run it from my home directory:

#!/bin/bash

# Live backup of the game for java crashes
# Author: Wes Fitzpatrick

if ! [ -d .minecraft_live_backup ]; then
 cp -pr .minecraft .minecraft_live_backup
fi
if ! [ -d .minecraft_current_session ]; then
 cp -pr .minecraft .minecraft_current_session
fi
mv .minecraft_live_backup .mc_last_session`date | awk '{ print $1 $2 $3 $4 }'`
while true; do
 rm -fr .minecraft_current_session && cp -pr .minecraft .minecraft_current_session
 sleep 120
 rm -fr .minecraft_live_backup && mv .minecraft_current_session .minecraft_live_backup
done

What this does is first backups up your current .minecraft folder, so your last game is preserved, then creates two alternate backups. One is your current (minecraft_current_session) up to the last 2 minutes of play, the second is the previous current (minecraft_live_backup) in case the failure occurs during backup.

I’ve tested the backup copies and both work in event of a crash. This means rather than losing the entire castle, I’ve only lost the last few block placed.

Using PrivatVPN on Ubuntu Linux

After the Hide My Ass fallout and niggling doubts about AceVPNs logging policies, I’m trying out some recommended VPN services I found via TorrentFreak. The great thing about VPN providers is most of them allow you to purchase a limited time from 1-12 months, I decided to try out PrivatVPN who state apart from username and password, they don’t log anything.

PrivatVPN appears to be a small outfit operating out of Sweden offering servers in Sweden, US, UK, Switzerland and the Netherlands. I can’t tell if they are owned by anyone or just hosted by iLandsgruppen however their service is very barebones, with a small control panel, software download and instructions. The service is relatively cheap to – about £4 for 30 days.

They technically don’t have a Linux client, only configuration files to download, which seem to be outdated. Unlike that ‘other’ OS – where they offer a full client and countries to connect to, Linux only contains the address of their Swedish server and the wrong port number (21003). I found this out after the OpenVPN connection not working on Ubuntu so instead fired up my Windows VM just to see if it worked and it did. A quick gander at connection logs showed me the different port.

I notified their tech support, but for anyone who had problems like me with the following error,

read UDPv4 [ECONNREFUSED]: Connection refused (code=111)

Here are the correct IP address and Port numbers to connect to PrivatVPN servers. Let’s hope they update their documentation and config files:

Sweden: 80.67.10.138:21001
US: 108.59.1.216:21000
UK: 83.170.109.247:21000
Switzerland: 31.7.62.130:21000
Netherlands: 85.17.122.222:21000

PrivatVPN provide instructions for starting from the CLI, however if you prefer the GUI (I do purely for the networking icon to remind me I’m connected with a tiny lock) simply follow these steps:

  • Go to Network Manager, VPN Connections, Configure VPN…
  • Click on Import
  • Navigate to “/etc/openvpn” and select “privatevpn.conf”.
  • Then add your username and password
  • Check the IP address is the same as the one above and the port no. (under “Advanced” option)
  • You may want to configure multiple vpns so change the name too, to something like “PrivatVPN Sweden/US/UK…”
That’s it, you’re done. Enjoy your anonymity and freedom!

Update: UNR 10.04 Wireless on Samsung N210

Back in March I posted a “how I did it” on getting Wireless working the Samsung N210, which involved installing and compiling the Realtek driver. The post proved immensely popular and was top of google search results for a while when searched for “samsung n210 wireless”.

Unfortunately, unless you are still on Ubuntu 9.10 that guide is now useless, as I found out recently when I updated my Sammy netbook to 10.04. I did manage to get it working again, but it failed on another recent kernel update (2.6.32-24-generic) so I got fed up and rolled back to the last kernel (2.6.32-23).

It appears that Canonical messed up with the firmware or something (here’s a bug report) and so new firmware needs to be downloaded after compiling. It worked for me just downloading the firmware and restarting, but you may need download the latest r8192e driver and compile that first.

sudo apt-get install git-core
cd /tmp
git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/firmware.git
sudo cp -av firmware/RTL8192E /lib/firmware/
*RESTART WILL WORK* ONLY x86

Thanks to s32ialx on the Ubuntu Forums for the tip. You should check out the thread for further updates.

Curious Problem with Cork City Locale Geocaching Pocket Query

If you’re a premium member with Groundspeak’s geocaching.com then you will be aware of the ability to create pocket queries. These are really useful for throwing up to 1000 waypoints onto your GPSr for a days, or even a holidays caching.

As some of you know we were in Ireland recently (the reason for lack of posts) and I decided to take advantage of Stena Ferries free satellite wifi on the boat. I set a PQ for Cork and waited for it to build. When the query was ready I saved as usual to my shared Dropbox folder and then attached my Garmin 60CSx but despite loading fine onto my CacheBerry – the PQ just wouldn’y upload to the Garmin.

Puzzled, I tried an older PQ and verified that my script was working, as well as the Garmin was not having some kind of software fault. Next most obvious thing that occurred to me was perhaps the file was corrupted during download, after all it was a wireless connection via satellite on a moving ferry. I tested this theory by downloading the PQ again. Then I downloaded one I’d created earlier. The earlier one (Watford) worked, the Cork didn’t.

Then I decided to test the website PQ builder itself – maybe there was a technical problem. I checked the forums but there was nothing reported, so I posted a thread which didn’t go anywhere. I then tried creating an entirely new PQ of Leicester (never run before). I downloaded and Leicester loaded up onto my GPS no problem.

So there was something local to Cork which was borking my PQ which had to be in the file itself. I didn’t have much time left so I tried a splicing the file with my newly created Leicester PQ. I opened up the GPX file and chopped out the header:

<?xml version="1.0" encoding="utf-8"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" creator="Groundspeak Pocket Query" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.groundspeak.com/cache/1/0 http://www.groundspeak.com/cache/1/0/cache.xsd" xmlns="http://www.topografix.com/GPX/1/0">
<name>Cork</name>
<desc>Geocache file generated by Groundspeak</desc>
<author>Groundspeak</author>
<email>contact@groundspeak.com</email>
<time>2010-06-16T03:12:46.2642819Z</time>
<keywords>cache, geocache, groundspeak</keywords>
<bounds minlat="51.551967" minlon="-9.37105" maxlat="52.428967" maxlon="-7.593717" />
<?xml version="1.0" encoding="utf-8"?><gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" creator="Groundspeak Pocket Query" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.groundspeak.com/cache/1/0 http://www.groundspeak.com/cache/1/0/cache.xsd" xmlns="http://www.topografix.com/GPX/1/0">  <name>Cork</name>  <desc>Geocache file generated by Groundspeak</desc>  <author>Groundspeak</author>  <email>contact@groundspeak.com</email>  <time>2010-06-16T03:12:46.2642819Z</time>  <keywords>cache, geocache, groundspeak</keywords>  <bounds minlat="51.551967" minlon="-9.37105" maxlat="52.428967" maxlon="-7.593717" />

and footer:

</gpx>

I then copied the remaining xml and pasted it below the header in the Leicester PQ, then saved this and zipped it back up.

I ran my script and and uploaded it to my 60CSx – it worked!

I can’t see anything wrong with the header info above but this is where the error seems to lie. Maybe it’s something to do with the coordinates in the boundary tag, or perhaps some hidden character I missed. Does anyone more technical in both xml and WGS84 Datum than me have an idea?

Oddly enough, subsequent PQs for Cork after we arrived worked too.

Bluetooth on Ubuntu Linux vs on Windows Vista

The introduction of new technology into our lives always seems to have a ripple effect on our existing hardware. Recently I bought a Sony Alpha 330 DSLR which as an entry level SLR I am very happy with. However, I discovered my 4 year old desktop PC’s card reader could not handle the SDHC format that this camera uses.

So I ended up ordering an EVO Labs Internal Card Reader with Bluetooth from Amazon and found it installed into Ubuntu Linux without a hitch. I was then able to utilise the bluetooth chip to connect with my mobile and send/receive files. The only complaint I’d have is since my tower sits under my desk sometimes the bluetooth signal is a little choppy – I don’t know if this is a power issue or due to the proximity of other electrical devices.

Enamoured with my new bluetooth enabled desktop, I decided to invest in some cheap but stylish BTHS600 Bluetooth stereo headset headphones which I am happy to report work splendid with Ubuntu. The desktop took a few reboots to get there, I installed Blueman from the Synaptic Package Manager to manage the connection. All I have to do is switch the headphones on to pairing mode when I want to connect. My Sammy N210 netbook connected flawlessly with no reboots or additional software.

During the teething problems of installation, I wanted to try these with Windows to see how they worked and connected. Windows is good OEM OS that they install by default and is a good benchmark to see how hardware connects and responds.

I booted into Vista and this is where I discovered the snag. Vista was happy to recognise my new internal card reader but when it came to utilising it – it was demanding drivers. I have mislaid the driver disk somewhere because I didn’t need it to run on my main OS, and I’m used to Windows being able to recognise stuff – but it was not the case here. So instead Windows redirected me to the manufacturer website which it insisted was Toshiba. I downloaded the recommended driver package but surprise, surprise this driver didn’t work.

So I can’t get bluetooth working on Vista, and I’m not sure if the card slots will work either. Which OS isn’t ready for the desktop again…?

For those keeping score: Linux 1, Windows 0

For anyone else having trouble hooking up your bluetooth headset I recommend trying out these links:

http://it.toolbox.com/blogs/teach-it/bluetooth-audio-finally-working-in-ubuntu-hh-24028
http://fosswire.com/post/2008/10/better-bluetooth-audio/
https://help.ubuntu.com/community/BluetoothHeadset
http://ubuntuforums.org/showthread.php?p=4910397
http://ubuntu-ky.ubuntuforums.org/showthread.php?p=9030305

GetDeb.net for when it’s not in Ubuntu Software Centre

So you’ve checked Ubuntu Software Centre and scoured the Synaptic Package Manager. You’ve even googled for the application you need and come upon an obscure developers website with a tar.gz file and instructions to configure; make; make install.

Well if you’re new to Ubuntu Linux and still shy of the command line, check out getdeb.net for a broader list of applications and games that you won’t always find in the repositories. A .deb file is the Debian Linux (Debian is the distro Ubuntu is based on) version of .exe or .msi for Windows. It’s pretty much a one or two click process to get hold of some excellent software that for some reason doesn’t make Ubuntu’s repositories.

Becoming A Perfect Killer

If you’re going to work with computers and Linux in particular, sooner or later you’ll need to perfect your killing technique. I’m not just talking about those useless defunct processes or applications that refuse to die – I’m also talking about the Operating System itself. When it comes to Windows you’re pretty limited to the confines of Ctrl+Alt+Del and the power switch, but with Linux, as with anything else, there are many ways to do things.

Force Quit Applications that Won’t Die (Gnome)

The first and easiest way to kill an application is to install the Force Quit button on your top or bottom panel. Right click on the panel, select “Add to Panel…” then scroll down and find Force Quit and select “Add”. This adds a little broken window icon to your panel when clicked on, turns your cursor into a deadly cross. With the cross, click on any window that refuses to die and usually it will be instantly gone.

End that Pesky App
Managing Processes that are not Being Nice (Gnome)

If Force Quit is bit too brutal a method for you, you can always got to System -> Administration -> System Monitor, which is a bit like Windows Task Manager, to view processes in the Processes tab. Here you can choose to End an application in a softer way as well as reset its nice value (priority).

Kill that Lurking Background Process

Sometimes an application will seem to close normally, or even after a force quit, but will continue to skulk in the background, refusing to give up it’s entitlement to your cpu and memory. This is the Terminal comes in handy for terminating that rogue John Connor of processes.

Fire up the terminal (Applications -> Accessories -> Terminal) and type the following:

top

If you already know the name of the application or it’s not eating your cpu cycles you can use grep to filter all or part of the application name:

 ps -ef | grep -i [ name of app ]

Note the process id (pid) of the rogue application taking up cpu then type:

kill -9 [pid]

Killing Applications that Crash your Desktop (X)

Of course, the above methods are not useful if an application has caused your desktop to seize up. Not to worry, Most distributions boot up with several virtual terminal sessions with X (the GUI desktop) running on only one of them.

When X crashes,

  • Press Ctrl+Alt+F1. This will take you to the login prompt of the 1st of 6 terminals running.
  • Login as root, or your user id then sudo to root.
  • Run the top command to get a list of processes and PID numbers.
  • Press Alt+F2 to log into the 2nd Terminal
  • As with killing background processes above, you can simply type ‘kill -9 [pid]
  • Press Alt+F7 to get back to your desktop and all should be well

Note: even if the desktop does not recover after killing the process, if you can access one of the other terminals, you can still do a hard reboot by typing:

shutdown -fr now

If all else fails….

Raise A Skinny Elephant

It may sound like some kind of incantation or ritual now needs to be performed, or possibly a mafia codeword for calling in a hit on your computer – but it’s really just a mnemonic device.

Skinny Elephant Guy
source: Vin Rowe

If your desktop has completely seized and none of the above will work, then just remember that

Raising Skinny Elephants Is Utterly Boring.

This will give you back control of your keyboard, sync your hdd, end all processes, and perform a manual but orderly reboot. Type in the following:

Alt+SysRq (+ letters below in order, pausing between key strokes)
+r =  Put keyboard in raw mode (recapture your key presses)
+s = Sync the disk
+e = Terminate all processes
+i = Kill all processes
+u =  Remount all filesystems Read-Only
+b =  Reboot the system

On reboot let the system perform any filesystem checks and it will recover automatically.

If for some reason you can’t recall Skinny Elephants, or the thought grosses you out, you can always use BUSIER to help you remember – execute it backwards: (Alt+SysRq)+R+E+I+S+U+B.

Is Symantec Anti-Virus Malware?

Not quite going by strict definitions of malware, but it skates pretty close to annoying and intrusive software in my humble opinion.

Recently I had to work on a Windows XP based machine with a Symantec anti-virus ‘solution’ installed. As with most Windows PC’s, the system had ground down to a halt and was complaining of a full hdd. I was trying to troubleshoot the problem that disk-cleanup would not fix.

I installed Treesize, ran it and discovered in the ‘All Users’ profile the source of the problem.

The Windows partition was approximately 70gb. 46gb were taken up by temporary files created by Symantec in “C:/Documents and Settings/All Users/Application Data/Symantec/Symantec Antivirus Corporate Edition/7.5/xfer_tmp/”

Symantec Fail
Malware or Negligence?

I solved the problem by deleting the temp files and the xfer_tmp directory. I didn’t even check this was the right solution – if the program had crashed that would have been a bonus as far as I was concerned.

This is not just a program bug, this is borderline negligible, considering it’s supposed to be corporate software. It may not be malware by typical definition, but in my case: Installed by default and without choice or consultation, rendering the PC unusable – it’s malware to me.

I’m just glad I run Linux and don’t have to put up with this crapware most of the time.

Beyond Photorec… Gloobus Helps Discover What The Heck is in These Files?!

Last week I posted on my wife’s emergency situation upon losing hundreds of important work documents after a fatal delete. Photorec is a phenomenal tool in this situation. The problem with using Photorec to restore lost data or a corrupt partition however, is that it spits out files with a generic id for the filename – consequently you could find yourself spending hours opening, closing and renaming restored files.

Thankfully I have just discovered Gloobus, which is an open source alternative to Apple’s Quicklook, and what’s more it’s for Linux! This takes away the headache of launching OpenOffice.org hundreds of times and makes file previews a doddle. If only we’d found this last week!

Instructions for installing for Ubuntu are here, other distros will need to install from source.