Cyanogenmod 11 (KitKat) on a Samsung Galaxy S2 i9100

Getting an Android phone running CM with root and a sim unlock still seems to be an exercise in trawling out-of-date forum posts and downloading a variety of tools, kernels and ClockworkMod builds until you hit on a good combination and can actually get into CWM. After that, installs for me have always been really simple.

So; here's the magic combination that worked for me today; resulting in an unlocked Cyanogenmod Kitkat install. Generally, I was following the Cyanogenmod guide for the device, but relied on various forum posts and some articles on ibtimes.co.uk to get there in the end.

  • ODIN v.3.0.7. 
    • Heimdall repeatedly failed for me, and guides suggesting ODIN v.1.8.5 are out of date. 
  • GT-I9100_JB_ClockworkMod-Recovery_6.0.2.9.tar 
    • Installed under 'PDA' in ODIN, above. 
    • This build of CWM can't actually install Kitkat, resulting in "set_metadata_recursive: some changes failed" caused by a change in the image format since JellyBean. Some info here. Still, you need it to bootstrap the CWM upgrade below.
    • Unfortunately, this seems to have broken mass storage support on the device, which made getting the next few zip files onto the SD card a little tricky for me. If this happens to you, install the Android dev tools, and use `adb push`. 
  • CWM-KitKatCompatible-i9100.zip, 
    • This contains a build of CWM, which can actually install Kitkat. 
    • Install this from its zip in CWM, then reboot. Check the version of CWM at the top to make sure that it succeeded.
  • UPDATE-SuperSU-v1.25.zip
    • installed via zip from CWM 
  • cm-11-20140215-NIGHTLY-i9100.zip
  • gapps-kk-20140105-signed.zip
  • Galaxy S2 SIM Unlock
    • from the Play Store after you've rebooted into CM

As a final note, I did install the jeboo_kernel_i9100_v1-2a.tar early in the process, which may have helped me get into ClockworkMod later on. I'm not 100% on whether it's necessary or not.


novacom in Gentoo

So the screen of the Palm Pre in my house recently cracked, rendering it unusable. I dusted off my dev-embedded/palm-novacom ebuild to do a device wipe before discarding it.

What I discovered was that in the year or so that has passed since the last time I used it, it had stopped working.

The problem turned out to be a libusb compatibility problem -- installing dev-libs/libusb-0.1.12-r7 did the trick, and the phone is now wiping itself quite satisfactorily.

It's a dead technology, and I have no more devices which need it, so I'm afraid that I won't be updating the ebuild any time soon. Still, I hope that this tiny post may have been of use to someone out there.


Adobe Flash in Ubuntu - 2012 edition

Now, I don't use Ubuntu very much. I have too many bad experiences with upgrades, and I've come to loathe apt-get. Still, there are a growing number of machines in my extended family which now run Ubuntu, either because I use them occasionally myself, or because it's easier to maintain at a distance than Windows (and harder to completely break through casual web-browsing!)

What I'm finding though, is that an average daily update of an Ubuntu machine is distressingly likely to break my (non-technical) users' ability to browse the web. I use Gentoo, and so I'm used to having to do a bit of work myself for major upgrades, but Ubuntu promises more than that -- it promises to bring Linux within the grasp of the average user -- and it fails. And where if fails is usually related to the deliberate separation of packages between those which agree with hardcore Free Software ideology, and those which don't. Canonical are forced to supply some "non-free" software, just to supply an environment which can support the "non-free" internet.

Coupled with this is apt's tendency to "update" config files without user input, something which is anathema to someone used to portage. If it always worked, then that would be fine ... but nothing is that reliable.

Case-in-point is the wrestling I had to do today to get a working version of the Adobe Flash plugin onto K's laptop. Some weeks ago, websites began reporting that the installed flash version was out of date, and linking on to the Adobe site for a manual installer. I checked with apt, and it reported that adobe-flashplugin was indeed at the latest version. The library was sitting at /usr/lib/adobe-flashplugin/libflashplayer.so, and had been replaced relatively recently. Some locate-use later, I was relatively reassured that the manual installer hadn't been run at some point, and that there wasn't some other version of libflashplayer.so sitting around somewhere in a linux-version of dll-hell.

So what was happening? I ran firefox through strace, to make sure that it was loading the library, and lo and behold, it was using files in /etc/alternatives instead.

$ strace -s trace=file firefox &> log &
$ grep -i flash log 

After some man-page and googling, I found this extremely unhelpful SuperUser question, and some indications that I wasn't alone.

So now, armed with the update-alternatives command, with it's completely unhelpful -h output, I eventually got a list of the flash-related "alternatives" which the system was using.

$ update-alternatives --get-selections | grep -i flash 

That got me a list of 5 "alternatives", and one immediately caught my eye -- libgnashplayer.so. I've no idea when, but at some point the machine had been instructed to switch it's flash player from Adobe's to the GNU replacement... only it's value as a drop-in replacement is questionable at best. I've a long history with flash-on-linux (strange as it sounds, it's gotten better and better), and I'd love a working open-source implementation. But gnash just isn't there yet. In my case, the main website that K was using was Channel 4's streaming service, 4od.co.uk, which wasn't even attempting to stream video, but failing on a version-number check. More on that later.

So armed with this info, I gleefully uninstalled gnash, expecting apt- to work its magic. Nope, it turns out, it just left a broken symlink in /etc/alternatives. Ubuntu whim has renamed the package for flash any number of times, and guides were recommending:
  • flashplugin-nonfree (seems to have gone out of favour, except that flashplugin-nonfree-extrasound is still around)
  • flashplugin-installer (quite why this name, I've no idea
  • adobe-flashplugin (Probably today's nom-de-jour)

Installing flashplugin-installer ended up removing about 5 flash-related packages, and installed the same version of the flash library as adobe-flashplugin. In the end, I removed that again, and stuck with adobe-flashplugin. Quite what their naming scheme is is beyond me, but preserving both in the repository doesn't make much sense to me. Oh, and you might notice that the documentation relating to all of this is completely out of date.

Another check of update-alternatives showed only adobe libraries, and a check of 4od (thankfully) played some video. So until the next time gnash gets pulled in, and overwrites all my settings, everything's working. Fantastic. Now time to file a bug suggesting that gnash always present it's version as whatever the latest version of adobe flash happens to be.


ComicCheck - Extension checker for cbr and cbz files

Having recently moved city, I left behind all of my dead-tree copies of books and comics/manga. I'm working around it with my old-ish Sony Reader and an ipad1 I won. I did a quick write-up of using the ipad in gentoo on the new wiki, but if you've a recent version of iOS, you'll need to build from version control (ebuilds to do this are available from my overlay).

I use CloudReaders to read comics, as it's nice and fast, even for images-only PDFs. The price (free) is right too! I use it both for textbooks and for comics. The only problems that I've come across is that it gets slow on launch if there are many files for it to parse through and that there's no way to remove labels from it's dictionary (even if there are no labelled files left). I'm also stuck with a blank label, which I now can't get rid of. Aside from that, it does the job perfectly well, with good responsiveness, zooming and auto-scaling. It's actually the best software PDF/comic reader I've ever used (although the tablet form factor is a major plus for it).

There are two problems that I've encountered using it, which are only somewhat its fault;
  • It uses the archive-order for zip and rar files, not the sorted-order
  • It relies on file extension, and many cbr and cbz files have an incorrect extension. (comicbook-rar, and comicbook-zip, but you probably knew that)

Since realising that a cbr should be a cbz at the time that I try to read one, and with no way to rename the files on-the-go, I wrote a script to check comics and rename them if it detects that they're not open-able with the appropriate unarchiver. Note that it depends entirely on the stdout from app-arch/unrar and app-arch/unzip as they exist today, so it may well fail in the future. Using EXIT_CODES would be nicer, and I no longer recall why I didn't; perhaps unrar didn't feel like co-operating. The script doesn't overwrite, and has the endearing property of renaming completely broken files every time (so keep an eye out on it's output).

Since the people packing these archives don't seem to be aware that archives have internal order that isn't lexical, sometimes you get files that have the same order as whatever the directory entries happened to be, and CloudReaders doesn't sort the extracted files before rendering them. I might patch the script to re-pack the archives in future, depending on how prevalent this is.

Oh, and the usual security caveats apply (although what you're doing managing comics on your ipad on a secure server is entirely your business... see this for a security flaw in usbmuxd which would allow someone with a specially-rigged iPad to run arbitrary code)

Available to view through through google code or below.

Normal Operation:
bar.cbz  foo.cbr
# foo.cbr is really a zip, bar.cbz is really a rar 

$ comiccheck 
!cbr foo.cbr
!cbz bar.cbz

bar.cbr  foo.cbz

$ comiccheck 


# swap_type FROM TO (eg. swap_type cbr cbz)
swap_type() {
 if [ ${1,,} == cbr ] ; then
  TESTSTART="unrar l "
  TESTEND="  | grep -i 'is not'"
 elif [ ${1,,} == cbz ] ; then
  TESTSTART="unzip -l "
  TESTEND="  2>&1 | grep 'cannot find zipfile'"
  echo "I don't know that type!"

 for i in *${1,,} *${1^^} ; do 
  TEST="${TESTSTART} \"${i}\" ${TESTEND}" 
  FAILTXT=$(eval ${TEST})
  # if not zero length, echo, try as zip, mv to cbz
  if ! [ -z "$FAILTXT" ] ; then 
   echo "!${1,,}: ${i}" 
   if ! [ -e "${toname}" ] ; then 
    mv "$i" "${toname}"
    echo "${i} is not a ${1,,}, but not overwriting ${toname}"


swap_type cbr cbz
swap_type cbz cbr

As usual, comments, patches are welcome.


Overlay Update - XBMC Beta Testers needed!

Perhaps it's a little odd to be writing an overlay update without ever having written about it before, but that's where we are today. In any event, I've just updated the list of packages in my overlay, and thought that it's about time to write about it and to make a call for testers.

My Gentoo Overlay is unimaginatively entitled 'jamesbroadhead', is hosted on overlays.gentoo.org and is accessible through layman (or paludis, if that's your kind of thing). I set it up as a holding ground for ebuilds that weren't quite ready for the sunrise commit process, or which were versions of packages in portage, and so ineligible for Sunrise. I've had mixed success pushing packages to the main tree - my ebuilds for Descent (the awesome '90s game) have been gathering dust for quite a while.

Obligatory Descent screenshot

The contents of the overlay, and a bug tracker for the ebuilds in it are available on my google code page, and gitweb for the overlay is here.

So why would you add the overlay? Well, the main package I regularly bump in sunrise is media-sound/gogglesmm - a very lightweight music player. It does two things rather well - play music, and start-up incredibly fast. If you want the latest version of that, or if you are having problems with the in-sunrise version, give that a try. I've had to patch the ebuilds for the fox toolkit to push for the unmasking of the x11-libs/fox:1.7 SLOT, including getting the SLOTting to work properly, so the version in Sunrise is a little out of date until those changes go live. Please test my overlay version!

gogglesmm-0.12.6 playing CC music from thisisopenmusic.com

Another (recent) reason would be to try out the latest version of xbmc - the 11-series betas have been around for a month now, and I have a working ebuild which I'm using here, but could do with more use-cases. If you try it, please post on the Gentoo Bugzilla with your experiences. If you haven't tried xbmc before, I find it a nice package for my home media center.

Oh, and I also bumped dev-python/selenium, so if you're into web-dev testing, that might be nice. I'll push it to sunrise ... some time soon.

Converting Nokia Ovi Suite Contacts for Android - 2012 Update

Seeing as my original post on converting Nokia OVI Suite contacts continues to get loads of hits, and I had to go through the process again for a friend's phone, I thought that I'd do a quick 2012 update. This will be a summary; if you're having trouble following it, take a look at the original post, which goes into more detail.

First off - things are a little easier these days! Gmail / Google Contacts now accepts multi-VCard .vcf files. Sadly, they still don't allow multi-file import, so the many output .vcf files must still be merged.

As a result, all you need to do is perform a full backup in OVI Suite, extract all the VCards from the the .nbu with NBUExplorer, and merge the VCards into a single file. Then, upload the resultant file to Gmail.

To merge the files, here's a quick snippet which I used in Cygwin:

 $ cat *.vcf >> merged.vcf 
According to Wiki, this is the DOS equivalent (but I don't even have dosbox installed right now to test it):
 $ copy /a a.vcf + b.vcf merged.vcf 
(Yes, that's a '+'; I'm not going to read up on DOS loops for you - just use cygwin).


#OccupyDWS - My Afternoon Outside the Dublin Web Summit

So I was free in Dublin today, and decided to go on down to the Dublin Web Summit - having watched some talks last night and interested in getting more of the personal experience today. I got there, but was told that all the tickets had sold out weeks before, and that none were available. So I strolled outside, waited at the bus stop for a stretch, and then realised that I could hack myself my own little Web Summit, with all the experience of the attendees. So was the Occupy Dublin Web Summit movement born. (#OccupyDWS)

The #OccupyDWS Rallying Sign (v1.5)

At first a little timid, and absorbed by the mighty #dws tweet-feed, I sat to one side of the RDS Anglesea Road entrance, and tweeted an initial declaration that I was outside the #dws and would fancy someone to chat with about whatever was going on inside. After a few minutes in which my huge crowd of potential Occupiers failed to appear, I decided that I needed to identify myself a little better - and so I created a sign out of an envelope I happened to be carrying in my bag.

After a good few people passed by, I realised that the sign wasn’t obvious enough, so I relocated to directly in front of the pedestrian entrance. That’s how most people saw me - tweeting away or watching the talks “live”, sitting cross-legged in the sun. I was having a great time; many people would glance down and ignore me, but the grand majority coming out of the event had a smile or a laugh for my solitary “protest”. Most of them would stop and chat about the Web Summit, the people they’d met, the interesting start-ups or the best talk. Most people seemed to agree that the night before had been better than this morning; more famous speakers, or maybe just more attendees.

I explained that I wasn’t able to get in because I didn’t have a ticket, which led more than one person to offer me some money. A little shocked by this, I changed my sign from “No ticket :( ” to “No tickets for Sale :( ”. I got offered more than one wrist-band as people departed, but I explained that I was having so much fun, that I’d given up on going inside and that I didn’t actually want to sneak in that I declined. One man ignored all that, and gave me his wrist-band anyway. Thanks, but I didn’t use it.

Free Access! All I’d have to do is abandon my principles.

Like every protester, I started off just sitting outside the Web Summit with a pretty simple point, but I found that as I explained it to more and more people, that I was becoming more and more involved in the issue. I found myself saying things like:

“No room? They don’t even know how many people are in the building!”
“Sounds like the kind of thing we use computers to sort out!”
“People keep leaving, there’s gotta be room for me!”
but later got a little more fervent -
“The internet is all about instant access!”

Whoops - was my ironic “protest” actually starting to take itself seriously? Turns out, that as I talked to people about it, my thoughts turned to how to solve the problem of limited space in a venue, but having a number of people in the venue well below that limit and people outside that you have to turn away. After my phone battery failed, I refined these ideas on the bus home – but more of that in another post.

As I sat there, a steady stream of people went by, and I was rarely without someone to talk to about the days events. I was briefly interviewed by Silicon Republic, and had my photo taken a few times. One person commiserated that I didn't have my laptop with me, so that I could be doing some web dev. I explained that all I have is a behemoth of a Dell, and that I don't carry it around much. I got handed quite a few business cards, and one person in particular seemed to believe that my surname was another kind of elaborate joke when I mimed the two words (the protest though, was deadly serious).

I got a pretty good impression of the Dublin Web Summit - many people seemed excited, and about all manner of different things. The Journalism / News talk had evoked a lot of strong emotion, the Payments talk was equally interesting. Most people seemed pretty amused that I was sitting outside the event, but was still able to talk to them about something that had just happened. One guy was just happy he’d gotten to see Moot. I’m pretty disappointed that I missed that – maybe if I bring a Guy Fawkes mask, he’ll visit me next year. :P

I’ve actually got nothing to do with Anon, but it might get his attention.

One of the RDS security guards decided that he wanted me to move on, but once I agreed to leave if the organisers had a problem with me being there, that worked out all right. It really helped that when he came along, I was deep into a technical discussion with someone with a badge, who leapt to my defence with:

“The organisers won’t care - This is exactly the right spirit for this kind of thing.”
He was right - most of the attendees I talked to got a bit of a kick from seeing me there. If you’re reading this, I didn’t catch your name, but thanks.

So the guard wandered off to find an organiser irate enough to justify removing me (from the public footpath, but I digress). Actually, he went to ask the very person that I’d tried to buy a ticket from, and had gotten along pretty well with! That exchange had gone something like:

Me: “I don’t have a ticket, I haven’t booked or anything, I’d just like to give you some cash and go inside”
Him: “I’d love to take your money, but we’re just not allowed”

He came out, I explained that it wasn’t a serious protest (which he had already understood by reading my sign), and he told the security guy to leave me alone. The guard then spent the next hour watching me from afar, and (probably) telling anyone who would listen about me - judging from the pointing and the looks in my direction. I gave him a thumbs-up whenever I noticed. He probably got #OccupyDWS way more PR than I could have managed otherwise. :)

Once the lunch crowd died down, my battery had drained so I couldn’t watch any more talks and I was starting to feel a little cold, so I headed home. I had a great time at the Dublin Web Summit, and might even book in advance for next year!

Here’s my parting tweet:

“Battery low means I can’t watch video streams, so #OccupyDWS is shutting down. Met loads of friendly, smart people. #dws was fun!”