Hot Rod

22 May 2006

Early this year I did a lot of travel, so my writing ground a complete halt. I got back home a few weeks ago, hoping to get a lot of writing done. Well I've done some, but things keep coming up to keep me away: surgery to remove the pins from the accident, being Flooded. But the big productivity killer has been self inflicted - buying a new computer.

The Beautiful Plan

My old setup was a desktop machine running Ubuntu, a company Dell D600 running Windows, and my PowerMac. Since the D600 is such a brick I hardly ever traveled with it, relying on the Mac. All of these bits of kit are about two years old, which is my threshold for getting something new. Thoughtworks replaced the D600-brick with a really nice Dell X1 (small, and 2.5lb light) which will replace the Mac for travel. (I like Macs, but 5lb is too much.) So it was up to me to figure out what to do about the desktop.

I rather like building my own desktop machines, that way I get to choose and know exactly what goes in it. The pain with this is knowing exactly which combination of components will work well together. As it turns out I quite often read Ars Technica and they regularly put out a system guide which provides a handy configuration. So I decided to follow their guide for April 2006 and build the "HotRod".

Actually I didn't follow the hot rod exactly. Ars guides tend to focus on gamers, and I don't do computer games. So I decided to downgrade a good way on the video output, choosing the ATI X800GTO they picked for the budget box. I also didn't bother with sound, relying just on what was on the motherboard - music is handled by a Squeezebox. I did upgrade on the hard drive, adding their suggested 10,000rpm WD Raptor.

When I buy a new desktop, I usually don't get a new monitor - as these last much longer than computers. However it was time for something new. One of my favorite answers to 'how do we improve our development productivity' is to tell them to buy larger monitors than they think they need. Screen real estate makes a huge difference to productivity, whether you are programming or writing. My old setup, a 21" CRT, used to be pretty good but now I wanted more. So I went for two Samsung SyncMaster 204B 20" LCD monitors.

This new setup, particularly going dual head, meant another question - how to co-exist multiple operating systems. I used to have the old desktop and the D600 hooked up with a kvm switch. That worked well as I could easily switch between Ubuntu and Windows depending on what I wanted to do. Kvm switching with dual heads sounded messy. However listening to the folks in our London office extol virtualization decided me on another option. Their view was that it was better to have Linux be the host and have windows run virtual. That suits me as I prefer the Linux's virtual desktop capabilities. (Windows has a virtual desktop manager in its PowerToys which is worth having, but not as good as what comes with most X window managers.

The Brutal Reality

So that was the plan - the next question is how are things working out (just in case anyone else fancies something similar.)

Putting the hardware together was easy - just took me a couple of hours. I booted up using a live Linux CD (Damn Small Linux as that was closest) and everything seemed to be working.

My first step was to install windows on one partition. Even though I'd intended to run Windows virtually, I wasn't convinced that this idea would work out best for me - and maybe someday I would want to do something with fancy graphics. This wasn't completely straightforward as the network and video wouldn't work properly with a straight install - but that was easily fixed by adding drivers for the motherboard (network) and video.

Windows usually just works with video, so the fact that this card needed a little extra work worried me - because X can be much more ugly. This was confirmed as I installed and then tried to boot Ubuntu Breezy - X failed to start. This is my big nightmare with Unix desktops - configuring X is one of the worse installation experiences you can go through. Even when you use a 'user-friendly' X installer, it proceeds to ask you "Would you like crypto-blue covariance adaptation?" (or something equally meaningful to me) and I have to guess an answer and hope my fumbling doesn't fry my new and expensive monitor.

Googling is the only solution here and eventually I found this Ubuntu wiki page which told me to install some additional packages. Well package installation in Ubuntu is a breeze:

sudo apt-get install xorg-driver-fglrx
sudo dpkg-reconfigure xserver-xorg

I crossed my fingers and selected the suggested default for everything except picking fglrx as the web page told me. X still didn't start but the web page told me about the error (duplicate symbol rol_long') and how to fix it. I followed instructions and X burst into life. (It wasn't still quite right however. Running fglrxinfo told me it wasn't using the right drivers to get accelerated 3D - but that was fine for me, I'm mostly in a 2D world.)

Or more precisely it burst into half-life. I did all this with only one monitor - I like to do things one step at a time. Again it needed some googling to find out what to do - no nice control panel like there was on Windows (let alone the Mac where I ran dual-head over a decade ago.)

The first thing to decide is what kind of dual head to use. X has long been able to run multiple monitors - but not in the same way as Windows/Mac does it. The classic X way is to have separate X sessions on each monitor. The problem with this is that they are utterly separate, you can't drag a window from one monitor to another. Also any programs operating in both have to run separate instances (which means different firefox profiles etc). The advantage of this approach, however, is that you get separate virtual desktops for each. All in all I decided I was happy (for the moment) with classic X - an alternative is to use Xinerama, but I'll look into that another time.

I tried to use fglrx-control to set up the dual monitors. No dice - I could set it for dual head, but it just forgot each time. In the end fglrxconfig helped me do the trick.

Next step was to try out VMWare. I downloaded VMWare Server from the web site (currently a free beta - if I like it I'll pay up when it releases.) It wasn't easy to get going - at times like this I really miss apt. I ran the installer script and it ran into problems with dependencies. I needed the following

sudo apt-get install make
sudo apt-get install gcc-3.4
sudo apt-get install linux-headers-amd64-generic

Once I did that VMWare installed just fine. I installed Windows, Visual Studio, Visio and other odds and ends. Everything seems to run just fine.

However all has not been well on the host. I would work for several hours happily then suddenly the screen would go black on my primary monitor (Screen 0 in X-speak). The monitor lost the signal completely. I eventually realized I could get it back by typing ctrl-alt-f5 to get a virtual console, which would appear on both screens, and then ctrl-alt-f7 to go back to X. Annoying. But really bad when I typed ctrl-alt-f5 and both monitors lost the signal. This left me stuck - even logging in from another machine and restarting X wouldn't bring them back - I had to reboot.

I put up with this for a while, but it got too annoying. So I decided that maybe I should go to Dapper Drake. Dapper is the next version of Ubuntu, still in beta but supposedly pretty stable. Maybe this would help, if nothing else it would allow me to use apt to install Java.

The install went very smoothly:

gksudo "update-manager -d"

I soon realized that the upgrade gave me the correct ATI drivers. (I'd wondered if the video drivers were part of the problem.) I also got ugly orange icons and an upgraded firefox. The bad news was some other problems I ran into.

The really bad one was that xemacs stopped working - a big deal as I use it a lot. The problem is something to do with finding colors - see this discussion thread for more information and how I solved it.

The other problem is still with me - the machine won't shutdown. If I try shutting it down (by any route) the screens go black, the shutdown sound stops in mid squawk and everything just hangs. I have to turn it off at the mains.

The good news is that I haven't had a black screen moment since the Dapper install.

Is It All Worth It?

I must admit that somewhere in the middle of dealing with emacs failing and damn thing not rebooting cleanly I began to wonder if I shouldn't have just got myself a Mac after all. I certainly have found that I spend much less time faffing with my Mac than I do with either Windows or Linux machines. Just as I was working on this Parallels released a virtualization envioronment for the mac. However now I've got it, I'd like to get this working. In hindsight I think I may have made two mistakes: installing Breezy rather than Dapper right away, and running the amd 64 architecture (instead of i386). Although Dapper has its faults, it looks like installing it would have sorted out the video drivers better; meaning I would have spent less time trying to get X to work. I also may be suffering with stuff not working as well for amd64 code as opposed to i386 code. (One problem is that I can't get a flash VM going - they don't make one yet for Linux on amd64.)

Of course I don't really know if they were mistakes, because I could have spent just as much time with other problems. Certainly not being able to do a clean restart would have (and does) cause me no end of pain.

Should I switch to Windows as the host? It's a tempting thought - and I might have done it if I couldn't fix emacs. I do like the ease of installing stuff on Ubuntu and the virtual desktop management is very handy. I've certainly had my days of angst in Windows in the past. All in all a tough call, but we'll see. I do like having windows in the VMWare image. Even if I do have to switch to another Linux installation I can just take the VMWare image with everything installed over to the new machine. Installing software is a guaranteed big time killer on windows - even free downloads have to be individually visited and downloaded. Having said that I haven't spent a lot of time in Visual Studio yet - that will be the real test of the virtualization.

Update (Jun 16)

Several people suggested that getting doing a clean Dapper install would be better than upgrading from Breezy. This week I was back from China; while I was away Dapper was released. Updating my system still isn't allowing me to do a clean shutdown, so I downloaded the final Dapper CDs to see how they might work. The result isn't that encouraging. Both the AMD 64 and i386 CDs failed to start into X in the default startup. If I tried the safe graphics mode in AMD 64 I heard gnome appear, but my screens were blank. I did get working system (on one screen) with i386 CD in safe graphics mode. There's a good bit of conversation on the Ubuntu forums about problems getting ATI graphics cards working.

So my current feeling is that my setup isn't really that good for Ubuntu, but I do have it working. Since the Dapper update I haven't had the problem of my screens going blank on me while working, so my only issue is the inability to do a clean shutdown. For the moment I can live with that - I'm not inclined to spend more time trying to futz with things further. However I wouldn't recommend my setup to anyone else.