Barebone Ubuntu 14.04 Cloud Desktop

Since I have found some issues with my previous LXQT setup in real-life work I decided to fall back to standard Lubuntu for my cloud desktop. As part of this I also switched to TightVNC which seems a lot easier to configure.

apt-get install --no-install-recommends lubuntu-desktop tightvncserver

sudo vim /etc/lightdm/lightdm.conf

#
# VNC Server configuration
#
# enabled = True if VNC connections should be allowed
# port = TCP/IP port to listen for connections on
#
[VNCServer]
enabled=true
port=5900
width=1366
height=768
depth=24

sudo /etc/init.d/lightdm restart

Connect to the system

ssh -L 5900:localhost:5900 -i /path/to/your/aws/keyfile.pem YOUR.EC2.IP.ADDRESS

tightvnc

Accessing your cloud desktop from Chromebook

One of the main reasons for setting up a cloud desktop is that I tend to use a lot of different devices some of which are not very powerful.

One of my favorite devices of late has been a HP 11 Chromebook. I originally bought it for a new employee and wanted to check myself how this thing stacks up to do day-to-day computing tasks more efficiently than a standard laptop without all the headaches of running Windows (viruses, endless driver installs, bloatware, malware, …). We already have several people at work working exclusively from Chromebooks and they absolutely love them. Long story short – I ended up keeping the Chromebook for myself as it’s an absolutely great secondary device for me. I can carry it with me everywhere (doesn’t weigh much more than a tablet, roughly the same size as a tablet & has a keyboard and is so much more useful than a tablet).

Initially I was using it more as a secondary device, but lately I have been thinking that I will not even take my main notebook at all for travels. The problem with this is that I do (sometimes – very infrequently) need access to software not available on such a limited device.

Accessing your Cloud Desktop via SSH (I know there seem to be people allowing direct VNC access – but that is just asking for trouble) is highly recommended. I also use RSA keys instead of password authentication.

Copy SSH Private Key (generated on desktop and public key added to authorized_keys on the cloud-server) to the Chromebook,

Unfortunately (unless you want to set you Chromebook into developer mode which has all sorts of other downsides) the inbuilt CROSH shell is very limited. However it gives you enough to securely connect to a cloud-server and you can use the whole tool-set from there

crosh> ssh
ssh> host example.com
ssh> user <username>
ssh> key <rsa_key_filename>
ssh> forward 8000:localhost:5901
ssh> connect

You can now use the RealVNC Chrome App to connect to your cloud desktop.

RealVNC

Vodafone LTE mobile data on Cyanogen Mod

I have had some issues recently with getting LTE (4G) connectivity on the Vodafone Australia Network using CyanogenMod 11 on multiple devices (http://forum.cyanogenmod.org/topic/92919-no-4g-signal-on-vodafone-au/). Turns out that it was an APN issue after all.

The APN provisioned by default when the Voda SIM card is inserted (vfinternet.au) does not work for the LTE Data Network. It works with GPRS & WCDMA, but fails to connect when the phone is set to prefer LTE (4G) Networks and they are actually available. It means that the handset will loose mobile data connectivity altogether. There are various APN Settings floating around on the interwebs, but any I tried previously did not fix the issue.

Ater needing to call Vodafone support for another device (on GPE Stock Android) that was experiencing the same issue I got given these APN Settings:

Settings –> Mobile Networks –> Access Point Names

APN Name: Vodafone AU
APN URI: live.vodafone.com

Leave all other settings at default (for MMS settings see the link to VF Support below).

image

I have tested this for 2 days and works beautifully. The correct APN settings can be found here: http://support.vodafone.com.au/articles/FAQ/APN-Settings

Sony Xperia Z2 upgrading to CyanogenMod 11

Contrary to my normal inclinations not to buy anything but Stock Android phones I ended up with a Sony Xperia Z2 in a hurry over the weekend (it’s a long story…). It appears to be quite a decent handset (with a pretty good camera actually) and one of the main reason to choose this over the other options was that is was one of the few high-end devices which already had a CM snapshot rather than just nightly releases. However similar to their colleagues at Samsung the Sony people also opted to stuff all sorts of crap-ware bloat onto the Android base OS. It appears not to be as bad as the Samsung (who are the kings of crap) mods, but for somebody used to the clean Android experience it’s just very annoying. So I opted to flash it straight to CyanogenMod.

Sony Xperia Z2 2 by epct414, on Flickr
Creative Commons Creative Commons Attribution-No Derivative Works 2.0 Generic License   by  epct414 

Prerequisites

You need the Android SDK installed and on your Path – see one of my other posts on how to do this.

Get Bootloader Unlock Code

Another annoying step which is not required with Google Nexus series.

http://unlockbootloader.sonyericsson.com/instructions

You will need to enter and confirm your email (WTF?) and need your IMEI number and at the end of the process you will get an update key that is required below.

Put phone into bootloader (fastboot) mode

Insert one end of the USB cable into your PC. Turn off the device and wait at least 5 seconds. Press and hold the Volume Down button and plug the other end of the Micro-USB cable in to your device.

fastboot devices
#should display the ID of the connected phone
fastboot -i 0x0fce oem unlock 0xKEY

Download CyanogenMod Release

Extract the boot.img file from the downloaded ZIP file via https://download.cyanogenmod.org/?device=sirius

fastboot -i 0xfce flash boot boot.img
fastboot -i 0xfce reboot

This should boot into Clockwork Mod Recovery and you can use the Volume +/- to navigate and On/Off button to choose.

Select the “Wipe data/factory reset” option

Note: this part was not in the CM Wiki or anywhere else and took me a while to get past. If you see an error “Error Mounting /sdcard/.android_Secure!” during the factory reset procedure you need to format the data partition manually. If you do not do this step the CM install will still work but you will not be able to boot the phone (it gets stuck at the Boot Animation).

Mount /data
Format /data

After the manual format procedure do the “Factory reset” again.

Install CyanogenMod

Choose the “Install zip from sdcard –> Install from sideload” option

adb sideload cm-11-20140804-SNAPSHOT-M9-sirius.zip

After the install has finished choose the “Reboot system now” option.

CM Wiki Entry: http://wiki.cyanogenmod.org/w/Install_CM_for_sirius

Removing ‘Video Call’ default in Google Calendar

This ‘feature’ has been annoying me for a while and after this has caused some confusion with some of my clients I decided to go and look where to disable this. Why this has been made a system wide default is beyond me.

Rather than in the users Calendar Settings this is actually in the Google Apps Admin Console (https://admin.google.com/)

Console –> Google Apps –> Settings for Calendar –> Sharing Settings

Disable the “Automatically add video calls to events created by a user” setting.

Direct Link: https://admin.google.com/AdminHome?fral=1#AppDetails:service=Calendar&flyout=sharing

Finding a private location check-in service

Foursquare decided that it was too hard for them to compete with location services like Yelp and split their app into two separate apps. Whilst that might make sense to the 4Square CEO and his VC masters, it makes no sense from a users perspective. Foursquare can be a bit of a battery hog already, and having 2 apps to open and “annoy” you with notifications is not an improvement by any means. And if I wanted Foursquare to be Yelp – I would have used Yelp in the first place. So no – I do not want to install another separate check-in App (called Swarm). One battery hogging location app was enough.

no checkins here by leogaggl, on Flickr
Creative Commons Creative Commons Attribution-Noncommercial-Share Alike 2.0 Generic License   by  leogaggl 

The other argument used by 4Square’s CEO is that he didn’t want users confused about the “gamification” aspects of 4Square. I personally think that this is highly patronising to the Foursquare user base. I am sure most users would be able to work out what it is useful for.

Since I have always used 4Square mainly as a means to get some analytics of my movements and historic record of where I was at what time (I always downloaded my checkins to Thinkup on my own server) I was trying to find something that would fit the same use case. Meet Ushahidi (http://www.ushahidi.com/) – an excellent geo-coded “reporting” service developed in Kenya. I have been following this project for years already.

Dynamic Timeline

Track your reports on the map and over time, filter your data by time, and see when things happened and where.

Interactive Mapping

One of the most powerful ways to visualize information is to display it on a map. The Ushahidi platform give you rich information mapping tools.

Multiple Data Streams

The Ushahidi Platform allows you to easily collect information via text messages, email, twitter and web-forms.

Free & Open Source

The Ushahidi Platform is free for you to download and use. It is released under the GNU Lesser General Public License (LGPL).

Installation information for your own Ushahidi Server can be found on GitHub – or you can use their hosted service called Crowdmap.

Whilst this is obviously not an option for everybody it works for me. I will miss some the social aspect of 4Square as I had a small number of people I was sharing my check-ins with and it did bring about some by-chance meetups & conversation about other people’s check-ins. But the Ushahidi instance can be shared between multiple people. Maybe some will come along for the ride.

So long Foursquare – it was nice while it lasted ! If you treat your users like sheep – all you will be left with is sheep…

And for those who want to delete their Foursquare account: https://support.foursquare.com/hc/en-us/articles/201065530-How-do-I-delete-my-account-.

ARD Mediathek offline viewing on Ubuntu

Since I am a bit of a sucker for German “Krimis” as well as some their excellent documentaries I like to watch ARD Mediathek IPTV. However there are several problems with this when you live at the opposite side of the world. ARD has a block for any films that are 15+ years outside of 20.00h-6.00h GMT+1. Which makes it pretty much impossible to watch at a reasonable time in Australia. I also like to watch these things on the plane which requires download of the media files.

Install JSON Parser

sudo apt-get install jq

Download script

wget https://github.com/leogaggl/media/raw/master/download_mediathek.sh
chmod +x download_mediathek.sh

Usage

./download_mediathek.sh -f save_as_filename.mp4 -q 3 MEDIATHEK-URL

The -f and -q parameters are optional.
-f filename.mp4 (or full path + filename to save in different directory). Defaults to original filename
-q quality setting from 0 to 3 (where 0 is lowest and 3 highest quality). Defaults to highest quality

Please leave a comment if you find any issues or log an issue on GitHub.

NOTE (2014-07-06): If you are only interested in the Tatort series I suggest you look at this script by Felix Knecht (see comment below)

Ubuntu 14.04 Amazon EC2 Cloud Desktop using LXQT

Using Amazon EC2’s free usage tier to host your own cloud desktop is a very economical way to to have a desktop at hand anytime you can not be near one. Since I quite often use Chromebooks these days when on the road this is a particular handy way should I need a full desktop for certain tasks.

Since Ubuntu 14.05 is my default desktop on my normal hardware I obviously want to have my cloud desktop running the same underlying OS. However I don’t think running Unity as the desktop interface would be appropriate via a low-bandwidth remote desktop connection. For this reason I chose LXQT. If you need total stability you probably should go for the more mature LXDE instead, but I have already tried LXQT on an old EEE PC and was very impressed by the speed and low resource usage.

Provision Ubuntu 14.04 LTS EC2 Instance

EC2 Choose Image

Instance details

  1. Connect to AWS Console and go to EC2 Service
  2. Choose OS Image: “Ubuntu Server 14.04 LTS” (see screenshot)
  3. Choose a “Micro Instance” if you want to use Amazon’s Free Usage Tier
  4. Choose Instance details – the defaults will generally be fine
  5. Add Storage (I generally add a separate Volume for /home but default should do)
  6. Tag instance (just give it a name to that makes sense to you in the console if you have more than one)
  7. Configure Security Group – I only set SSH which is the default (see Firewall config below). Add any other ports needed
  8. Review & Launch the instance. You need to choose your RSA Access Keys in this step. If you haven’t got any and download. DO NOT LOOSE the private keys or you will not be able to connect.

Setup Desktop & VNC

Connect via SSH to the EC2 Instance you just created (using the IP in the control panel and your RSA Key)

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:lubuntu-dev/lubuntu-daily
sudo add-apt-repository ppa:gilir/q-project
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install lxqt-metapackage lxqt-panel vnc4server

Start VNC server under the desired user account. This will create the desired configuration files. Kill after the startup process is finished.

vncserver
#after successful start
vncserver -kill :1

Edit xstartup files

vim ~/.vnc/xstartup
Paste the following:
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
exec openbox-session &
startlxqt &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &

Create startup script

sudo vim /etc/init.d/vncserver
Paste the following:
#!/bin/bash
### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: VNC Server Startup Script
# Description: Author: Leo Gaggl (www.gaggl.com)
### END INIT INFO
unset VNCSERVERARGS
VNCSERVERS=""
[ -f /etc/vncserver/vncservers.conf ] && . /etc/vncserver/vncservers.conf
prog=$"VNC server"
start() {
. /lib/lsb/init-functions
REQ_USER=$2
echo -n $"Starting $prog: "
ulimit -S -c 0 >/dev/null 2>&1
RETVAL=0
for display in ${VNCSERVERS}
do
export USER="${display##*:}"
if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then
echo -n "${display} "
unset BASH_ENV ENV
DISP="${display%%:*}"
export VNCUSERARGS="${VNCSERVERARGS[${DISP}]}"
su ${USER} -c "cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS}"
fi
done
}
stop() {
. /lib/lsb/init-functions
REQ_USER=$2
echo -n $"Shutting down VNCServer: "
for display in ${VNCSERVERS}
do
export USER="${display##*:}"
if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then
echo -n "${display} "
unset BASH_ENV ENV
export USER="${display##*:}"
su ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1
fi
done
echo -e "\n"
echo "VNCServer Stopped"
}
case "$1" in
start)
start $@
;;
stop)
stop $@
;;
restart|reload)
stop $@
sleep 3
start $@
;;
condrestart)
if [ -f /var/lock/subsys/vncserver ]; then
stop $@
sleep 3
start $@
fi
;;
status)
status Xvnc
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac

Mark the startup script as executable and create the config file for the startup script.
sudo chmod +x /etc/init.d/vncserver
sudo mkdir /etc/vncserver
sudo vim /etc/vncserver/vncservers.conf

Paste the following:
VNCSERVERS="1:USERNAME"
VNCSERVERARGS[1]="-geometry 1024x768"

update-rc.d vncserver defaults 99

Start the VNC Server

sudo /etc/init.d/vncserver start

Firewall configuration

By default VNC will use port 9501 (and subsequent ports for each session). Since VNC password authentication is generally very weak I personally do not expose this port through the firewall. I use SSH port forwarding to tunnel the VNC port through SSH (encrypted) which means only the SSH port is open and can be properly secured.

ssh -L 5901:localhost:5901 -i /path/to/your/aws/keyfile.pem YOUR.EC2.IP.ADDRESS

You should then be able to access VNC via localhost:

VNC Viewer

Hopefully you should see the LXQT Desktop:

Ubuntu LXQT

Upgrading Nokia X to CyanogenMod 11 (via Ubuntu)

The Nokia X seems to be a nice piece of hardware for just around $125 AUD. Nothing spectacular in terms of computing power, but much better build quality than your average cheap Chinese Android clone. I have always been a fan of Nokia hardware until they decided to commit suicide by firstly adding CEO Stephen Elop and ditching all of their software for Windows Mobile.

The problem with the device out of the box is that is has a horribly butchered version of Android. And by horribly I mean way worse than the usual bloat and crapware that poor Samsung, HTC or Sony users are normally subjected to. Hopefully this is only Nokia’s first step to a more open platform, but I wouldn’t hold my breath on that one.

Before committing to buy this device I made sure that I could flash it to CyanogenMod as soon as it arrives. Sidenote: I purchased from Mobicity AU – which turned out to be a big mistake. Do yourself a favour and go somewhere else unless you have weeks to wait.

Nokia X - CyanogenMod 11

Boot Mode – Nokia X

Nokia Recovery Mode:

1. Turn off your device
2. Press Volume + and Power Button 15 seconds

Dependencies

If you haven’t got the Android SDK or tools yet you need to install

sudo apt-get install android-tools-adb android-tools-fastboot

USB Configuration

sudo vim /etc/udev/rules.d/51-android.rules
#add the following line
SUBSYSTEMS=="usb", ATTR{idVendor}=="0421", MODE="0666", OWNER="plugdev"
sudo service udev restart

vim ~/.android/adb_usb.ini
#add at the end of the file
0x0421

sudo adb kill-server
sudo adb devices

Rooting the device

Download ClockWorkMod Recovery (or TWRP if you prefer).

http://forum.xda-developers.com/showthread.php?t=2703708

Check USB debugging in “Settings –> Developer Options” (it seems that the NokiaX has debugging enabled out of the box)

Boot into Recovery (see above)

sudo adb reboot bootloader
sudo fastboot -i 0×0421 flash recovery cwm-6028-normandy.img
sudo fastboot reboot

Installing CyanogenMod 11

Please note that currently this is not an official CM release but an unofficial port, however CM has already committed to taking this device onboard as an officially supported one in the near future.

EDIT 2014-06-17: WIFI is currently not working which should be a showstopper for day-to-day use.

Boot into Recovery (see above) – this should now be CWM Recovery rather than the previous Android Recovery.

Download files:
CM 11 ROM for Nokia X (Android 4.4.2)
Google Apps for CM 11

EDIT (2014-09-29): There seems to be a more complete version of CM11 here: http://forum.xda-developers.com/nokia-x/development/rom-cyanogenmod-11-m8-4-4-4-t2838336

In CWM recovery, select “Data Wipeout / Factory reset” option and wipe the data.
Select “Wipe Dalvik cache” from the Advanced Option
Select “Install ZIP –> Install ZIP from sideload”

sudo adb sideload cm-11-20140426-UNOFFICIAL-normandy.zip

Select “Reboot system now”

Note: the reboot can take about 1 minute to get started due to a bug in the current CWM Recovery.

Enjoy !

EDIT 2014-07-22: Since there doesn’t seem to be any active development on the CM port for Nokia X (which seems a shame since they are so cheap) I found an AOSP ROM (based on Android 4.1.2) which seems to be workable as a day-to-day phone.
ROM Download: http://loki.rombitch.com/Devs/Dhacker29/NokiaX/msm8625-ota-eng.dhacker29-custom.zip
Discussion: http://forum.xda-developers.com/showthread.php?t=2710107