Saturday, October 18, 2008

AHCI and freezes during startup while detecting SATA devices

You know how sometimes you're dealing with a computer problem and you find yourself trying a bunch of things, almost randomly, in a desperate attempt to try and get it to work? There's a name for that. If you're doing that while writing a program it's called voodoo chicken coding. If you're doing it while trying to debug some sort of operating system problem then I suppose it's voodoo chicken troubleshooting. it's called voodoo chicken coding (or troubleshooting) because you don't actually know what the problem is that so it is trying a bunch of random things to get it to work. It's the equivalent of mumbling things to the gods while waving some kind of voodoo chicken over the computer in a vain attempt to get to it to work.

This is not a good strategy. Even if you do manage to solve the problem this way it will probably reoccur again since whatever you did to fix the problem probably just fixed the problem by accident. (I say this coming from a background of trying to debug heavily threaded software).

What is not often stated, however, is that knowing how a system works can sometimes be of no help either. I recently had a problem on my PC where the computer would freeze early in the startup process while the BIOS was still scanning for IDE devices. I ran into this issue I was trying to switch my SATA bus over to AHCI. AHCI stands for Advanced Host Controller Interface. It's a newer protocol for talking to serial ATA devices that offers more features than the normal parallel ATA protocol such as hot swapping and native command queuing. I wanted to enable this on my internal hard drive for two reasons: 1) I thought I already had enabled it at some point in the past. 2) I wanted to enable native command queuing because it sounds cool. 3) I need to enable it in order to run the Mac OS which I've been trying, unsuccessfully, to get running on my computer since I bought it about a year and a half ago. At least part of the reason I haven't managed to get it running is because I haven't managed to get my computer running with AHCI.

Anyway, I turned on AHCI in my BIOS I started getting this freezing problem when the BIOS was scanning the SATA bus looking for new devices. I was a bit confused because as far as I know there's absolutely no way that anything I had done to the hard drive, in terms of formatting or partitioning or installing software, could cause this problem. Scanning for new devices shouldn't be reading anything on the hard drive. That's just weird. Well, it turned out that this was indeed the problem.

After trying everything I could think of I decided simply to wipe the drive in a voodoo chicken debugging attempt to try and get the system to recognize the hard drive without freezing. Amazingly, after doing a low-level formatted the drive and rebooting it worked fine. I still don't understand why this is. Why the heck is it reading off the drive during the device detection routine? Well, I don't know. Anyone want to explain this to me then feel free. Anyway, I'm just happy it's working now. Native command queuing is indeed cool!

So, I'm not sure what the moral of this story is. I think it is that once you've eliminated everything as being impossible the only thing that's left is the impossible, which is impossible. This in turn means you have absolutely no clue what you're doing and might as well start trying a whole bunch of random stuff that shouldn't work.

Now if you'll excuse me, I have some chicken stew to eat. yummy!


Sidenote: Switching from parallel ATA to AHCI requires installing drivers under Windows. Unfortunately installing drivers under Windows requires AHCI to be enabled. Enabling AHCI renders Windows unbootable unless it has the drivers for the AHCI controller installed. This is a very fun situation as it means you can't install AHCI drivers until AHCI is enabled and you can't load Windows if AHCI is enabled. I managed to get around this problem, on my machine by using my two SATA controllers to enable AHCI on the second controller, install the drivers in Windows for this controller, then manually change the hard drive over this this second controller. I then rebooted Windows under the second controller and turned on AHCI under the primary controller. I then moved my hard drive back to the primary controller and start up my machine again. And that effective all these shenanigans with the have AHCI enabled on both controllers and a half the drivers for these two AHCI controllers installed and enabled. There are apparently ways of installing the drivers by booting up from a CD-ROM or other startup disk and then inserting a floppy drive with those drivers at some point. I didn't bother reading up on how to do that as the above methods seemed far simpler to me.

Thursday, October 9, 2008

Computer issues

Arggh! This is driving me crazy! Is there anyway I can actually get any work done without being thwarted by stupid, little computer issues.

Yesterday is was trying to setup an FTP server on my WindowXP machine. This is pretty much a single click operation on MacOS X (not including the usual NAT shenanigans) on windows it took forever.

  • The user manual was wrong.
  • The IIs FTP component needed to be installed separately.
  • There's a hidden button for setting the file sharing permissions into "simple" (read useless) mode. For some reason, the document doesn't mention that certain menu items in the MMC sharing controls don't show up in simple mode. grrr..
  • The sharing controls are hideous and there's at least one hideous violation of standard UI widget behavior that blew my mind. For the curious it's a checkbox on a settings dialog that doesn't represent a setting but an action to do when you apply the settings. Someone apparently figured that since they were writing code that did actions (like saving settings) when the user clicked ok, that the dialog represented the actions to take when hitting ok instead of the state of the preferences that are mirrored when the user pressed ok.. grrr.
Today it's open office. I wanted to finally start fixing up one of my long text documents - adding things like style information and a table of contents. I opened up the file and spent 3 hours or so adding style information and a table of contents. Just a few moments ago I reopened the document to start adding content again. Humm, all the style information had gone. Did I open the wrong file.? nope, all the textual information changes were still there, just the style information. I looked at the file type: txt!

You have got to be kidding me.

Apparently, OpenOffice was fine with me adding the text style information but had no intention of actually saving said information.. Or even pointing out that I was adding text style information to a text document. Which makes no sense!

Last time I used microsoft word (version 5.0 mac) it didn't do this. The behavior was to stubbornly insist that if you wanted to save to something other than word's default format you manually go through the save-as process each and every time. It insisted on warning you that you might loose formating information each and every time. In the end one tended to give up, write the thing in word's native file format and save-as something else before sending.

I believe that the modern version of word will actually warn you that the specific things inside your current document can't be saved to whatever you've chosen. I might be wrong on this, though. I haven't been able to get past the modern version of word's interface. Where are the keyboard equivalents listed???

Photoshop won't silently save a file with layers or other non-savable info to a png (ie: it won't loose your layers silently). I can't think of any program that would have allowed me to just waste time like this in all the years of using a computer. This is a first: a completely novel way of destroying my data.

Thankyou Open Office. Thankyou, you stupid, useless application. May the idiot that responsible for destroying my data suffer some sort of miss-fortune... like loosing his data while using Open Office in the same way.

Wednesday, October 1, 2008

US healthcare documentary

I just finished watching the Frontline documentary. It talked about the US healthcare situation. Basically, what the documentary was about was how healthcare is done in five different countries. It contrasted this against how healthcare is provided in the US.

Healthcare, in US, is very inefficient. The health expenditure per capita in the US is basically twice what it is in most other countries. That's really quite spectacular.

I don't live in the US, however I get the impression that the health care debate is incredibly politicized there. It looks like this is making it difficult for them to make any progress with their healthcare system. That's a shame.

I live in Canada. Our healthcare system has had it's share of problems recently. From what I gather, most of these problems have stemmed from underfunding. This underfunding was in turn caused by a need to service a large national debt. Now that the debt situation is under control funding is increasing again. It looks like we're doing pretty well.

Canada wasn't one of the five countries in the frontline documentary although Wikipedia apparently has an article comparing the Canadian and US health care services for those interested.

Think of it, with all the money Americans would save they could buy a couple more maglev trains. You can never really have enough maglev trains.

I like maglev trains... and efficient healthcare ... and Wikipedia. :-)