Chad Granum's blog

disable ide for linux install on a newer (sata) laptop.

November 8, 2008

I encountered an interesting issue when re-installing Gentoo on my personal laptop this evening. Previous gentoo install disks did not have this issue, however 2008.0 did. The issue is that my laptop has an intel sata controller that can also be identified w/ limited functionality as a pata controller.

The problem

The issue w/ using this sata controller as a pata controller is that dma cannot be enabled. This results in unbearable slowdowns whenever the hard drive or cdrom are accessed. Trying to format hda1, a 200mb partition with reiserfs was taking several minutes, normally it only takes a second or two. As well when the format was runing, the console would update slowly with a clearly visible refresh every time new text was displayed.

Obviously trying to copy the files needed to install any distro in such a situation would be painful. This is made far more painful when you are installing gentoo, which compiles the entire operating system from source. Clearly I needed to find a way to disable IDE support on bootup.

Searching for the solution

Gentoo provides some of the best documentation I have ever seen regarding installation. The install cd in fact allows you to see several bootup options at the boot prompt. Among these options were noload=[module] and nosata. However I was unable to find any options for IDE.

I figured I could boot the cd, unmount it (using the docache boot option in gentoo allows this), unload the ide drivers, and re-load the sata drivers. The problem with this however is that the ide drivers were not loaded as a module, they were built into the kernel.

Next I tried to check the kernel configuration for any help. I have been compiling my own kernel on linux since day 1 (some time in 1997, on slackware linux, back when it took an hour to do.) In the past I have noticed useful kernel boot options listed in the module help provided by the kernel config utils. I checked the IDE overall driver and the ATA generic driver, the latter reffered me to the Documentation/ide/ide.txt documentation, and here is where I found my solution.

The solution

The kernel documentation on IDE options at kernel boot is quite complete. It only took a minute of skimming the doc to decide upon the following boot prompt command:

boot: gentoo hda=none hdb=none hdc=none hdd=none ide0=0x168,0x36e,10

In detail:

  1. hd[a-c]=none: This tells the ide driver that there is no device attached to the ide controller for hdX. It also supressing probing for devices, and overrides anything the bios might have to say.
  2. ide0=[...]: This tells the ide driver what ports and irq to look for the first ide controller at. The information I specified is actually the default for ide3, not ide0. This will prevent the driver from finding the ide controller at all.

When I booted w/ this set of options, the ide driver found no controller or drives. Next when the sata driver loaded, the controller and drivers were found using the preferred driver. My format and installation ran w/o any slowdowns.

Local only postfix for testing.

September 9, 2008

Today Jonathan asked me about configuring his system to pretend to be an email server.
The goals of this task were:

  • Software under development would be able to use the local mail utilities, or use localhost as an smtp without any modifications
  • Email sent via these programs would all be delivered to a static location instead of the destination address, to be read at another time
  • No email would be relayed out to spam anyone else.

I have configured local email for development in the past, which is why Jonathan came to me with this. Immediately I decided to use postfix because it is easy to configure and use. Initially I looked at address masquerading or rewriting, but these solutions were overcomplicated and did not appear to solve all the problems.

Eventually I found a site explaining how to disable local delivery (the opposite of what we needed). The way to disable the local delivery was to comment out the 'local' configuration option in /etc/postfix/master.cf. Looking at the file it was clear that it mapped source to destination.

smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
local     unix  -       n       n       -       -       local

The idea was simple, map 'smtp' and 'relay' to 'local'
smtp      unix  -       -       -       -       -       local
relay     unix  -       -       -       -       -       local
local     unix  -       n       n       -       -       local

The results were exactly as desired. No email is delivered to the outside world, and all email is placed in /var/spool/postfix/active. According to Jonathan, his applications run seamlessly, completely unaware of this.