You are viewing prototyped

Windows 7

14th Jun 2009 | 11:13 am

This follow on to Windows Vista has been hyped to insane levels. It's meant to be the second coming, or something. They say it's what Vista should've been, it's what will kill Windows XP in the marketplace, etc. Enthusiasts are raving about its pre-release builds, saying it's leaner, meaner and faster than Windows Vista, and that the changes to its user interface are revolutionary.

And yet somehow I can't seem to get excited about it.

If I've learned one thing from writing software and observing software lifecycles, it is that special cases had damn well better really be special, otherwise not only does it become more code to maintain, more special cases to account for until Kingdom come, and more developer knowledge and complexity and more user education to impart, but more importantly, there always turn out to be special cases you failed to account for that perform more poorly.

Case in point: back in 2003 or so, when the Linux 2.6 kernel was first released, it had a "revolutionary" interactivity estimator in its vaunted "O(1) scheduler" that would be able to figure out which tasks were "interactive" (classed as those that would need short bursts of processor resources, albeit with high responsiveness, and then would go back to waiting on something or the other, whether the user, the network or something else), and which were "computational" (classed as those that had a lot of computation to do without interruption, i.e. could be pushed to the background). This then adjusted priorities accordingly to give interactive tasks the boost they wanted.

This all sounded great as a hypothesis, and for a few years people appreciated it. But on lower-spec hardware, those "interactive" tasks happened to need enough processor time to become classed as computational instead, and so some people (like me back then, using a K6-233 processor with FPM RAM) were affected negatively.

Then two years ago, the powers that be finally realized that a lot of the process starvation they were seeing was because of the interactivity estimator, despite years of "tuning" to find the corner cases that suffered because of this cleverness. They ended up ripping it out in favor of a much simplified "complete fair scheduler" owing to the fact that eliminating corner cases turned into a game of Whac-a-mole—the more they tried to fix, the more corner cases turned up. (I laughed, a lot, having noted its deficiencies when on low-spec hardware, once such corner case. Oh, by the way, thanks Ars for losing my name on the byline of that article, among others, despite my requests with each redesign to have it put back. Shows how much respect you have for your older contributors.)

It seems to me Microsoft went a similar way with Windows Vista. Instead of having general-purpose policies that just worked, they tried to special-case audio (for the handful of people doing professional audio processing) into user-space (losing hardware accelerated positional audio) and then adding something called the Multimedia Class Scheduler Service so that the move to userspace wouldn't impact the audio latency and that the userspace audio stack would get cycles frequently enough to prevent skipping audio.

Apparently the main reason for this was a hyper-reaction to Windows 2000 and XP, where vendors were releasing poorly written kernel-mode drivers that would crash the system, giving the OS vendor a bad name (rather than the IHV that wrote the drivers themselves), and apparently also to improve things for professional audio (though I don't know what or how).

Of course, something had to give, and the multimedia class scheduler service throttled interrupts to ensure enough of an opportunity for interrupts from the audio device to reach Windows. The biggest impact was seen on network throughput, since each incoming frame from a network interface would trigger an interrupt, and people using gigabit Ethernet without jumbo frames saw their throughput drop off a cliff with Vista. Microsoft tuned things in Service Pack 1, and the impact wasn't nearly as much, but Windows XP still outperforms Windows Vista on network transfers with audio playing—and without needing a fancy MMCSS to keep audio playing skip-free.

(People did find out how to make the Windows Audio service not depend on MMCSS and to disable MMCSS, but that resulted in very stuttery audio, since now audio needed to be processed in userspace rather than within the kernel itself.)

Another such situation: SuperFetch. Apparently Microsoft doesn't think that LRU-equivalent algorithms (such as the second-chance style algorithms typically used) that are used for demand paging aren't good enough, or something, so they wrote a service that would aggressively prefetch pages into memory so they would already be there when the user ran an app, for instance. This along with some other things made Vista a memory hog with an absurd footprint for a piece of software whose primary function in life is to run users' applications. (That's right, folks, Windows doesn't exist for its own sake, it exists to provide a platform for apps. That means it should provide apps services they need and get the hell out of the way, something developers and enthusiasts alike forget from time to time.)

Apparently Microsoft has tuned this a bit for Windows 7.

Windows 7 keeps these (in my opinion) misfeatures around.

What's new in Windows 7? Aside from a lot of "tuning", it brings us a new taskbar paradigm -- a two-level window switcher. First you pick the application, then the specific window through what I'm sure is meant to be a slick window view.

Here's the thing. This is counterproductive if you're actually trying to switch windows quickly. It may be elegant in that the window paradigm isn't conflated with applications any more. It may get around the kludges that faux-SDI applications like the Office apps have to implement to get their documents in the taskbar. But it makes me look and click multiple times to get at my window. That's counter-productive. With the older taskbar model I just needed to find my window by its title, and that was good enough. Guess what: that's faster. I'm not a fan of this new Windows 7 behavior.

What I am a fan of is the Aero Snap feature, at least on a higher-resolution widescreen display. I generally hate widescreen displays because most of my activity involves text. Text is generally most easily read when in relatively narrow columns, since it makes it easier to find the beginning of the next line once the end of a line is reached. This means that for a certain volume of text, taller is better. Widescreen displays with a given diagonal size might be good for widescreen movies, but they're much worse than standard-aspect (4:3) displays were for the same diagonal size.

Windows 7 introduced this feature, Aero Snap, that makes it easy to resize windows to take up half the width of the display, side by side. Drag the title bar of a window, taking the mouse cursor to the right or left edge of the screen, and release, and the window finds itself repositioned and resized as the left or right "pane" on the screen, with the full height and half the width of the display. This makes widescreen displays more bearable, making the column of text narrow enough to be able to read properly, and it also helps by e.g. having another document to edit or compare with by its side.

Fortunately, someone implemented this feature for older versions of Windows too, so it isn't Windows 7 specific. :) This is one of the two features I'd actually want from Windows 7.

Then there's Aero Peek, which kind of lets a user obscure all the windows by mousing to a specific area on the taskbar, and then pick a window by outline. Sounds fancy but a slower visual-search means of picking a window. Thanks, but no thanks. I'd rather have a feature like launchy, GNOME Do or Katapult that I can bring up with a keystroke and type in the application name or window title to switch to it. That beats looking for the window (via low-contrast outlines) I want to switch to.

One feature that I do like in Windows 7 is the progress status that applications can indicate in their taskbar buttons. For instance, some application that's showing a progress bar and cannot be interacted with until it's done can show progress in its taskbar button itself. That's really nice and I wish I had something like it in Windows XP. Still, it's not a feature worth switching for, on its own.

Then there are jump lists. These provide a set of common tasks as well as perhaps a list of recently used objects for an application when its button is right-clicked on the taskbar. Nice to have, but some applications (like Windows Media Player) already support similar functionality on older OSes, and I've never bothered using them on those apps. (Not to mention that I'd need to clutter up the taskbar with persistent app buttons to take advantage of the feature. Space is already at a premium with the usual number of applications I have running, and the taskbar is short enough that having enough of these would make it pretty annoying to use. I'm not a fan of the Mac OS X dock for very similar reasons. No thanks.) Another feature I'm not particularly enthused about.

Oh yes, the new taskbar, which is really more of a "dockbar", having been "inspired" by Mac OS X. No thank you, at all. Harder to tell when a (potentially memory and processor hogging) app is running. Harder to distinguish from an app with windows open. Mixing running and non-running apps on the same taskbar is ugly, and while it satisfies one UI golden rule (making sure widgets stay where they are for procedural memory to be effective), I'd really rather have a simple window list with specific areas for a handful of app launchers and status icons rather than what's effectively now a fancy app menu. Punt.

Device Scape, the thing that allows vendors to incorporate actions and configuration settings for their devices, when they're attached to the system, to present them in a unified way in Windows Explorer. It's a really good idea, but I don't have much gadgetry in the first place. The only things I can think of that would benefit from this are my multifunction printer/scanner and my phone. Both have their own custom apps, though, so I don't think I'm missing much. Again, nice to have, not worth switching for.

The one thing I was actually enthused about with Windows Vista was UAC, ironically, the one thing people have found most annoying about it. My background is with UNIX systems, where users generally stay unprivileged and elevate privileges to do privileged tasks. I've tried on and off to use Windows the same way, as an unprivileged user generally then elevate to an administrative user to perform administrative tasks, but prior to Windows Vista, a lot of administrative functionality was tied into the Windows Explorer shell, which did not provide the means to elevate itself when showing privileged settings. There are some kludges around it that involve running a separate privileged instance of Explorer to do administrative tasks that I only found out about after I'd started using Vista.

Vista of course took it a bit too far, so for instance if I wanted to take ownership of a folder then change its ACLs, I'd be prompted several times during this set of actions (and since I was running as an unprivileged user rather than a member of the local Administrators group, I'd need to provide a password each time). UAC was far from what I'd envisioned as a sort of automatic gksudo/kdesu. I'd hoped for an elevation mechanism that would be invoked whenever the system found insufficient privileges, and that would persist the authentication for some time (which is something that sudo in the UNIX world does). What I got was a relatively dumb system where the application would actually need to be UAC aware and explicitly ask for a UAC prompt to be shown to the user when privileges were needed, and of course UAC doesn't cache anything. So you still have "legacy" apps that aren't UAC aware and can't trigger UAC when they need privileges and therefore fail when run unprivileged, and those that do still can't cache the privilege tokens for later.

Windows 7 tried to alleviate the burden, not by doing the right thing and caching credentials for a related sequence of tasks, and also automatically triggering UAC when inadequate privileges were detected, but rather by adding another level of UAC prompting that allowed Microsoft-signed code to elevate automatically (i.e. not prompt the user when it was Microsoft-signed code requesting higher privileges via UAC). People of course very quickly found ways around UAC exploiting this fact, simply by using parts of Windows used to launch any code (such as rundll32, used to run arbitrary code in DLLs, signed or unsigned; rundll32 is, of course, Microsoft-signed) to run their code that needed to be privileged, thus suppressing a UAC prompt.

Since I last used Vista, I've become a bit complacent and no longer care as much about running unprivileged. If I ever do again, there are ways to do this in XP that I could use instead.

Then Windows Vista and 7 both use indexing extensively. Both of course have the little search box in the Start Menu. (By default of course only the Start Menu contents, files within user profiles and things like Web history and contents of visited pages are indexed, which makes it useless if for instance you're looking for a specific file in %PROGRAMFILES% or %SYSTEMROOT%. I've rarely had Windows Search find what I was looking for.) Windows Vista introduced I/O priorities which clueless "enthusiasts" screamed would prevent performance loss as Windows Search indexed (here's a hint: no matter what you do at the software level, you can't mask disk access times when what would've been sequential I/O now introduces seeking; this is now mechanical latency. Good luck with that, fools), but of course those of us using portables with 4,200 rpm drives noticed the (vast) difference between indexing turned on and turned off.

Microsoft apparently noticed this too, and they've mellowed the Windows Search service to be a lot less aggressive in its indexing when there's user activity.

Still, given its stunning lack of success in finding the things I want it to find (maybe I tend to organize my files better than most people? Or maybe I have a better memory than most that helps me locate files relatively quickly? I don't know, but the files I do want to find might be obscured more than most people's, so maybe that's why it fails more often for me), I really find it hard to be in favor of this new feature. I understand it's fantastic for a lot of folks; it isn't for me.

Windows 7 builds on Windows Search technology to provide "Libraries". These are effectively search folders that find types of content all over the (indexed locations of the) disk and present them as folders that will have all the files of those types in all the indexed locations. This is a feature I'd want, actually. But I don't want to pay the cost of indexing for it.

So maybe I'm off-base on this, but I really don't find much in Windows 7 that would make me switch to it despite the huge hype. There are some really nice features there, but also a number of costs to it that I don't want to pay.

Microsoft, if you ever decide to create a Windows 8 KISS ("Keep It Simple, Stupid") Edition, I'd love to give it a spin. Until then (or whenever I can no longer run apps I really want to run on Windows XP, whichever is earlier), XP it is.

Link | Leave a comment | Share

I should post more often.

14th Jun 2009 | 09:58 am
location: London, UK
mood: relievedrelieved

In that last post, I indicated that my HSMP application had been successful.

Since then, I came across Internet rumors that the UKBA might expect me to be employed already (and have worked for the three months prior to application) to be able to get a visa stamp (i.e. entry clearance). It took me a few months of asking around to ascertain that that wasn't necessary. (People on the Internet were wrong? How can that be? :) )

Anyway. I found out that what I actually needed to do was to apply for a Tier 1 (General) Migrant visa (the replacement for HSMP), under the Transitional Arrangements for HSMP applicants. This way I wouldn't need to re-qualify (which at that point I couldn't, having had no income since the end of 2007), but I needed to prove the existence of maintenance funds.

For this I had to ask around since some of the guidelines suggested that a letter from a bank indicating funds in, say, a fixed deposit account would be sufficient, while others suggested they would look for an actively used account with £2,800 in it (which was a problem since my only accounts with that much money in them were fixed deposits, which obviously weren't going to have frequent deposits and withdrawals).

More communication with the UKBA sorted that out -- I got a letter from HSBC indicating the amount of my fixed deposits. (HSBC in India seems to be well-entrenched in "policy", sadly -- they refused to indicate that the funds would be available immediately upon request until I showed them a snippet off their own web site showing that "on discretion" funds would be made available immediately upon request. They ended up including that text verbatim. Sigh.)

Anyway, with some trepidation I applied for a Tier 1 (General) Migrant visa under transitional arrangements at the VFS Global office at Infantry Road in Bangalore, on January 7. I'd received guidelines from VFS about six months earlier that suggested I should include two copies of all the originals that I submit (and I'd spent several hours the previous two days running around and having copies made in the neighborhood, using the gloriously broken copiers everyone seemed to run, India being India). It turns out they didn't actually want them, and they returned the file folder in which I'd placed all the documents, along with all the photocopies.

On February 6, I received my passport via a courier, who asked for the copy of my passport that VFS stamped on the day I applied for the visa. Sure enough, it had a Tier 1 (General) Entry Clearance visa label. :D

I decided to wrap things up. I gave notice to my landlord (who decided he wanted me out by the end of the month). I advertised the stuff I owned in the local advertisers as well as Craigslist and Sulekha.

My furniture and fridge were the first to be claimed by a shop that deals in used household goods. In due course I got rid of my mattress, old film SLR camera, PC/LCD/network equipment/UPS/peripherals, books, the parts of my failed laptop, boombox, toaster oven, gas stove, etc.

I did have quite a bit of stuff left over in working order. I gave some of it away and the stuff I wanted to keep, I packaged up in boxes, hired a little three-wheeler flatbed pick-up "tempo" and took it to the railway station, and sent it as parcel cargo to New Delhi, where it was picked up by relatives and placed into storage. Many thanks to my second cousin Dheeraj Aswani and his wife Tripti for sharing the burden of the packing from me—I was really overwhelmed by the magnitude of what I had left to pack at this point, but with their help (and by this I mean they ended up packing much more than I did) we were able to get it done by the day I was meant to move out. Dheeraj also accompanied me to the railway station and helped me get the boxes enclosed in gunny bags, weighed and registered for delivery.

I was due to fly to the UAE to stay with my parents for a month before coming to the UK. However, my visit visa to the UAE was valid only for a month, and we needed to factor in a margin if for some reason I couldn't leave the UAE exactly a month from entry, so I needed to find a place to stay. Dheeraj and Tripti offered to have me stay with them for the next two or so days that I expected to stay in Bangalore, but as it happens they stayed far away from the airport, and a friend and old neighbor of my mother happened to live much closer to it, and had an unused bedroom I could use. So I decided to go there.

The next day I fell ill, spiking a fever and suffering from an upset stomach. Despite this I needed to get some change-of-address notifications to the post office, my banks, employers, etc. typed, printed and mailed out before I could travel and some study material shipped out to my sister, so I went out to get this done, bringing back some medication and lots of bottled water with me. I felt better by the next morning -- my last in Bangalore -- so I went to mail out everything, and then completed packing to fly to Dubai.

The next month was uneventful, mostly consisting of looking for UK accommodation and searching for a suit since my old one dated back twelve years and I'd actually grown a little since I'd bought it.

So on April 1 I arrived in the UK. For a month I stayed in a £450 (+ £50 for my father) room in Croydon, first polishing up my résumé then applying for jobs. Eventually I landed a short-term contract on April 28, primarily because the person who was meant to start that contract had found a permanent position and had opted for that at the last minute, and they needed a web developer who knew character sets and had some familiarity with Arabic. That was a success. Unfortunately for me, it was advertised as a three-month contract while the client (Advanced Interactive Solutions) had only intended to have me on for six weeks. The commute was a bit of a pain anyway (leave home at 7:10 am, arrive at work at 9:05 am; leave work at 5:15 pm, arrive home around 7:10 pm).

In May I moved to London proper, in an area called Tulse Hill. The area's a bit safer and quieter than Croydon, the house is much bigger, and I'm staying with a family this time (rather than just other people who have rented rooms in the house), which is nicer. And I'm walking distance away from two railway stations, something that makes life easier for me.

So my last day at AIS was Wednesday, having completed my assignment, and now I'm looking for work again. I've had a few interviews, some successful, some not, and I'm waiting to find out some time in the coming week if I have a permanent job with one of the prospective employers.

Let's see how it goes. Gordon Brown's administration has been tightening immigration a bit, so the visa I'm on [Tier 1 (General)] now requires a Master's degree for a successful initial application. Fortunately for me, extensions for people who received Tier 1 (General) migrant visas prior to the change of rules (on April 1, 2009) are grandfathered under the old rules, so I will not need a Master's degree come 2012 when I'm due to apply for an extension of the visa. (Under the current rules, if I've been in employment in the UK for five years, I can apply for Indefinite Leave to Remain, or permanent residence, although there are strong rumors that the administration is looking to extend this out to seven years.)

I have hope now that I won't be stuck in India until the day I die. That gives me some solace.

I am so glad to be out. :)

Link | Leave a comment | Share


23rd Jul 2008 | 01:20 am

HSMP approval letter

I’m in.

I’m in!

I’m in!



Link | Leave a comment {6} | Share

Another entry in the Engrish annals

3rd Jun 2008 | 04:40 pm
mood: amusedamused

Seen on various TV spots, posters, fliers and promotional material accompanying my telephone bill from Bharti Airtel, my ISP:

Get a Life. Get broadband.

. . . because online gaming is a means to "get a life", right?

I’m sure they don’t actually mean to taunt their would-be customers. They probably just don’t know its connotations.

Link | Leave a comment | Share

Experimentation and Aggravation

19th Apr 2008 | 09:05 pm


There’s a hosted hypervisor called VirtualBox available for various platforms that’s rather interesting, and has managed to capture the attention of many folks looking for a freeware virtualization product. For one thing, it’s freeware and open source (GPL). And many people have reported that it runs Windows guests rather well.

I tried it about six months ago when I had some trouble with VMware Server 1.0.3 and wanted to try alternatives. (FYI, as the discussion thread shows, if you’re having problems with VMware instantly hard locking the system, and are running a 64-bit kernel, check if you’ve got the kvm modules loaded. They put the kernel in VMX Root mode, which VMware also tries to do and subsequently renders the system hard-locked. Apparently this isn’t a problem on a 32-bit kernel.)

So I tried the Debian-packaged version of VirtualBox. I ended up getting this error

Unknown error initializing kernel driver (VERR_VM_DRIVER_VERSION_MISMATCH).
VBox status code: -1912 (VERR_VM_DRIVER_VERSION_MISMATCH).

It turns out that VirtualBox’s kernel component and userspace component must have the same bitness. The kernel part doesn’t support both 32-bit and 64-bit userspace. (Just about everything else does, and in fact kernel-space stuff ought to support both 32-bit and 64-bit processes, since it’s part of the platform, and the platform offered by a 64-bit kernel is meant to support both 32-bit and 64-bit processes. Oh well. Another culprit that suffers from this limitation is the OpenAMT project, which also requires the kernel component, the HECI driver for the chipset-integrated Management Engine, and the userspace component, the OpenAMT stack, to have the same bitness. An unnecessary limitation.)

So I created a 64-bit chroot environment (and apparently someone copied my comment in the support ticket into the VirtualBox wiki that illustrates how to do this on Debian sid) and installed VirtualBox into that.

Now VirtualBox would no longer complain about the kernel driver mismatch. However, it would now immediately go into “Aborted” mode. Investigating, it turned out that it was crashing.

I like to use Bridged networking on my guests—so that they appear as part of my LAN and accessible as peers by my laptop—and I had configured the VM to use this. Unlike VMware, VirtualBox brings up a standard Linux TUN device and expects you to provide scripts to add the TUN device to a host-based bridge with a physical network interface when the VM comes up, and to remove it from the bridge when the VM is brought down again.

It turns out that kernel version 2.6.18 onward, you effectively need root access to write to a TUN device. VirtualBox was trying to write to it, failing, logging an error, triggering a failed assertion and crashing. Moving the VM and all configuration files to the root user and setting the root user up to work with VirtualBox (by adding it to the vboxusers group) fixed this. (Of course, one wonders what the point of the vboxusers group is if I need to run VirtualBox as root anyway in order to use bridging . . .)

The whole painful process is outlined in the how-to document prepared from my comments in the ticket.

My impressions are that when VirtualBox works, it works well; however, when it doesn’t work, it’s miserable to work out its issues. It seems to have dodgy error handling (e.g. cryptic or inaccurate logging and crashing rather than notifying the user of the problem, although in at least one instance—checking if the system is already in VMX Root mode—it beats VMware, which prefers to hardlock instead) and has extremely poor error messages, without any reference on the web site explaining what the error messages are and how to resolve them.

[Edit: Going through VirtualBox's changelog, it appears that since I last tried VirtualBox, a lot of error handling has been improved, with better error messages, more notification with less spurious crashing, and more tolerant code. Good, it's making progress.]

I’m also appalled at the lack of polish regarding bridged-mode networking. I didn’t think that was an uncommon enough use case that it would require the user to set up a persistent bridge on the host himself and write scripts to enable VirtualBox to add its TUN device to the bridge and remove its TUN device from it. The whole needing to run as root is also appalling.

It’s also unfortunate that VirtualBox doesn’t support 64-bit VMs at all.

There are two advantages to VirtualBox—it’s open source, so that when you inevitably run into an obscure error message or a crash, it’s possible to debug it yourself; and it’s available on platforms that don’t have other freeware hosted virtualization software (such as Mac OS X and OpenSolaris—the former has Parallels and VMware Fusion, neither of which are freeware). However, based on the level of polish alone, I prefer to use VMware Server.

VMware Server 2.0 beta 2

Speaking of VMware Server, I gave the Server 2.0 beta 2 a spin. It’s tolerable—now it has some semblance of user management and I don’t need to log in as root or hack a file to let a non-root user log in, and its web-based UI is slimmer now, using just ~80 MiB of RAM as opposed to the hundreds of megabytes the first beta used, but it’s still annoying. For one thing, the rich-client VMware Console is long gone. The only way to interact with the VMs on Linux is via the command line or through the Web UI. It uses a hacked-up version of VMware Player to provide VM consoles, but you can only have one console open at a time.

It is also fragile—I had vmware-hostd die quite frequently with certain legacy VMs, and some of the changes you can make to VMs through the Web UI aren’t easily undoable. And Lord help you if it decides one of your VMs is invalid. It’s a right pain to get it to believe the VM is valid again, and this usually involves removing it from the inventory, removing whatever setting is in the .vmx that confused it, and re-adding it in. >_<

Other versions of VMware don’t touch things like virtualDev settings in your VMs when first adding them into the inventory—so for instance if you have a 64-bit VM, you might want to use Ethernet.virtualDev = "e1000" since VMware doesn’t support the AMD PCNET emulated device in a 64-bit VM, you’ll have to jump through hoops (i.e. edit the .vmx manually) to re-enable your change. Similar with sound.virtualDev (for some reason VMware Server 2 seems to prefer "sb16" over "es1371" despite the latter working better in 64-bit VMs).

As far as the Web UI is concerned, it doesn’t work at all in Opera. It works in Gecko-based browsers and Internet Explorer. I installed the Mozilla Firefox 3 beta 5 which allowed me to use it. As mentioned earlier, you can only have one VM’s console open at a time (although, aggravatingly, it’ll let you open up multiple copies of the console for the same VM). The alternative is the bundled VMware Virtual Infrastructure Client 2.5, which (of course) runs only on Windows.

This VI Client is a .NET application, so it won’t even run under Wine.

I thought I might be able to give it a go under Mono. However, it’s packaged as a non-.NET InstallShield installer that uses Windows Installer as its backend, so I thought perhaps I could install it using Wine and then use Mono to run it.

No such luck. Wine’s Windows Installer implementation appears to be incomplete and cannot handle the .msi’s format. Oh well.

In any case, posts on the VMware Communities indicate that Mono’s .NET Framework implementation isn’t complete enough to run the VI Client under Mono anyway. How unfortunate.

There is a rumor that a Virtual Center client is being written for Linux. However, that probably won’t help me since as I understand it, Virtual Center is quite expensive.

Come on, VMware, give us a decent Server 2 product.

Oh well. For now I’m going to stick with Server 1.0.x and pray that VMware decides to produce a freeware VI client for Linux sometime in the near future.

VMware with ALSA

VMware seems to really love the OSS interface for Linux audio. The recently-released version 2.6.25 kernel killed off even more OSS drivers, and OSS is deprecated, and yet even as of their Server 2.0 beta 2, VMware continues to use OSS. So do VMware Player 2.0.x and Workstation 6.0.x.

This presents a problem for the vast majority of users, who do not have sound cards that support hardware multiplexing of PCM audio streams, which is to say, mix sounds from multiple tasks together. And Linus et al believe that mixing of audio in software doesn’t belong behind the kernel interfaces, even if that would make it transparent.

ALSA has the dmix plugin that tries to do this relatively transparently in software. It works well enough—but only if all your applications use ALSA to output audio. If any application uses the compatibility OSS interface (accessing /dev/dsp directly), it either won’t be able to access it if any ALSA application has the corresponding ALSA sound device (usually /dev/snd/pcmC0D0p or similar) open, or if it manages to access it, no ALSA application will be able to output sound.

Fortunately, ALSA also provides a conversion library (alsa-oss) that can be preloaded into a process to take over system calls such as open(), write(), ioctl(), close() and so on, in order to trap attempts to open and write to /dev/dsp or similar and convert them into ALSA library calls to use the ALSA device instead. Ordinarily, you prefix the aoss command to a process, and it’ll use the LD_PRELOAD environment variable to instruct the dynamic loader,, to override functions using /usr/lib/

It’s a bit tricky with VMware, though, since the app you use to control the VMs isn’t what the VMs run inside. Rather, it’s /usr/lib/vmware/bin/vmware-vmx that the VM actually runs inside. Even more tricky, it’s setuid root, which means that LD_PRELOAD overrides will not take effect unless the preloaded library is itself setuid root.

Fortunately, this is simple to fix with a shell script. Rename /usr/lib/vmware/bin/vmware-vmx to vmware-vmx.real and replace it with a shell script that uses LD_PRELOAD. Also make /usr/lib/ setuid root.

sudo mv /usr/lib/vmware/bin/vmware-vmx{,.real}
sudo chmod u+s /usr/lib/
sudo tee /usr/lib/vmware/bin/vmware-vmx <<_EOF_
#!/bin/sh "$0.real" "$@"

This works rather well, and my VMs are able to output audio using dmix. For some reason, though, input (via dsnoop) doesn’t work unless I start the VM, disconnect its audio, stop all applications using the sound device (e.g. using sudo fuser -k /dev/snd/pcmC0D0p, though this is a bit extreme), remove the sound driver (using sudo modprobe -r snd-hda-intel), load it again (using sudo modprobe snd-hda-intel and then reconnect the VM’s sound. And I need to do this every time I start a VM that I want to be able to capture sound in.

(Recently I had to build the ALSA 1.0.16 modules because capture stopped working at all on the Linux host as well as VMs with the 2.6.24 stock driver. I haven’t tried capturing audio in a VM since then, so I don’t know if the bug persists in ALSA 1.0.16.)

Mozilla Firefox 3.0 Beta 5

Speaking of Firefox 3, it’s much improved over Firefox 2 in all ways—it even provides a Show Image context menu item. I usually browse with image loading turned off for the sake of speed, so this is a welcome development. Firefox 3 is blistering fast compared to Firefox 2, uses far less memory and manages memory much better.

Unfortunately, the Show Image feature doesn’t work so well. However, there is the imgLikeOpera extension. It hasn’t been updated for Firefox 3, with the result that Firefox sees it as an incompatible extension, but this is easy to fix. The .xpi is just a ZIP archive. I unzipped it, edited the manifest, updated the maximum supported version and removed the update URL (which must apparently now provide for some level of security in order for Firefox 3 to accept it), then zipped it up again. The resulting .xpi installed perfectly in Firefox 3 and provides for excellent functionality. The only thing I wish it did was to provide for toolbar buttons to toggle the image loading mode; right now I need to hit Tools → Add-ons to get at the image loading mode.

Still, it isn’t seamless. I still prefer Opera’s functionality and am using last week’s Opera 9.50 weekly build. This week’s unfortunately for the first time introduced some image loading bugs, which makes it unusable for my purposes. Opera 9.50 is pretty fast, but it has a large memory footprint. Not nearly as big as Firefox 2’s, but big enough to be concerning. Still, it’s blazing fast and reasonable stable, so it’s my browser of choice.

GMail and Opera 9.50 weekly builds

FYI, if you’re using an Opera 9.50 weekly build and use GMail, you might notice that unlike Firefox and Internet Explorer users, Opera users only manage to get the version 1 UI rather than the version 2 UI (which offers things like colored labels and does not wait for server round-trips every time you do something, so is much more pleasant to use). It seems it works fine with Opera 9.50 as long as you tell GMail not to check the browser by using a URL like this:

It works rather well.

Evading crashes due to crappy drivers

I’ve been having hardlocks once every two or so times I try to burn a DVD, and I’ve been experiencing this for months, since at least the 2.6.22 kernel in Debian sid, along with the frequent inability to eject the tray, either using the button on the drive, or the eject command. I thought it was because my DVD±RW drive was dying, but then I installed Windows in a dual-boot configuration and found that it worked perfectly in Windows.

I figured the problem was the driver for the Marvell PATA controller on my Intel DG33FB motherboard (whose chipset, Intel’s G33, does not integrate a PATA controller itself, thanks to Intel’s desire for forced obsolescence—never mind the fact that just about all motherboards that use an ICH8 or ICH9 series southbridge use a discrete PATA controller as well, even Intel’s own motherboards). So I’ve changed it so that the ata_generic driver is used instead of pata_marvell.

I added the following to /etc/modprobe.d/marvell:

install pata_marvell modprobe ata_generic
blacklist pata_marvell
options ata_generic all_generic_ide=1

The first line is probably unnecessary as it’s overridden by the second, but I added it in just in case.

I tried burning a DVD-R—no hardlock this time. I can’t say for sure that I’ve fixed it, but so far, so good.

Ram Navami, or why I consider India to be uncivilized

On April 14, Hellholia had a major Hindu festival, Ram Navami (राम नवमी), the birth of the Hindu God Rama, an incarnation of Lord Vishnu. Of course, in usual Hindu tradition it was celebrated with “pomp”, which means that they made a constant racket from dawn until 1:30 AM the next day at the temple across the street from my apartment building. Mostly they were devotional songs played on very crappy loudspeakers as loud as they could be. This meant I couldn’t hear myself think. Top this off with firecrackers set off annoyingly at random. (And these aren’t the kind of fireworks that produce a spectacular show; their entire purpose is to be noisy.)

As if this wasn’t bad enough, drums woke me from a disturbed slumber around 4:20 AM. Soon (around 4:45 AM) the power went out as the drums got louder.

A few hours without power later, I decided to shower and go outside to pay my DSL and telephone bill. I noticed that the pharmacy that usually electronically processes my bill was closed, but that there was a big parade traversing my narrow street really slowly. Apparently they’d cut the power because the floats were tall enough to interfere with the power lines in the narrow street, and members of the parade were raising these power lines with wooden sticks to allow the floats to pass.

I went up to the roof, whipped out my basic camera phone and started taking pictures.

Peasant dance

6:39 AM

That’s eastward from my apartment building, on the street below. Note the parade float, peasant dance and (annoying) drummers and the power transformer and distribution lines next to it. Note also the narrowness of the street.

Why the hell did they have to come through such a narrow street?

The parade was moving very slowly (about 10 yards every 10 minutes), had many floats and was very noisy. And every time a float moved, someone had to move the cables out of the way so they could move. (Not just these power cables, but telephone cables, that in this city at least, tend to be strung across streets from pole to window or roof. There seems to be no OSHA-like regulatory agency or any kind of fire codes to prevent companies from doing this. The DSL line I’m using to post this is similarly strung across from a neighboring building’s rooftop to mine.)

On the move

Note the many drummers.

Even more, ARGH

This is the street towards the west.

Many more floats were incoming. Note how they have power (thanks to the generators they’re towing or have mounted in the rear), unlike me, directly because of them.

They’re working up a major din. In any civilized country, people would call the cops if someone made this much noise in a residential area, especially in the early morning hours. In India, policemen were in on it, directing traffic away so the parade could pass unhindered.

The floats had pundits (priests) offering artis to the idols. Many residents were going up with their own offerings in exchange for blessings.

6:40 AM


Even more. Moving annoyingly slowly.

6:41 AM

Move on already.

Please kill these noisy fuckwads.

Goddamned drummers working up a din.

They can have power, but I can&quot;t?

6:42 AM

A plasma rifle would do wonders. So would a rocket launcher. Man, I wish I was armed and dangerous in an FPS.

Floats with idols, priests and bright lights.

7:09 AM


The noisiest drummers.

7:14 AM

Even more?!? ARGH

Even more floats incoming. This parade started to feel interminable around this point. I was glad I was on the roof and not on a lower floor, where the circa 25°C temperature combined with restricted ventilation (thanks to the lack of mains power to run ceiling fans and air conditioners) were likely not only making the residents miserable, but the louder noise would’ve made it even more annoying. My landlord was on the ground floor watching the parade as it passed. His ears have probably been affected by the pervasive noise pollution, so perhaps the noise didn’t bother him as much as it did me.

7:17 AM


Most interminable. I think it was around this point that I started yelling over and over, "Leave now and never come back!" Unfortunately, I don't think anyone heard me over the drums. ;_;

7:26 AM

Even the police are in on it.

A pair of cops (dressed in their dirty brown, or khaki, uniforms) pass through the parade, hats quite literally in hand.

7:39 AM

They&quot;re leaving, thank goodness.

I’ve now been on the roof for over an hour, and it’s been three hours since the parade robbed me of mains power. (I can tell the power’s still out because the landlord rents an upper terrace to a local telecommunications operator who has built three transmission towers and has placed a generator to power them in case of power failure. The generator ran throughout.)

7:48 AM

The last of them.

The last one is leaving (well, actually, stopped at the intersection for five minutes), finally.

The parade left the street around 7:55 AM, though when I left the apartment again, they were still occupying the perpendicular street around 8:15 AM. I called the power company around 8:25 AM inquiring as to when I could expect the power to be restored now that the parade was gone. Their answer—“an hour”. I resigned myself to waiting another hour for mains power. Fortunately for me, the power was restored around 8:35 AM, or approximately four hours after the blackout commenced.

What a backward country, where residential power is cut for a religious parade, and disturbing noise is permitted in residential areas. I only got less than three hours’ worth of sleep between 1:30 AM, when the noise stopped, and 4:20 AM, when it started again.

Hopefully my application for immigration to the UK through the Points-based system is accepted and I can get out of here.

Misadventures with EFI

On the suggestion of a certain obnoxious Brit, I decided I would make use of the UEFI support of my motherboard to install Windows Vista x64 SP1 on a GPT drive. Long story short, Intel’s Desktop Boards have a rather buggy UEFI implementation.

  • Some firmware versions don’t even support EFI boot off an optical drive. This includes the most recent version, which then cannot be downgraded again unless I do a recovery flash—otherwise the upgraded Management Engine firmware refuses to be downgraded again.

  • Once it boots up, the Vista installer can see my SATA drives, but says that the firmware doesn’t support booting off them, so refuses to install to any of them. Sure enough, when I turned off Native mode for SATA (AHCI or IDE) in favor of Legacy mode, Vista’s installer was able to install to the drive. Apparently Intel’s AHCI and IDE mode SATA firmware for the onboard SATA controller doesn’t support UEFI.

  • Now that it’s installed, I cannot boot off any other media, even if I unplug all devices except for a DVD-ROM drive, or all drives except a USB flash disk, or all drives except a floppy drive, etc. Even worse, I couldn’t do it even if I disabled UEFI Boot in the BIOS configuration—something very bizarre, since it was trying to boot only EFI stuff in non-EFI mode.

  • If I downgrade the BIOS to one with faulty UEFI support (one that can’t boot off an EFI DVD-ROM), I get a continuous

    Boot succeeded - Windows Boot Manager

    Vista’s put something in my NVRAM!

  • Sure enough, Googling for Vista EFI NVRAM "Windows Boot Manager" brought up a Microsoft TechNet article, Remove Duplicate Firmware Objects in BCD and NVRAM. Suspecting that I might be able to boot “legacy” stuff if I emptied it, I upgraded the firmware back to one where UEFI boot worked again, plugged all the drives in again and booted up Vista. There I ran

    bcdedit /export b0rked.bcd
    bcdedit /clean

    and rebooted. Sure enough, I was able to boot Linux after that.

  • The firmware apparently disobeys the boot order and has zero support for booting “legacy” devices if there are any boot entries in the NVRAM, which makes it rather useless to boot, for instance, rescue DVDs.

  • Even more pressingly, I couldn’t boot off the Vista installation DVD despite it having an EFI-aware bootloader. Apparently El Torito boot images are legacy as well. I would’ve been in an instant world of hurt if the Vista installation managed to become unbootable itself, since a CMOS reset by removing the battery and shorting the electrodes reset all the BIOS settings but not the EFI NVRAM.

  • Later, I changed the boot order to try to boot off the Vista installation. Sure enough, I couldn’t boot off it once its entry was removed from the NVRAM.

  • The TechNet article suggests that the NVRAM’s contents should be rebuilt every boot after drives are enumerated. Intel’s firmware obviously isn’t doing that.

  • Worse, Intel’s technical support doesn’t offer support for UEFI. This means if you get into trouble with UEFI, expect no help from Intel. I had to figure this stuff out all on my own. Intel’s support personnel said there were no known UEFI issues and that there had been no reports. I asked them to consider my adventures a report. Oh well, at least they’re aware of the issues I had now.

Verdict: Intel’s Desktop Boards’ UEFI support is far from prime time. Avoid.

Also, if you’re installing Windows Vista x64 SP1 on these boards and UEFI boot is enabled in the BIOS configuration, the DVD will default to attempting an EFI install. So if you’re planning to install it on an Intel Desktop Board, ensure that UEFI Boot is disabled in the BIOS configuration, or you will regret it.

That’s a misadventure I don’t care to repeat.

[Edit: It turns out I should've read the Technical Product Specification for the motherboard, because in this situation, pressing F10 gives me a temporary boot menu, which lets me choose the device to boot off. This lets me boot the CSM-based bootsectors as well as removable devices. It's still pretty far from ideal that I have to do that, though, but it does mean that it's recoverable even if Vista stops being able to boot, as actually happened once when it consistently failed to come out of hibernation and also didn't prevent resume on the subsequent boot—I had to boot Linux, mount the filesystem and remove hiberfil.sys.]

Microstar International (MSI) has launched a motherboard with UEFI support, the P35 Neo3-F. I think there’s yet to be a review of it testing the UEFI functionality. I wonder if it’s any better. Then again, the P35 Neo3-F’s marketing has touted the UEFI support; I doubt they would do that if their UEFI firmware was as embarrassingly buggy as Intel’s.

Oh well. In a year, maybe I’ll give it another shot.

Link | Leave a comment | Share

Late to the game, but since everyone else is doing it . . .

11th Sep 2007 | 02:15 am says I&quot;m a Kinda Dorky Technology Geek.  What are you?  Click here!

All I can say is, thank goodness I’m not a sci-fi or comic nerd.

Link | Leave a comment {1} | Share

Three years in, nothing changes.

4th Apr 2007 | 02:36 am
location: Bangalore
mood: annoyedannoyed
music: Portishead — A Tribute To Monk & Canatella

In less than three weeks, I will have lived in Bangalore for three years. I was apprehensive three years ago, and posted a couple of rants on how awful India was.

I can tell you that since that last rant in February 2005, little has changed in the "Silicon Valley of India".

I still lose power on average three times a day, for two hours a day, especially since it's gotten rather hot lately and they've started load shedding. (Even though they said Bangalore would be spared, I'm certain it's no coincidence that power cuts have ramped up since then.) Infrastructure is crumbling (copy for whenever BusinessWeek expires the former link), enough to drive companies like Intel away.

For all its importance, the tech services sector employs just 1.6 million people, and it doesn't rely on good roads and bridges to get its work done. India needs manufacturing to boom if it is to boost exports and create jobs for the 10 million young people who enter the workforce each year. Suddenly, good infrastructure matters a lot more. Yet industry is hobbled by overcrowded highways where speeds average just 20 miles per hour. Some ports rely on armies of laborers to unload cargo from trucks and lug it onto ships. Across the state of Maharashtra, major cities lose power one day a week to relieve pressure on the grid. In Pune, a city of 4.5 million, it's lights out every Thursday—forcing factories to maintain expensive backup generators. Government officials were shocked last year when Intel Corp. (INTC) chose Vietnam over India as the site for a new chip assembly plant. Although Intel declined to comment, industry insiders say the reason was largely the lack of reliable power and water in India.

Add up this litany of woes and you understand why India's exports total less than 1% of global trade, compared with 7% for China. Says Infosys Chairman N.R. Narayana Murthy: "If our infrastructure gets delayed, our economic development, job creation, and foreign investment get delayed. Our economic agenda gets delayed—if not derailed."

More reading provides some insight into the real India. Someone has looked into the mouth of the beast and discovered its nature. There are positives and negatives, of course. I tend to dwell on the negatives because I didn't grow up needing spirituality to deal with the godawfulness of this country. (Yes, it's my belief that all the "spirituality" that people come here to discover within themselves grows out of despair.) And it's all there—squalor, thuggery, stupidity, avarice—in vast proportions.


I'm applying to various companies abroad. Wish me luck.
Tags: , ,

Link | Leave a comment {2} | Share

Someone else gets it.

17th Nov 2006 | 12:43 am

It's rare for me to find an Indian blogger who actually has a clue.

Found one!

The next time some Indian moron goes on about how much better it is to live in India because it's cheaper, I'm going to slap him in the face with this — India is about 70 times more expensive than the US when it comes to prices vs spending power. (The numbers are a little off — India's GDP is closer to USD 650 per capita, not USD 450, but the vast disparity stands.)

Items that are several times more expensive in India than the US or even, say, Dubai, include pasta, cheddar cheese, most electronics (laptops cost three times as much here), gasoline/petrol, cars (yes, USD 35,000 for a Hyundai Sonata) and, my mother says, even basic necessities like fruit and rice.

He even slights India's collective intelligence. More than once.

I'm pretty close to quitting my job because management is making my life difficult, and I hear things are about to get a lot worse. In the face of declining appreciation and increasing pressure, intrusion into my personal zone and poor management, I'm looking to leave for greener pa$ture$. If anyone can help me emigrate out of this hellhole once and for all, it would be much appreciated.

Thank you Mathew for producing this Demotivator at

Get. Me. The. Fuck. Out. Of. Here.

Brilliant, it captures the despair and squalor all at once.

Speaking of Mathew, I thought this observation was quite apt. In geekspeak, I do believe this is what we call being 0wned.
Tags: , ,

Link | Leave a comment {2} | Share

Operating Opera

12th Nov 2006 | 06:41 am

So I got really sick of the fact that YouTube doesn’t offer the ability to prefetch a video before playing it (instead of, as often happens on my 256 kbit/s downstream, suffering stuttering and then having to play it again later), and looked for a way to steal the .flv that it plays.

I didn’t have to look long before I found YouTube to me and Google Video Getter. These are GreaseMonkey scripts. Now, GreaseMonkey’s just a Firefox extension that won’t work on Opera, right?

Not quite.

Opera, since version 8, has supported “User JavaScript”, i.e. GreaseMonkey scripts. You hit the Preferences, Advanced tab, Content category, JavaScript Options button, and specify a directory containing GreaseMonkey scripts at the bottom.

Now these scripts specified above don’t appear to work with Opera. I’m using the Flash Player 9 Update pre-release for Linux (in conjunction with libflashplayer for OSS goodness, so I can use the hardware-multiplexing NVSound driver for my onboard NForce audio), and I guess Adobe/Macromedia changed some things around so the scripts don’t work any more.

Never fear, I’ve figured out fixes to the scripts.

For YouTube-to-Me, change

var download_url = '';


var download_url = '';

Additionally, change

var t_id = playerDiv.src.match(/t=([^(\&|$)]*)/)[1];


var t_id = playerDiv.getAttribute("SRC").match(/t=([^&$]*)/)[1];

Apparently either Opera or Flash no longer allows access to the src attribute directly. getAttribute(“SRC”) works admirably well, though.

For Google Video Getter, change

var video_url = unescape([^$)]*)/)[1]);


var video_url = unescape(video_obj.getAttribute("SRC").match(/videoUrl=([^$)]*)/)[1]);

A similar situation appears to apply.

I recently rented a Linux vserver for the princely sum of $6 a month. I intend to set up Apache + PHP + MySQL on it and run a CMS and some genealogy software. It’s running Centos 4.4, essentially Red Hat Enterprise Linux 4 Update 4.

Any suggestions for either the CMS or genealogy software are welcome. My restrictions are that the processor on the vserver host is a 2.53 GHz Celeron D, the memory allocation is 128MB and the disk space is 3GB, so that sort of rules out anything J2EE/JSP/Servlets or ASP.NET based.
Tags: , , ,

Link | Leave a comment | Share

Debian sid on an IBM ThinkPad A21e

8th Jan 2006 | 06:59 am

I recently acquired a ThinkPad A21e laptop. This is an account of how I set up Debian GNU/Linux unstable (as of November 2005 through January 2006) on it.


  • Intel Celeron 600 MHz (SL3W8?)

  • Intel 440MX chipset with 256 MB PC66 SDRAM

  • ATI Rage Mobility P/M graphics chipset with 4MB RAM driving a 15" XGA (1024x768) TFT display

  • IBM TravelStar 20GN hard disk, 10GB capacity, 4200 rpm hard disk on hda

  • Built in 3.5" floppy drive

  • LG CRN-8241U 24x CD-ROM drive on hdb in the UltraBay

  • TI PCI1410 PC Card controller with one PC Card slot

  • Intel 82559 (PRO/100) Ethernet controller

  • Xircom Mini-PCI V.90 modem (PCI ID 115D:000C)

In addition, I use a D-Link DWL-G650 PC Card 802.11g Wi-Fi adapter for wireless connectivity, as well as a generic USB IntelliMouse Optical knockoff for a mouse.


Processor - Intel Celeron 600 MHz

Being a Celeron, this processor lacks SpeedStep altogether. However, it does support ACPI throttling T states, which are a more coarse way to control power consumption by essentially causing the processor to forcibly stop a certain proportion of the time.

I built and installed scaler to try to keep the CPU load around 50% when on battery power. I needed to change the TARGET_FILE macro in the scaler.c source file to

#define TARGET_FILE "/proc/acpi/processor/CPU/throttling"

since it seems the scheme has changed since the code was last updated.

I installed the Debian laptop-mode-tools package and (since I'm using ACPI) modified the ACPI event handling scripts to start and stop the scaler daemon when disconnected from or reconnected to the AC adapter. Sadly, this model appears too old to report ACPI AC adapter events, generating ACPI battery events instead, so I had to resort to hacking up the corresponding action script.

According to /etc/acpi/events/lm_battery, this was /etc/acpi/actions/, so I added some stuff to it.

Near the beginning:

#! /bin/bash

# The A21e generates battery events for AC adapter plugin/remove. Handle that
# first.

if [ "$2" = "BAT0" -a "$3" = "00000080" -a "$4" = "00000001" ]; then
	STATE=$(awk '{print $2}' /proc/acpi/ac_adapter/AC/state)
	case $STATE in
		on-line)	logger -p On mains power.
				pkill scaler
				for i in up up up up up up up
					echo $i > /proc/acpi/ibm/brightness
					sleep 0.2
				laptop_mode stop
		off-line)	logger -p On battery power.
				/usr/sbin/scaler 50
				for i in down down down down down down down
					echo $i > /proc/acpi/ibm/brightness
					sleep 0.2
				laptop_mode start
		*)		logger -p AC unknown: "$STATE"

test -f /usr/sbin/laptop_mode || exit 0


As you can see, apart from starting and killing scaler, I also had the script adjust the LCD brightness on power adapter unplug and replug. (The latter support depends on controls that involve the ibm_acpi kernel module; more on that

If I'd had a SpeedStep-capable processor, I could've used cpudyn or similar with the speedstep-smi kernel module, but since I don't have one, I haven't investigated how to set up SpeedStep.

I'll cover power management separately.

ATI Rage Mobility P/M and LCD display

Setting up X for 2D acceleration with this chipset is straightforward — use the "ati" driver, and it'll be treated as a Mach64 accelerator. I couldn't get 3D to work, though — it's equipped with just 4MB of RAM, and that space is insufficient to accelerate 3D at XGA resolutions. It is my understanding that the Mach64 support in 6.8.2 at least (no idea about 6.9.0) does not incorporate 3D acceleration support since it is insecure. I built the Mach64 driver from the Mesa3D CVS tree with non-secure drivers enabled, but to no avail — even at 800x600 — and I could not get direct rendering to work.

With the ibm_acpi kernel module loaded, some control over the LCD is possible. Under the /proc/acpi/ibm tree there are control files for brightness ("brightness") and display switching ("video"). In my experience the latter doesn't work particularly well at least under ACPI, but the former works very well. In addition, the tool vbetool can be used to turn on and off the the display. I'll have more on that later.

IBM TravelStar 20GN

This is a rather slow 10GB unit spinning at 4200 rpm, with a high-pitched whine, but it suits my purposes fine. I initially set up the laptop to use APM, and for suspend-to-disk purposes created a hibernate volume at the end of the disk. This is nothing more than a hidden FAT16 LBA partition (type ID 0x1e) that carries one file called save2dsk.bin. This file can be created using Andrew Tridgell's tphdisk tool. It needs to be slightly (a few megabytes) larger than the size of physical memory and video memory together. I created a 300 MB partition and file.

Once I switched to ACPI, suspend to disk would no longer work, so I set up software suspend instead, which writes to a swap volume instead. I'll have more on that later.

Another thing I did was to set up smartd to monitor the SMART characteristics of the hard disk. On Debian this consisted merely of installing the smartmontools package and modifying /etc/default/smartmontools to monitor the hard disk:

# Defaults for smartmontools initscript (/etc/init.d/smartmontools)
# This is a POSIX shell fragment

# list of devices you want to explicitly enable S.M.A.R.T. for
# not needed if the device is monitored by smartd

# uncomment to start smartd on system startup

Then I started smartd with invoke-rc.d smartmontools start.

I also set up a few /etc/hdparm.conf settings:

# -A disable/enable the IDE drive's read-lookahead feature      
lookahead = on
# -c enable (E)IDE 32-bit I/O support - can be any of 0,1,3        
io32_support = 1
# -m sector count for multiple sector I/O
mult_sect_io = 16
# -u interrupt-unmask flag for the drive
interrupt_unmask = on

/dev/hda {
        write_cache = on
        transfer_mode = 66
        spindown_time = 120

The spindown_time setting sets up the hard disk to spin down in ten minutes in the absence of activity. With laptop mode, when off AC power, the ext3 journal commit time increases from once every five seconds to something configurable via /etc/laptop-mode/laptop-mode.conf, so this setting has a chance to take effect and spin the hard disk down for enhanced battery savings. (The laptop mode tools also modify the spin-down time.)

# Hard drive behaviour settings

# Maximum time, in seconds, of work that you are prepared to lose when your
# system crashes or power runs out. This is the maximum time that Laptop Mode
# will keep unsaved data waiting in memory before spinning up your hard drive.

# Should laptop mode tools control readahead?

# Read-ahead, in kilobytes. You can spin down the disk while playing MP3/OGG
# by setting the disk readahead to a reasonable size, e.g. 3072 (3 MB).
# Effectively, the disk will read a complete MP3 at once, and will then spin 
# down while the MP3/OGG is playing. Don't set this too high, because the 
# readahead is applied to _all_ files that are read from disk.

# Should laptop mode tools add the "noatime" option to the mount options when 
# laptop mode is enabled?

# Should laptop mode tools control the hard drive idle timeout settings?

# Idle timeout values. (hdparm -S)
# Default is 2 hours on AC (NOLM_HD_IDLE_TIMEOUT_SECONDS=7200) and 5 seconds
# for battery and for AC with laptop mode on.

# Shoudl laptop mode tools control the hard drive power management settings?

# Power management for HD (hdparm -B values)

# Should laptop mode tools control the hard drive write cache settings?

# Write cache settings for HD (hdparm -W values)

CD-ROM drive, CardBus controller and Ethernet adapter

These are picked up and configured by the hotplug subsystem; for the Ethernet adapter I just placed one line in /etc/network/interfaces:

iface eth0 inet dhcp

Most of the time I use the laptop unwired, so I don't have it brought up automatically.

Xircom Mini-PCI V.90 modem

As expected, this is a winmodem. It works pretty well with the ltmodem driver. I downloaded the source and after installing the linux-headers package corresponding to the Debian kernel installed, I ran the build_deb script inside to detect the modem and build the kernel module for the modem. After installing the generated package and loading the module with a modprobe ltmodem and modprobe ltserial, the simulated serial dialout device showed up under udev as /dev/ttyLTM0 (character special file, major 62, minor 64), ready to be used.

D-Link DWL-G650 wireless adapter

This carries an Atheros 5212 chipset paired with a 2.4 GHz radio capable of 11b and 11g operation (no 11a though). I use the madwifi driver with it. Under Debian, this involves installing the module-assistant package and running module-assistant auto-install madwifi to build a package of the modules, then installing the generated package with dpkg -i. The next time I plugged in the card the hotplug subsystem loaded the driver, leaving it ready for use.

I use wpa_supplicant for WPA and roaming support in conjunction with guessnet and ifplugd to manage connectivity. All of them are available in Debian's apt repository. Essentially, in conjunction with Debian's ifupdown, this allows hotplug to manage interfaces and allow for automatic configuration of known networks. The hole, roaming on unprotected hotspots, is something that doesn't work perfectly yet, unfortunately. I'm still working on that one.

Here's what ties them together — /etc/network/interfaces:
auto ath0

mapping ath0
	script /usr/sbin/guessnet-ifupdown
	map default: home

iface home inet static
      wireless-essid "my-essid"
      wireless-mode Managed
      wireless-power on
      test wireless mac RO:UT:RM:AC:AD:DR essid my-essid
      pre-up /etc/init.d/wpasupplicant restart
      post-down /etc/init.d/wpasupplicant restart

iface work inet dhcp
      test wireless essid work-essid
      wireless-essid work-essid
      wireless-mode Managed
      wireless-power on
      pre-up /etc/init.d/wpasupplicant restart
      post-down /etc/init.d/wpasupplicant restart

iface other inet dhcp
      wireless-essid any
      wireless-mode Managed
      wireless-power on
      pre-up /etc/init.d/wpasupplicant restart
      post-down /etc/init.d/wpasupplicant restart

iface adhoc inet dhcp
      wireless-essid any
      wireless-mode Ad-Hoc
      wirelss-power on
      pre-up /etc/init.d/wpasupplicant restart
      post-down /etc/init.d/wpasupplicant restart

allow-hotplug ath0

mapping hotplug
	script /usr/sbin/guessnet-ifupdown
	map default: home

Essentially it passes hotplug events regarding interfaces to guessnet, which uses the test directives in each stanza to decide which one fits best, then uses it to set up the appropriate interface.

I use WPA-PSK at home and the workplaces uses LEAP, so I've set up wpa_supplicant to scan for the known APs in /etc/wpa_supplicant.conf:


# LEAP with dynamic WEP keys


That last one should cause wpa_supplicant to associate with any open AP; however, whether it's because of ifplugd or guessnet or something wrong with my configuration, that never actually happens, and I usually end up having to stop wpa_supplicant with invoke-rc.d wpasupplicant stop and then use iwlist and iwconfig to manually associate with an open AP. Oh well. I'll get it right sooner or later. For the moment, it does cycle through the known networks and does automatically authenticate against and associate with my home network simply when I plug in the card.

In order to get wpa_supplicant going I needed to set it up for my card in /etc/default/wpasupplicant:

OPTIONS="-i ath0 -D madwifi -c /etc/wpa_supplicant.conf"

and start wpa_supplicant with invoke-rc.d wpasupplicant start.


This is the plain ThinkPad keyboard without the Windows or menu keys. There are four convenience buttons — one ThinkPad button, up/down volume control buttons and one mute button, that act independently of the driver mixer. I use tpb to manage them. I installed the Debian package for it and edited /etc/tpbrc to change the action of the ThinkPad key (directive THINKPAD) to start /usr/bin/opera. I also changed the OSD font and color to taste:

OSDFONT     -*-arial black-*-*-*-*-*-180-*-*-*-*-*-*

By and large, the defaults work well. It also takes care of the Fn-PgUp keystroke to toggle the ThinkLight (the LED that lights up the keyboard if you feel it's too dark to see the key labels). I have tpb start from my .xsession:

tpb -d

I also set up ACPI events for the Fn keystrokes. Specifically, this laptop generates events for Fn-F3 to control the LCD backlight (on/off), Fn-F4 for standby, Fn-F7 to switch displays and Fn-F12 to hibernate. I created a file /etc/acpi/events/ibmkey:

event=ibm[ /]hotkey
action=/etc/acpi/actions/ %e

and the corresponding action script:


if [ $2 != "HKEY" ] ; then exit ; fi

case "$3 $4" in
	"00000080 00001003")
		# Fn-F3, Blank screen
		echo 12 > /proc/acpi/ibm/beep
		STATE=$(grep '^lcd:' /proc/acpi/ibm/video | awk '{print $2}')
		if [ "${STATE}" = 'enabled' ]; then
			# It's been known to lie; check to see if we've done
			# this before.
			logger -p local0.warn /proc/acpi/ibm/video lied to us
			if [ -f /var/run/lcd-disabled ]; then
		if [ "${STATE}" = 'enabled' ]; then
			echo lcd_disable > /proc/acpi/ibm/video
			/usr/sbin/vbetool dpms off
			touch /var/run/lcd-disabled
			/usr/sbin/vbetool dpms on
			echo lcd_enable > /proc/acpi/ibm/video
			rm -f /var/run/lcd-disabled
	"00000080 00001004")
		# Fn-F4, Sleep
		echo 2 > /proc/acpi/ibm/beep
		chvt 1
		echo 7 > /proc/acpi/processor/CPU/throttling
		echo lcd_disable > /proc/acpi/ibm/video
		/usr/sbin/vbetool dpms off
		echo standby > /sys/power/state
		/usr/sbin/vbetool dpms on
		echo lcd_enable > /proc/acpi/ibm/video
		echo 0 > /proc/acpi/processor/CPU/throttling
		chvt 12
	"00000080 00001007")
		# Fn-F7, Switch
		echo video_switch > /proc/acpi/ibm/video
	"00000080 0000100c")
		# Fn-F12, Hibernate
		echo 2 > /proc/acpi/ibm/beep

Now for what this script does — the hotplug subsystem matches ACPI events against the event files in /etc/acpi/events and invokes the commands specified therein, providing the event data as arguments. The script then uses the event data to determine what the hotkey event was and acts accordingly.

The ibm_acpi kernel module adds much functionality specific to IBM ThinkPads, including a /proc/acpi/ibm procfs tree that provides much state information and control over various aspects of the laptop. It also allows for the generation and recognition of IBM-specific ACPI events, such as the hotkey events. This depends on hotkey support being enabled either through /proc/acpi/ibm/hotkey or through the options passed to the ibm_acpi module at load time. I used the latter option, creating a file called /etc/modprobe.d/ibm-acpi:

options ibm-acpi experimental=1 hotkey=enable

One of the things ibm_acpi allows control over is the LCD backlight, including brightness and turning it on and off. Unfortunately, the latter is pretty unreliable, so I had to cook up a way to keep track of whether the LCD was on or off. I ended up with a statefile in /var/run and the use of vbetool to turn the display on and off on the Fn-F3 keystroke. It works fairly reliably.

The Fn-F4 keystroke is fairly straightforward — I bring the CPU to maximum throttling (lowest speed, just in case), disable the LCD and then ask ACPI to send the laptop into S1 standby mode. Turning the LCD off is necessary since for some reason, ACPI standby doesn't do this. I tried to use S3 sleep ("mem"), but this was summarily ignored, and S2 suspend locked up the laptop hard.

On resume the LCD is enabled again and the throttling is disabled.

The Fn-F7 video switch is accomplished by means of the /proc/acpi/ibm/video control file, but I'm not sure if this really works; I have not had the chance to try it with a CRT. At least it seems to disable and enable the LCD.

The Fn-F12 keystroke invokes the swsusp2 hibernate script from the Debian hibernate package, which works equally well with swsusp integrated in the stock Debian kernels. More on that later.

Pointer input (mouse and TrackPoint)

ThinkPads are equipped with a TrackPoint device that serves as a mouse replacement — effectively a nubby joystick between the G, H and B keys on the keyboard and a set of three buttons beyond the spacebar. The blue-and-black "middle button" is meant to be used with the TrackPoint to generate scroll events. X recognizes it as a regular PS/2 mouse with three buttons, however, and does not, by default, provide for scrolling functionality.

There's a tool called
tp-scroll that can sit in between the /dev/input/mouse0 device file and X, and can translate middle button drags into scrolling events, and it works fairly well. However, it has one major issue — it makes it inconvenient to remap buttons and coexist peacefully with an external USB mouse — frequently the tp-scroll horizontal-axis scroll events will generate the same X button events as the USB mouse's side buttons, and it seems not to work very well at all with the newly released X11R6.9.0, where generates "button 10" events for scroll up and button 6 and 7 events for horizontal scroll — and none at all for scroll-down.

Fortunately, X builds in its own scrollwheel emulation. For a while now, you can configure the mouse to emulate a scrollwheel using the EmulateWheel option:

Section "InputDevice"
	Identifier	"Configured Mouse"
	Driver		"mouse"
	Option		"CorePointer"		"on"
	Option		"Device"		"/dev/input/mouse0"
	Option		"Protocol"		"ExplorerPS/2"
	Option		"ZAxisMapping"		"4 5 6 7"
	Option		"EmulateWheelButton"	"2"
	Option		"EmulateWheel"		"on"
	Option		"Emulate3Buttons"	"on"
	Option		"YAxisMapping"		"4 5"
	Option		"XAxisMapping"		"6 7"

Unfortunately, until recently, this meant foregoing Button 2 (middle-click) events, which made things rather inconvenient, even with Emulate3Buttons allowing the event to be generated with the left and right buttons clicked together. However, there's been a patch for quite a while that allows a timeout to be set up; if the button is released during the timeout period, a regular middle-click event is generated. This is a great improvement, and the only thing one loses is the ability to do a middle-button-drag (which can be kludged on using the 3-button emulation feature, whereupon you regain the ability to do a middle-button-drag using the left and right buttons together, but lose the minor ability to do a simultaneous left-and-right click). Essentially you set the EmulateWheelTimeout option in addition to the above:

	Option		"EmulateWheelTimeout"	"300"

David Nusinow of the Debian X Strike Force uploaded some 6.9.0rc1 packages into experimental some weeks ago with this patch applied (or maybe it made it into upstream; I don't know); I'm using the xserver-xorg package version that has this patch applied. Subsequent packages (; 6.9.0rc2 up to the current package in unstable, 6.9.0.dfsg.1-2) seem to have this functionality broken. Currently I've placed the 6.9.0rc1 xserver-xorg package on hold; I'll upgrade when the issue is fixed. For now, the package can be had off

The horizontal scrolling generates button events 6 and 7, which are usually configured for side buttons, so in browsers, they usually act as back and forward button events. This can get really aggravating when you're trying to scroll vertically up or down and end up going back or forward accidentally because you weren't scrolling perfectly vertically. Fortunately, most browsers are easy to fix. For Gecko-based browsers such as Mozilla, Seamonkey, Firefox, etc. you can navigate to about:config and change the setting mousewheel.horizscroll.withnokey.action to the value 0. I also recommend changing mousewheel.horizscroll.withnokey.numlines to the value 5. This changes the behavior of horizontal scroll events from going back and forth in history to scrolling the page horizontally. (Thanks to the Mac community for running into this problem with the Mighty Mouse and figuring out how to fix it.)

Opera, my browser of choice, similarly generates Back and Forward events for buttons 6 and 7. This is easly fixed. In Opera 8 and higher, bring up the Preferences dialog (Tools → Preferences) and hit the Advanced tab. In the left pane, select the last item, Shortcuts. In the top right selection box, choose Opera Standard and select Edit... Then in the dialog box that appears, expand the Application item and look for Button6 and Button7 events. Change their actions to read Scroll left and Scroll right instead. Click OK to dismiss the dialog box, and choose the Opera Standard (Modified) item and dismiss the dialog box with the OK button. At this point your TrackPoint should be able to scroll in both axes without triggering page flips.

(Apparently, the use of button 6 and 7 events for horizontal scrolling is now standard, with X11R6.9.0's default ZAxisMapping having been reverted to this effect. Now the world needs to change to comply . . .)

I also set up gpm to give me a cursor on text console; here's my /etc/gpm.conf:


Additionally, I wanted to use my USB mouse in its full glory. This is done using a fairly standard-looking setup (except for the AlwaysCore option to allow me to use it simultaneously with the TrackPoint, and the four values to push the side buttons up to distinguish them from the horizontal scrolling events from the TrackPoint). From my /etc/X11/xorg.conf:

Section "InputDevice"
	Identifier	"USB mouse"
	Driver		"mouse"
	Option		"AlwaysCore"		"on"
	Option		"Device"		"/dev/input/mouse1"
	Option		"Protocol"		"ExplorerPS/2"
	Option		"ZAxisMapping"		"4 5 6 7"
	Option		"Buttons"		"9"

As a result, the side buttons generate button events 8 and 9 (which is, again, standard with 6.9 and 7.0), which most browsers sadly do not recognize yet. Enter IMWheel. This is an aged tool that was in vogue when the IntelliMouse Wheel first started becoming popular and applications still lacked support for the scrollwheel — it was used to translate the wheel events into keystrokes in the applications. Those days are long past at least as far as scrollwheels are concerned — practically all toolkits have some provision to support the scrollwheel, even if it means setting X resources to get Motif and Athena Widgets to comply. However, with the now-oddball side button settings, imwheel sees its worth again.

Here's my ${HOME}/.imwheelrc:

None,	Thumb1,	Up
None,	Thumb2,	Down

None,	Thumb1,	Up
None,	Thumb2,	Down

None,	Thumb1,	Up
None,	Thumb2,	Down

None,   Thumb1, Page_Down
None,	Thumb2,	Page_Up

None,   Thumb1, Alt_L|Left
None,   Thumb2, Alt_L|Right

None,   Thumb1, Alt_L|Left
None,   Thumb2, Alt_L|Right

None,   Thumb1, Alt_L|Left
None,   Thumb2, Alt_L|Right

I invoke imwheel with imwheel -b 000089, telling it not to bother with up, down, left or right scrolling events, but to capture buttons 8 and 9 and treat them as thumb buttons (which they are). The ${HOME}/.imwheelrc specifies the translations to perform. As you can see, I have it turn them into Alt-Left and Alt-Right keystrokes in Seamonkey, Konqueror and Opera, which are back/forward events as far as those browsers are concerned. (If you're curious about the patterns, they're matched against titles or window classes.)

Whew. Moving on . . .

Power management

Ah yes. This laptop is capable of both APM and ACPI. I initially set it up to use APM (which works essentially out of the box — however, it's a limited interface, so things like
AC adapter notification aren't available to do nifty things like turn on laptop mode or dim the screen or throttle the CPU automatically), but decided to move on to using ACPI instead. As I've indicated before, there is support for ThinkPad-specific features, and laptop_mode is a handy perk. By and large, ACPI works well, except for the annoying fact that standby mode does not turn off the LCD. The hotkey setup outlined above takes care of that issue, fortunately.

Software suspend also works, but it takes a little work. Stock Debian kernels don't build in any disk or even controller drivers, instead relying on an initrd image generated during kernel package install time to carry appropriate modules and generate device nodes on the fly using udev or similar. At the time of this writing, I had tried yaird only to find that it generated broken initital RAM disks incapable of generating /dev/hda1 on their own, so I'd switched to initramfs.

Now the way swsusp works is that you provide a resume=/dev/hdnx kernel parameter pointing out the swap device. Ordinarily, a kernel that builds in disk drivers itself will attempt to resume off the swap device indicated as its first order of business after initialization. However, given that Debian kernels cannot do this, this duty falls to the initial RAM disk, or initrd, that loads the drivers prior to switching the root device to the actual root filesystem on disk and transferring control to init. Yaird does not, as of this writing, support resuming from a swsusp page dump. initramfs-generated initrds are purported to do so by parsing the resume= parameter and sending the appropriate major and minor device numbers to /sys/power/resume, but in my case this didn't work either.

Fortunately, the initramfstools allow the administrator to specify scripts to be run at various stages of initrd processing, so I decided I would save myself the trouble and placed scripts to attempt the resume from swap (as well as create a device file that the initrd seemed to have a hard time generating on its own).

Here's /etc/mkinitramfs/scripts/local-top/resume:

echo 3:2 > /sys/power/resume

This forces the kernel to attempt a manual resume from the swap device, /dev/hda2. (The numbers are the major and minor numbers of the block device.) At some point I'll figure out why the initrd can't manage to do this on its own. For now, though, this is a good workaround.

Here's /etc/mkinitramfs/init-premount/rootfs:

mknod /dev/hda1 b 3 1

Again, udev and hotplug ought to be able to manage this part on their own. Since they don't (and it's my understanding it's udev's fault), this will work for now.

The last piece is to add the resume= parameter as a kernel option in the GRUB configuration file, /boot/grub/menu.lst:

# kopt=root=/dev/hda1 ro elevator=as resume=/dev/hda2

This will just set up menu.lst to be processed by update-grub (so that any subsequent kernels installed will pick up these options); I run update-grub.

At next reboot, I can hit Fn-F12, which will invoke the hibernate script, upon which the swap device from which the initrd attempted to do a manual resume will in turn be used as a swsusp resume location. On powerup, the initrd will attempt to resume from it once drivers are loaded, and the hibernated session will be resumed.

I think that about covers everything. There are varied bits of functionality that one can gain out of a ThinkPad; this post covers the more interesting among them.

Link | Leave a comment | Share