I haven't been screwed so badly by laptop hardware for a long time. Generally, I try to choose hardware which is known to be supported by Linux – but not this time. And it cost me.

Sony VAIO VPC Z21x9r is an ultra-portable (1.2 kg) Sony laptop. It's got a flash drive, 13'' 1600x900 screen (excellent, by modern standards, something like my old ThinkPad t60 1600x1200 screen), no optical drive. And I got it since it seems to be the current laptop of choice at my employer, Mail.Ru.

And as I said, it cost me.

1. Ubuntu 10.04 (Long-time support, Lucid Lynx) wouldn't even boot. I didn't bother to find out why.

2. Ubuntu 11.10 wouldn't boot either. But this time it was only the video that didn't work, so I submitted to tweaking the boot parameters (type Esc right after boot loader starts, then F6 and set extra parameters).

'nomodeset' solved the problem by forcing vesa driver and 100% screen brightness right upon my tired eyes.

3. Well, it wouldn't install, would it. Thank you the RAID controller used to manage the two flash arrays, my hard drive
didn't look like '/dev/sda' but rather like a bunch of /dev/mapper/isw_haadhabid_Volume0 stuff. I wonder, what is haadhabid supposed to mean? Is it Turkish?

By default (unless you happen to notice and change it), the installer wants to store grub boot loader in /dev/sda, and when this fails, it says something like "This is fatal error". I figured no better way to solve it than to re-install from scratch having put the right partition for bootloader when on the partitioning screen. For some reason choosing it later on didn't work. Alright.

But then all of the above is peanuts compared to what followed.

4. The black screen. Well, yes, I've seen it already, but after install I would expect things to work. What's worse, after 'nomodeset' had been added back to kernel startup options, brightness still didn't work (which alone drove me mad), but suspend/resume didn't start working either.

The first couple of days of hacking and tweaking I basically spent learning the fun of Sony VAIO Z hardware. The thing is, these laptops never worked right on Linux. There is a whole community of Ubuntu users (or should I say losers) alone trying to make things work since as back as these series first appeared in 2008. Secondly, Sony has a habit of giving remarkably similar model names to computers with vastly different hardware. Thanks to these two factors, the first two days I spent mostly tuning the Radeon video card, which, as it turned out, is not present in my model.

Searching by model id also turned out to be a dead end – VPC Z21X9R is a code name in CIS, and in the reset of Europe it is called VPCZ21**, in New Zealand - VPC Z17 (why?), and so on. So, yes, apart from having Z models with and without Radeon, with and without a hard drive and optical drive, they also call their basically same stuff differently in different regions. Bravo, marketing people!

So, to sum up, none of the "Linux on <your laptop here> howtos" related to Sony VAIO Z helped me. Unless you consider help hours of blacklisting modules, tweaking with boot parameters, and ending up with the infamous black screen again.  Meh…

A weekend passed by, I'd become an experienced Sony hacker. Having been a Linux user since 1999 and all these years really, really, trying to not deal with the crap of hardware support (my dell 6410 still has no working mic), I learned that my chipset is called Intel HM 67, my video hardware is called Intel HD 3000, its Linux driver is called i915, and all this load of hardware doesn't function properly with any reasonably stable kernel. 

Another thing I learned was that the black screen auto-magically starts working as soon as it comes back from the power saving mode. That is, first it needs to come *into
the power saving mode.

Here's how you do it:
* turn on your laptop
* boot it
* type in your login and password, blindly
* wait 5-10 minutes for the power saver to turn on, avoiding the temptation to click enter or backspace, basically touch anything.

Voila, sufficient suspense built and  you get a working screen. 

What a wonderful workaround! After putting 'xset dpms force off && xset dpms force on' into my .xprofile, I at least was able to make stock Ubuntu Oneiric 11.10 work with my screen, with brightness control, and without tweaks with kernel config.

The problem is, suspend/resume still didn't work properly, and I also learned that 3.0.12 kernel consumes almost twice as much power than it should with this hardware, slashing the battery time.


5. Compiling a custom 3.1 kernel. Compiling an own kernel is never too exciting. I guess you kind of feel the attitude of kernel hackers to the rest of untermensch while doing that, and this is what makes you unhappy. And last time I had to do it was with Red Hat 5.0 (and that's before they started counting from scratch). Luckily, things didn't change that much, and a fellow loser tutorial saved my nerves. And yes, at first I tried the above-mentioned howto, but the kernel, compiled according to it, as well as a bunch of other 3.0 and 3.1 kernels, would oops on my hardware.

Finally, after another couple of days of compiling, oopsing, rebooting, I'm proudly running a kernel based on drm-intel-next branch from 2 days ago. Nothing older than that or closer to the Torvalds tree is good for my baby. A few hours alone were set aside to google for Realtek rt8169 network card firmware, which this kernel uses, and which I found nowhere except a LKML mailing list message – so I had to get a git version of linux-firmware.git branch, git apply the mail, and grab the necessary files from there.

I hope this kernel is at least somewhat stable – because if it isn't, I'm back to the drawing board.

Now I can finally "enjoy" my new Ubuntu – find out why the right mouse button doesn't work, how to get back my icewm window manager, etc, etc.

They say that open source is for those, who want to save money, but have enough time. Well, I guess I'm not. I would happily pay a license fee to a product that saves my time – but there is really no comparable stock hardware out there which I could use with Linux.
So, I guess, I choose what I choose consciously.