Dell XPS 13 and Debian Sid

I purchased a Dell XPS 13 Ultrabook, to replace my ageing Apple Macbook 2,1. After six years of daily use, it’s (over)due to retire.

The reasons for not going for another Apple product:

  • I don’t agree with their behaviour in the various markets where they’re competing. It’s competing, Apple, not sueing for the smallest tidbit. Want to survive, innovate.
  • I no longer use OSX. Linux all the way, baby.
  • Seriously overpriced hardware for the same specifications. The only thing going for them is the screen resolution on the Retina models.

Extra reasons to go for the XPS 13:

  • Nice extra discount through work.
  • Very nice screen resolution on a 13″. Not quite up to retina specs yet, but this is good enough ;)
  • Ultrabook. Light. Long battery.
  • SSD, and loads of RAM

Spec comparison:

Apple Macbook 2,1Dell XPS 13 (2013)
Weight:2.3kg1.03kg
Screen resolution:1200×8001920×1200
Memory:2GiB8GiB
Storage:80GiB HDD256GiB SSD
CPU:Core2Duo 2GHzCore i5-3337U
Battery life:3-4 hours7-8 hours

The laptop arrived in a sortof-stylish black Dell box, unfortunately taped over with all kinds of deliver stickers. Oh well.

The box it was shipped in

The box it was shipped in

Inside you can see the box for the power cord, and the box with the actual laptop. Nicely packaged, pluspoints here, Dell ;)

Nicely packaged

Nicely packaged

Fancy Dell box containing the actual laptop

Fancy Dell box containing the actual laptop

The actual laptop. Wrapped in plastic, protected with foam

The actual laptop. Wrapped in plastic, protected with foam

All unpacked and ready to rock!

All unpacked and ready to rock!

It’s also a bit smaller than my old Macbook, although they’re both rated as being 13″ laptops.

Dell XPS13 on top of my Macbook 2.1. Bit smaller. A lot lighter.

Dell XPS13 on top of my Macbook 2.1. Bit smaller. A lot lighter.

Unfortunately, the laptop I got shipped originally had some issues: plenty of backlight bleeding, and a wifi module that was broken – it would detect a wireless network for 1-2 minutes after powerup, and then nothing.
I called Dell, they sent round a technician… but after this repair, it was completely dead. So they shipped me a replacement, on which I’m typing this blog-post.

Back to the actual laptop – it’s a nice piece of hardware, but the Core i5 version comes shipped with Windows 8, unfortunately. Luckely for us, it’s easy to put something else on (or next) to it ;)
(note: the Core i7 version is the ‘developer’ version, which is shipped with Ubuntu! :D It’s called Project Sputnik)

Steps to shrink the Windows 8 partition (if you want to keep it around, otherwise you can just wipe the entire SDD. Don’t forget to first create some recovery images, though!):

  • Disable hibernate: open a command prompt (in admin mode) and type: powercfg /H off
  • Disable the windows pagefile (you can do this in Control Panel – System – Advanced Settings)
  • Disable system restore (ditto)

A reboot later, you should be able to shrink the partition to the minimum required (I left it around 50GiB). If you don’t disable all that crap, Windows will only allow you to shrink down to around 110GiB, which is frankly ridiculous.
You can enable everything again after shrinking the partition.

This will leave us with a nice amount of storage to put Linux on.

Now, download the Debian Testing latest weekly dvd 1 for amd64. You’ll also need a USB stick of 8GiB (4.5 is needed). Format that stick as FAT32, and copy the content of the DVD image on the stick (not the actual ISO).

After this is done, you can reboot the laptop. When you see the Dell logo flash on the screen, quickly hit F12 (repeatedly). This will present you with the boot menu, where you can choose what to boot. I recommend to pick ‘Legacy mode’, and from there ‘USB storage’. Normally this will boot the Debian installer from the memory stick.

To install Debian, I refer you to the Debian Installation Manual, an excellent document that details all the steps. Just be careful not to wipe out the existing Windows partition, should you want to keep it ;)

Some time later, you’ll get to reboot the system, and Debian should be the default choice to boot with the UEFI boot manager ;)

At this point it’s also highly recommended to add unstable and experimental sources to your /etc/apt/sources.list file – the testing distribution just installed it – ahem – slightly outdated in software terms, and we’ll definitely need a new kernel.

Add this to /etc/apt/sources.list (replacing XX with your two-letter country code):

deb http://ftp.XX.debian.org/debian/ sid main contrib non-free
deb http://ftp.XX.debian.org/debian/ experimental main contrib non-free
deb-src http://ftp.XX.debian.org/debian/ experimental main contrib non-free

Do an apt-get update && apt-get dist-upgrade and you’re good to go on the packages. For a newer kernel, do apt-cache search linux-image and check for the latest kernel release, right now that is linux-image-3.8-trunk-amd64, which you can install with apt-get install -t experimental linux-image-3.8-trunk-amd64.

Now, to fix some of the issues I’ve encountered:

Non-functional wifi
On another laptop (or in Windows), download the firmware-iwlwifi package. Install it – a reboot later you should be able to configure the wireless interface. You might also need wpasupplicant if you use encryption on your network. (I’m lazy, so I downloaded all the packages needed for wicd and configured stuff that way.)

Laptop wakes from suspend out of the blue
I’ve encountered a few times that the machine came out of suspend without any trigger from me – highly annoying (and dangerous, should this happen while the machine is in a backpack and start to heat up). I’ve found this Bug report on Launchpad about it. The fix seems to be to disable “Smart Connect” in the BIOS. I’ve tried it here, seems to work.

Touchpad isn’t recognized as a touchpad
The patches to support the touchpad are on route to be included in kernel 3.9, but (at the time of writing) that one hasn’t been released yet. So we need to take the latest kernel available in Debian Experimental (3.8.5) and patch this with the driver. Luckely Debian has The Linux Kernel Handbook which explains how to do all this the proper Debian way ;)

First, install the necessary build packages: apt-get install build-essential fakeroot devscripts && apt-get build-dep linux-3.8
Next, get the kernel sourcecode: apt-get source linux-image-3.8-trunk-amd64 -t experimental
Download the patches too: wget 'https://patchwork.kernel.org/patch/1859901/raw/' -O /usr/src/cypress-touchpad-v7.patch and wget 'https://patchwork.kernel.org/patch/1859901/raw/' -O /usr/src/cypress-touchpad-v7.patch
Now, go to the source directory cd /usr/src/linux-3.8.5 and execute the script to rebuild the kernel with the two patches:  bash debian/bin/test-patches ../cypress-touchpad-v7.patch ../increase-struct-ps2dev-cmdbuf-to-8-bytes.patch
Now go eat a pizza, make some coffee, solve a theorem or so. It’ll take a bit. When it finishes, you’ll have another shiny kernel in /usr/src, which you can install with dpkg -i linux-image-3.8-trunk-amd64_3.8.5-1~experimental.1a~test_amd64.deb And Bob’s your uncle.

Brightness level doesn’t stick after a suspend/resume
For this I made a custom suspend-resume hook for pm-utils. Add the following script as /etc/pm.d/sleep.d/00backlight

#!/bin/bash

SYSFS=/sys/class/backlight/intel_backlight
TMP=/var/tmp/backlight-restore

case $1 in
“suspend”|”hibernate”)
echo “Saving backlight brightness level…”
cat $SYSFS/actual_brightness > $TMP
;;
“resume”|”thaw”)
if [ -e $TMP ]; then
echo “Restoring backlight brightness level…”
cat $TMP > $SYSFS/brightness
rm $TMP
else
echo “No brightness level save file found.”
fi
;;
*)
echo “Dunno what you’re trying…”
exit 1
;;
esac

This script will read the backlight brightness level upon suspend, and store it in a file in /var/tmp. Upon resume, the value is read from the file and the brightness level set to it.

The permanent fix is also scheduled for kernel 3.9.

Unreadable (way too tiny) fonts in applications
This is actually a drawback from having a high-resolution screen: a lot fits on it, but the fonts are tiny.
I had the issue mostly in Opera, IceDove (a rebranded Thunderbird) and XTerm, my X Terminal of choice.

In Opera you can just set the default zoom level. I put this at 120%, everything is readable now.
For Thunderbird, I can advise installing the ViewAbout extension, and then looking in View -> ViewAbout -> about:config for the setting layout.css.devPixelsPerPx, and setting this to “1.2”.
For XTerm, I added this to .Xresources (in my home directory):

XTerm*faceName: Dejavu Sans Mono
XTerm*faceSize: 11

so that XTerm uses the Dejavu Sans Mono truetype font, size 11, instead of the default.

Adobe AIR 2.6 and Debian Sid 64-bit

I wanted to get Adobe AIR to work on my 64-bit Debian Sid installation, to try out some other twitter clients, more specifically Saezuri. (On a side note: the offering of twitter clients on linux is … mediocre. Bad, even. The (imho) best one is Pino, but it has problems of it’s own).

(Sidenote: Adobe has decided to discontinue AIR for Linux.)

It didn’t really go all that smooth, so here’s the process:

First, download the Adobe AIR 2.6 runtime from http://kb2.adobe.com/cps/853/cpsid_85304.html. Save it somewhere (like /tmp).
Next, open a terminal and make it executable: chmod +x /tmp/AdobeAIRInstaller.bin

Normally, now, you can try to install it: /tmp/AdobeAIRInstaller.bin. This should popup a dialog, telling you it’s going to install it. Unfortunatly at this point, I ran into a problem: it didn’t find either Gnome Keyring or KDE Kwallet, even though I have both installed on my system. After some digging, I recalled that AIR is a 32-bit framework, so I would need the 32-bit libraries for it to work.
While leaving the installer open, I went to look for the extracted directory, which was found under /tmp/air.w9qZiT, where, in one of the subdirectories I found a bunch of binaries which ended looking for libraries like libkwallet.so.1.
I found the needed libraries in the i386 packages kdelibs4c2a and libqt3-mt (which are for Debian Squeeze…), extracted them and put them in /usr/lib32:

lrwxrwxrwx 1 root root 16 Aug 8 2010 libDCOP.so.4 -> libDCOP.so.4.2.0
-rw-r--r-- 1 root root 213988 Aug 8 2010 libDCOP.so.4.2.0
lrwxrwxrwx 1 root root 19 Aug 8 2010 libkdecore.so.4 -> libkdecore.so.4.2.0
-rw-r--r-- 1 root root 2465476 Aug 8 2010 libkdecore.so.4.2.0
lrwxrwxrwx 1 root root 17 Aug 8 2010 libkdefx.so.4 -> libkdefx.so.4.2.0
-rw-r--r-- 1 root root 172488 Aug 8 2010 libkdefx.so.4.2.0
lrwxrwxrwx 1 root root 25 Aug 8 2010 libkwalletclient.so.1 -> libkwalletclient.so.1.0.1
-rw-r--r-- 1 root root 61452 Aug 8 2010 libkwalletclient.so.1.0.1
lrwxrwxrwx 1 root root 17 Sep 5 2010 libqt-mt.so.3 -> libqt-mt.so.3.3.8
lrwxrwxrwx 1 root root 17 Sep 5 2010 libqt-mt.so.3.3 -> libqt-mt.so.3.3.8
-rw-r--r-- 1 root root 7515480 Sep 5 2010 libqt-mt.so.3.3.8

(I’ve made a tarball with those libraries, which you can find here. You can install it by extracting it with cd /usr/lib32; tar xvfz ia32-libs.tar.gz.)

Retry the installer, still didn’t go further. After some more digging, I found an article detailing the use of AIR on non-KDE and non-Gnome systems on the Adobe Knowledge base. (I use a mix of Gnome, GTK and KDE apps, with XFCE as desktop environment)

What I had to do was run the following commands before launching the installer:
export KDE_FULL_SESSION=1
export KDE_SESSION_VERSION=4

(for Gnome, see the article)

After this, the installer went ahead and dumped AIR in /opt/Adobe AIR. (spaces in a directory? Really, Adobe????)

Next hurdle: after installing Saezuri, I noticed it had a hideous black border:

Saezuri with black border

… completely not acceptable. Luckely, this was easily fixed by enabling display compositing in the XFCE settings. Another problem fixed:

Saezuri with transparancy

The last problem I ran into is that AIR seems to default to firefox as the default browser. Since I’m not a firefox user (I do have it installed for those special occasions), that didn’t do. After some more digging I found a blog post detailing how to change this: apparently Adobe decided that hardcoding firefox as a browser was a good idea. I fixed this by hex-editing the libCore.so file under /opt/Adobe AIR/Versions/1.0, changing the hardcoded ‘firefox’ by ‘browser’, and adding a symlink under /usr/bin pointing browser to x-www-browser:
ln -s /usr/bin/x-www-browser /usr/bin/browser
(x-www-browser is part of the Debian alternatives system, which allows for easy selection of default browsers and what not.)

You can download the patched libCore.so here.

Now AIR seems to behave the way I want it to, so I’m a happy camper :)

Linux on my MacBook

I’m currently trying to get Linux (Debian Sid) working on my MacBook… it’s installed, but still needs lots of tweaking.

Most of the things work out of the box, except the things listed below:

Specific things that work (after tweaking):

  • Xorg with resolution at 1280×800
  • WiFi (atheros)
  • special buttons (volume/brightness/…)

Things that need to work still:

  • Touchpad (well, it works, but it needs to work better)
  • iSight

Sources I’m using at the moment:

I’ll write a detailed post on this later… when I’m not uberly lazy ;)

arm-linux crosscompiling on Debian Sid

Here’s a simple howto on how to install an ARM crosscompiling environment on your Debian Unstable:

  1. Install crosscompiler packages from http://debian.speedblue.org/
  2. Create a virtual deb package extraction directory:
    1. Create the directory /usr/arm-deb
    2. Create the directory /usr/arm-deb/usr
    3. Create the following symlinks in /usr/arm-deb/usr:
      1. ln -s /usr/arm/bin /usr/arm-deb/usr/bin
      2. ln -s /usr/arm/lib /usr/arm-deb/usr/lib
      3. ln -s /usr/arm/include /usr/arm-deb/usr/include
      4. ln -s /usr/arm/share /usr/arm-deb/usr/share

    This will allow easy package extraction.

Now, download the packages you need manually (from http://packages.debian.org/ and extract them in the directory using dpkg -x <package file> /usr/arm-deb

To compile something, you first have to add /usr/arm/bin to your path (export PATH=/usr/arm/bin:$PATH), set include paths to those include files (export CPPFLAGS="-I/usr/arm/include") and add
-host=arm-linux to your ./configure.

Happy compiling ;)

Gallery-Remote

I was trying to get GalleryRemote installed today on my Linux installation (because for obscure reasons, using the java applet in gallery directly crashes my browsers), which wouldn’t run. Attempting to run the installer gave obscure errors like:

awk: error while loading shared libraries: libm.so.6: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
...

A quick search led me to see that the problem was related to the variable LD_ASSUME_KERNEL being set, causing libc6 to fail loading its libraries.

So, the process to get it up and running is:

  1. download GalleryRemote (non-vm)
  2. run this in the directory where you downloaded it:
    $ cp GalleryRemote.1.5.Linux.NoVM.bin GalleryRemote.1.5.Linux.NoVM.bin.orig
    $ cat GalleryRemote.1.5.Linux.NoVM.bin.orig | sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" > GalleryRemote.1.5.Linux.NoVM.bin
  3. install GalleryRemote
  4. run this in the directory where you installed it:
    $ cp Gallery_Remote Gallery_Remote.orig
    $ cat Gallery_Remote.orig | sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" > Gallery_Remote

Now you should be all set to use GalleryRemote!

Fight image spam with FuzzyOCR & Spamassassin

I guess you all know about Spam Assassin. It’s a wonderful tool that allows you to filter out tons of spam easily.

Unfortunately, spammers are using images more and more to circumvent the baysan (and other) filter methods spam filters use. So, we need to incorporate some OCR’ing into spamassassin to make it hit those ugly things too!

Useful article: http://www.howtoforge.com/fight_image_spam_with_fuzzyocr_spamassassin

On Debian Sid, it’s as easy as
apt-get install fuzzyocr3 ocrad ;)