Updating The Sun JDK On Debian

The final version of sun-jdk-6 in Debian Wheezy before it was removed was 6u26. The latest from Oracle (excluding Java7) is 6u30, so I decided to manually install it myself.

In fact it couldn’t be easier, all you do is download the jdk-6u30-linux-x64.bin file and run it, which extracts it to a directory called jdk1.6.0_30, which you then rename to java-6-sun-1.6.0_30 and move to /usr/lib/jvm, you then delete the java-6-sun symlink and recreate it to point to the newer directory:

root@localhost:/usr/lib/jvm$ ln -s java-6-sun-1.6.0_30 java-6-sun

As alternatives is setup to point to /usr/lib/jvm/java-6-sun there’s no need to update anything for the files we need to build Android for example:

root@localhost:/usr/lib/jvm$ update-alternatives --get-selections | grep java
...
appletviewer                   auto     /usr/lib/jvm/java-6-sun/bin/appletviewer
firefox-javaplugin.so          auto     /usr/lib/jvm/java-6-sun/jre/lib/amd64/libnpjp2.so
java                           manual   /usr/lib/jvm/java-6-sun/jre/bin/java
javac                          auto     /usr/lib/jvm/java-6-sun/bin/javac
javadoc                        auto     /usr/lib/jvm/java-6-sun/bin/javadoc
javah                          auto     /usr/lib/jvm/java-6-sun/bin/javah

jar seems to have been replaced by fastjar on Debian, so there’s no need to link the Oracle version in /usr/lib/jvm/java-6-sun/bin/jar

Finally its a good idea to add this environment variable in ~/.bashrc – again pointing to the symlink, not the specific version:

export JAVA_HOME="/usr/lib/jvm/java-6-sun"

Apparently Cyanogenmod7 will compile using OpenJDK6 (and 7 with a patch) even though AOSP won’t compile with anything other than Sun JDK6.

I’ve also updated the blog to WordPress 3.3

Blog Makeover

I’ve given the blog a bit of a makeover as I’m fed up of trying to fudge Google +1 and Facebook Like buttons onto the old CognoBlue theme and G+ was posting the tag cloud content instead of the post itself!

I’ve made a fork of the TwentyEleven theme with some modifications to header.php, footer.php and style.css to make the content wider and get rid of some wasted space. There’s some problems with WP-Syntax too – like the line number background colour is overridden by the main stylesheet, so I’ve put a custom wp-syntax.css in my theme too.

I even made a custom header.jpg with my GIMP skillz! It will be easier to maintain this way rather than trying to merge in all the changes every time I update WordPress. I’ve called my theme Twenty Twelve ;)

I’m using a regular plugin to do the G+1/FB stuff and I’ve removed a couple of plugins and widgets too.

Bluetooth

As part of my frustration with PulseAudio and my Skype headset, I thought I’d try using my little USB Bluetooth dongle and my headset. Well after a couple of hours I managed to get mplayer to play out of my headset but upon reboot I can’t get it to work, and PA didn’t detect it anyway, so no good for Skype – which annoyingly these days only uses PA and not direct ALSA devices.

I paired my BT headset with my Android phone which worked nicely, but the voice dialler is shit – no better than via the phone’s mic.

I also wasted an hour more trying to get PA to route Skype to my wired headsets and everything else via the monitor speakers – with the option to switch easily, but that didn’t work so I’m back to my odd little hack of firing up alsamixer and switching between 2 channel and 6 channel a couple of times and loading Skype then turning off the Surround channel using amixer.

I also updated the blog to WordPress 3.2.1

Attack Of The Clones

I’ve been trying out some cloning solutions as Clonezilla failed to restore a working system when I cloned my Fedora 14 install.

I tried Acronis True Image Home 2011 PlusPack, and that was a bit odd – I can get past grub, but that’s about it – I think its not liking the UUID’s or something with the encrypted partitions. Possibly this is because it wanted to auto-grow the /boot partition from 500Mb to 6Gb!

So now I’ve tried the most basic option – an Ubuntu 11.04 LiveCD and dd – and I successfully restored the disk image into VirtualBox to test it out.

The commands are as follows – note that reading in chunks of 4k is optimised for SSD’s and the 80Gb backup took about 40mins:

Backup:

dd if=/dev/sda of=/var/tmp/ntfs/backup.img bs=4096

Restore:

dd if=/var/tmp/ntfs/backup.img of=/dev/sda bs=4096

I used an unencrypted NTFS USB drive to store the images as it takes out the hassle of device-mapper (encryption) permissions (ext3), network setup (NFS/samba) and file-splitting (FAT32).

Update: upgraded the blog to WordPress 3.2

Blocking Access Using Apache

I’ve recently got pissed off with people taking advantage of my server.

First I noticed that there’s a load of people using download managers (up to 13 concurrent HTTP sessions!) to download my CM7 builds. So I’ve blocked them using:

RewriteEngine On
RewriteCond %{HTTP:Range} !^$
RewriteRule ^.+$ - [F,L]

Then I noticed some website was direct-linking to my downloads without even asking me, or giving credit, so after getting him to remove the link, I blocked him using a further redirect:

RewriteCond %{HTTP_REFERER} example\.com [NC]
RewriteRule ^.+$ - [F,L]

I’ve also upgraded the blog to WordPress version 3.1.4