# The Sharper Edge

As promised last week, here are my notes regarding running Ubuntu Edgy to run on my M100. Most of this is directly applicable to the M1 (which is pretty much the same hardware), and in varying degrees to other, similar laptops.

This post was pieced together from a week's worth of notes. To capture those, I relied on Tomboy and applied my usual methodical approach:

1. Take no more than 2 minutes to note down what happened. Pop into Tomboy, type in a few lines, and get on with my work.
2. Never, ever, ever immediately attempt to fix things in a rush.
3. Later on (usually at home) research the issue a bit. Add more notes to Tomboy. Do a few tests. Maybe even file a few bugs.
4. Lather, rinse, repeat.

This way I not only avoided wasting time, but made sure I kept a clear focus on what I needed to fix, and the priorities thereof. What follows are my notes on each of the issues, some of the research I did (heavily condensed to avoid annoying my readership with masses of links), and the conclusions I reached.

My opinion (in a nutshell) is that Linux (or at least Ubuntu) isn't quite ready yet to be a usable laptop OS. It is much closer to that goal than most, but there are altogether too many niggling issues for "normal" people to consider running this on a laptop on a day-to-day basis.

#### gdm Greeter Crashes

One of the very first things I did was to completely remove all traces of Ubuntu UI elements (which I find to be in appalling bad taste), and that included changing the login greeter to the plain, absolutely-no-frills one.

As it happens, it then started crashing soon after boot, with gdm complaining about the greeter and starting an alternative one.

Fix: As it turns out, my perennial interest in Assistive Technologies was to blame - this is a bug related to my having turned on "accessible login". Turning it off fixed the issue, but the bug in itself is pretty lame.

### Corporate Glue

Like I wrote last week, I had no real issues other than Citrix's dependency on libmotif3, and a few irritating Linux client bugs.

Printer setup was trivial. Although I usually handle CUPS with thongs and a hazmat suit, it was a 100% point-and-click affair (by the way, if you have Xerox printers, use lpr as the queue name - this is a bit of lore I keep forgetting to jot down).

Although I vastly prefer Outlook, I had the occasion to verify that Evolution was its usual crashy, unreliable self against my Exchange server, so I set up Thunderbird as a "last resort" way to both check e-mail and send the occasional file directly from my machine.

Which reminds me: when setting up LDAP in Thunderbird for e-mail address searches against an Active Directory machine, make sure to set the DN to your full username (i.e., domain\username).

Other than that (and the usual inability to access DFS shares, which I don't need to do thanks to Citrix), nothing else needed to be done to ensure I could work properly on my desk.

Using the machine as a laptop, however, proved a bit more challenging.

### CPU Throttling and Power Management

Ubuntu's cpufreq-selector didn't allow me to change the CPU speed like I was used to in Fedora.

Fix: Thanks to João Craveiro, I figured out that it doesn't have setuid privileges by default, and as such it was necessary to grant them:

sudo chmod +s /usr/bin/cpufreq-selector

Ubuntu still freezes if I remove my secondary battery, although it does an adequate job of monitoring it and providing estimates - until you reach roughly 15% of overall battery life, after which it becomes quite unreliable (estimated time jumps in 20-30 minute intervals).

Overall battery life, even taking care to dim the display, is roughly 4 hours (2 down from the wondrous 6+ I had with XP).

### NetworkManager Flakiness

NetworkManager isn't all that reliable. Besides competing with the standard Gnome network applets, it keeps forgetting Wi-Fi settings and is prone to odd behavior.

Partial Fix: To get it to work in a more or less reliable fashion, I had to trim down /etc/network/interfaces:

auto lo
iface lo inet loopback

auto eth0
#iface eth0 inet dhcp

auto eth1
#iface eth1 inet dhcp

### Suspend to RAM Failure

Suspend to RAM behaves erratically. Sometimes it does, sometimes it doesn't. Mostly it blows up on the second resume, but I've had a few instances when the laptop didn't come back from the first resume as well.

Hibernation works fine, but I really need suspend to RAM - since I have 1GB of RAM on my laptop, it takes longer to restore from disk than to cold boot.

A few hours at home wading through the mass (or is it mess?) of similar issues at Launchpad yielded no fixes - in fact, it appears to be a depressingly common issue, with dozens of reports (this one and this one were particularly interesting, since my Toshiba exhibits mostly the same behavior), so much so that one has to wonder if the Ubuntu developers use laptops at all.

I played around with ACPI states - exchanging S1 and S3, fiddling with the various state restoring mechanisms, and other rigmaroles that I really shouldn't be expected to have to tinker with in this day and age - and, believing this to be an X-only issue, also added the following line to the Device section in Xorg.conf:

Option "VBERestore" "true"

Nothing has worked so far.

Likely Fix: Downgrade to a Dapper kernel package (not bloody likely, since I have since installed VMware Player and TrueCrypt, and don't want to mess with either).

On a (possibly related) note, setting up Edgy on a desktop and switching off the monitor crashed (complete kernel freeze).

### Setting up Secure Storage for Confidential Documents

I hate carting around office data and documents with me (which is one of the reasons I like Citrix so much - nothing ever "leaves" the office), but sometimes you just can't help it.

Rather than go all the way and encrypt the whole disk or my entire home directory (something that really ought to be a standard part of system setup, like FileVault on Mac OS X), I decided to look around for something that provided me with the equivalent of Mac OS X encrypted disk images.

I eventually settled upon TrueCrypt, which I installed from source. It requires installing kernel-source, build-essential and dmsetup, and takes a long time to build - around 2 hours.

I then set up a custom launcher to prompt me for a password and mount the image under my home directory:

/usr/bin/truecrypt  -u -v /home/user/Documents/Vault.crypt /home/user/Vault/

I like this approach for many different reasons, but these are the main ones:

• It is cross-platform.
• All sensitive information is in one place. Besides my working documents, I can symlink anything (preferences, etc.) into it.
• It can be backed up or moved to another machine with the minimum of hassle.
• Once mounted, it works fine with Nautilus, even down to reporting free disk space correctly.

Furthermore, since I did this with a 650MB image, I can also burn it to a single CD (trust me, if you have to carry around more than a few megs' worth of confidential documents, you're either in the high-end graphics design business or doing something wrong - in many senses of the word).

### The Dot Mess

One of the things that has always annoyed me in UNIX is the profusion of "dot files" in my home directory. Sure, it is much easier to handle text-based preference files, but do I really have to have dozens of them?

Furthermore, backing up configurations is always a bit of a mess, and prone to mistakes (human ones, obviously).

Fix: Borrow a leaf from Mac OS X's book and place all important configurations under a Library folder, sym-linking as appropriate. This way, syncing configurations across machines becomes a matter of syncing a single folder.

### Random GTK Theme Regressions

On occasion, some applications (like Synaptic) revert to the default widget theme for no apparent reason. This can be extremely annoying - visual coherence was never Linux's strong suit, but one would expect a well-rounded Gnome environment to have fixed this by now.

And no, running under gksu is no excuse for not loading the appropriate theme.

Fix: None found.

### Backups

I have been using Unison as a replacement for .Mac's iDisk for a while (like I wrote, iDisk is nowhere near "secure", and notoriously unreliable), and I use it not only to sync my home source trees, but also as a way to back up my personal documents.

It has a lot of advantages over other network backup methods, such as:

• It can run atop SSH with minimum hassle.
• It provides me with a decent overview of changed files before committing.
• It only transfers changed data, not necessarily whole files.

So it was only natural that I set up unison-gtk on Ubuntu as well. Thanks to the Library trick above, I have since set it up so that it syncs some preferences and files with other boxes.

Now all I need to do to make sure I have updated versions of my stuff and a backup is fire it up before leaving the office.

I haven't yet had time to figure out why Ubuntu isn't able to do "proper" dual head on my laptop (the i810 card on it works flawlessly on Windows, of course).

What I miss the most is the ability to just activate the second display on demand and drag stuff to it without having to muck about with X configuration files, but I would probably settle for it detecting an external monitor properly and actually changing resolutions to fit.

Currently, if I plug in a 1280x1024 monitor, X will let me change the nominal resolution to 1280x1024, but give me a 1024x768 view I can pan and scroll (which is just dumb).

Fix: I most likely won't have the time to fix this myself. Fedora at least paid lip service to dual head (with a settings applet that did the basic changes for you), but Ubuntu doesn't, and X.org is still too brain-dead to work properly.

### Extras, Media and Flash Audio

Like most people, I used Automatix to install Java, Beagle and "proper" media support.

However, Flash audio stops after a few seconds, the prime suspect being the Flash 9 plugin (which is beta, after all, but allows me to enjoy the best of human culture).

### No Decent Quicksilver Equivalent

This is pretty much unfixable, since nothing, anywhere, even comes close to Quicksilver's amazing flexibility.

Still, Deskbar is enough of a Spotlight analog to allow me to make do. It supports del.icio.us and Yahoo web searches but does not, however, support Google queries (yet).

Other (rather dumb) shortcomings are that it does not in-line Beagle search results or play well with Firefox, but those seem to be fixable

### Bonjour Support

This weekend, I installed Avahi to make it easier to SSH into my Mac and back again. Although it is trivial to set up the base packages and there are clear instructions on how to publish services, you will be unable to resolve .local addresses until you do this:

apt-get install libnss-mdns
vi /etc/nsswitch.conf
...
# add "mdns" to the resolvers
hosts:          files dns mdns
...

For the curious, here's a service configuration:

\$ cat /etc/avahi/services/ssh.service
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name>Toshiba M100</name>
<service>
<type>_ssh._tcp</type>
<port>22</port>
</service>
</service-group>

### Last But Not Least, The Dash Idiocy

One thing that kept tripping me up was the completely asinine move of replacing bash with dash.

It may be faster, but believe me, it is far more trouble than it's worth. Commands go wonky, build scripts fail in mysterious ways, entire virtual environments collapse.

Fix: Change my shell to bash. Symlinking /bin/sh to it was considered, but that might break other things.