Difference between revisions of "Problems with SATA and Linux"

From ThinkWiki
Jump to: navigation, search
(Hang on resume from suspend to RAM)
(Hang on resume from suspend to RAM)
Line 13: Line 13:
 
==Hang on resume from suspend to RAM==
 
==Hang on resume from suspend to RAM==
  
Linux kernels (as of 2.6.14-rc2) do not support suspend and resume for SATA devices. As a result, the machine hangs upon the first disk access after resume. A kernel patch is available (see the [[How to make ACPI work#Suspend to RAM (Sleep)|Suspend to RAM section]] of the [[How to make ACPI work|ACPI HOWTO]]).
+
Linux kernels (as of 2.6.14-rc2) do not support suspend and resume for SATA devices. As a result, the machine hangs upon the first disk access after resume. A kernel patch [http://marc.theaimsgroup.com/?l=linux-kernel&m=111504542402455&w=2 LKML posting]) is available that provides SATA power-management support and makes Suspend to RAM work on the {{T43}} and {{X41}} at least. (Tested on 2.6.12rc6 which the patch applies to with some offsets. (On the {{T43p}} the patch has not been tested so far but should work as well. The {{R52}} uses SATA and sleep doesn't work, so it is probably affected too.)
  
Some distributions already include this patch (e.g., Ubuntu), but some don't (e.g., Fedora Core 4).
+
===Patches===
 +
* [http://shamrock.dyndns.org/~ln/linux/sata_pm.2.6.12.diff 2.6.12 patch]
 +
* [http://shamrock.dyndns.org/~ln/linux/sata_pm.2.6.13-rc5.diff 2.6.13-rc5 patch]
 +
* [http://lkml.org/lkml/2005/9/23/97 Post on how to patch later (2.6.14-rc) kernels]
 +
 
 +
Some distributions already include this patch (e.g., {{Ubuntu}} Breezy), but some don't (e.g., {{Fedora}} 4).
  
 
==Failed resume from suspend to disk==
 
==Failed resume from suspend to disk==

Revision as of 00:23, 28 September 2005

Some ThinkPad models, use a SATA controller for the system hard disk (the hard disk itself is PATA, but is accessed through a SATA-to-PATA bridge). This causes several complications for Linux installation. The following lists these problems and some workarounds.

This page deals with SATA-related issues one may encounter when runing Linux on these ThinkPad models. Note that the details are often version- and distribution-specific.

Models using a SATA disk interface

SATA controller with IDE disk (PATA passthrough)

SATA controller with SATA disk

Hang on resume from suspend to RAM

Linux kernels (as of 2.6.14-rc2) do not support suspend and resume for SATA devices. As a result, the machine hangs upon the first disk access after resume. A kernel patch LKML posting) is available that provides SATA power-management support and makes Suspend to RAM work on the T43 and X41 at least. (Tested on 2.6.12rc6 which the patch applies to with some offsets. (On the T43p the patch has not been tested so far but should work as well. The R52 uses SATA and sleep doesn't work, so it is probably affected too.)

Patches

Some distributions already include this patch (e.g., Ubuntu Breezy), but some don't (e.g., Fedora 4).

Failed resume from suspend to disk

Suspend to disk (using swsusp or swsusp2) needs to load the memory image from the SATA disk. For this to work, you either need an initrd with all the necessary SATA modules, or the SATA drivers compiled into the kernel.

DVD drive not recognized

The ata_piix SATA driver grabs ownership over the IDE ports when it is loaded, but (by default) does not support PATA ATAPI devices such as the Ultrabay optical drives. Thus, if IDE support is compiled as a module and loaded after ata_piix, the DVD drive will not be recognized by either driver.

The following configurations do work:

  • Compile IDE into the kernel (non-module)
  • Compile both IDE and SATA as modules and make sure IDE is loaded first
  • Enable PATA ATAPI support in the SATA system (experimental; see below).

Note that the optical drive must be in the Ultrabay during system boot (Ultrabay device swapping is currently unsupported).

No DMA on DVD drive

Using the IDE driver, DMA support cannot be enabled on an Ultrabay optical drive:

# hdparm -d1 /dev/hdc

/dev/hdc:
 setting using_dma to 1 (on)
 HDIO_SET_DMA failed: Operation not permitted
 using_dma    =  0 (off)

As a result, the optical drive is slow, and in particular, too slow to play video DVDs.

One workaround is to use employ the SATA driver (instead of the IDE driver) for the optical drive. This requires enabling two featues of the SATA driver, namely ATAPI support and PATA support, which are both in active development and far from stable. Using this will probably devour all your data and go on to eat all the food in your fridge. But if you have full backups and an empty fridge, do the following:

  • Grab the latest kernel, since these feature are under active development (these instructions where tested with 2.6.14-rc2).
  • Configure the IDE system as modules, to get it out of the way (maybe it can be completely removed).
  • Configure the SATA system (and in particular the ata_piix driver) as built-in.
  • In include/linux/libata.h, set
#define ATA_ENABLE_PATA
  • In drivers/scsi/libata-core.c, set
int atapi_enabled = 1

(An untested alternative to the last step is to compile the SATA system as modules, make sure it is loaded before the IDE modules, and pass the "atapi_enabled=1" module parameter.)

There have been reports that DVD burning doesn't work under this configuration, but it seems to work with kernel 2.6.14-rc2 (tested on a ThinkPad T43 with a UltraBay Slim DVD Multi-Burner Plus).

NOTE!
If you are aware of a more reliable solution to this issue, please update this page.

No SMART support

The Linux SATA system currently does not support SMART commands (e.g., via smartctl). This is under development.

A patch is available:

After applying the patch, run smartctl with the "-d ata" parameter:

# smartctl -d ata -a /dev/sda

(Tested on ThinkPad T43 with kernel 2.6.13.1.)

No disk power management

The Linux SATA system currently does not support power management commands. This is under development.

Note: the above patch for SMART support also enables the "hdparm -y" command (spin down). However, the "hdparm -S" command (automatic spin down timeout) seems to be accepted but ignored, and the "hdparm -M" command (acoustic management) is still rejected.

(Tested with patched kernel 2.6.13.1 on ThinkPad T43 with the 60GB 7200RPM disk, model HTS726060M9AT00.)

No disk information

With mainline kernels (as of 2.6.14-rc2), the disk information cannot be read via either of:

# hdparm -i /dev/sda # hdparm -I /dev/sda

The latter is fixed by the above patch for SMART support.

BIOS error 2010 on user-installed hard disk

While not a Linux issue, note that there is an issue with installing alternative PATA (IDE) hard disks as the system drive. Unless the disk is one of the few approved disks listed inside the BIOS, you will get an BIOS error 2010 during system boot, and the disk may operate unreliably. This seems to be enforced due to limitations (bugs?) of the SATA-to-PATA bridge, and currently the only reliably way to avoid it seems to be to use only drives sold by IBM specifically for use in these ThinkPad models.

There are no such limitations for disks used in the UltraBay Slim 2nd Hard Drive Adapter.