I'm testing Squeeze and I encounter a problem, perhaps a bug : sata hotpluging works fine on Lenny but does'nt work on Squeeze.
We know hardware allow hotplug : it works on Lenny.
We know software allow hotplug : it works on Lenny.
For information, on Lenny or Squeeze, usb mass-storage hotplug works. It could be usefull to know: for usb hotplug Squeeze provide all necessary to manage hotplug, from hardware interrupt to file system mounting.
extract from my lspci concerning my Sata controller :
- Code: Select all
00:1f.2 SATA controller: Intel Corporation 82801FR/FRW (ICH6R/ICH6RW) SATA Controller (rev 03)
The BIOS show three modes for SATA support: IDE, AHCI and Raid, i'm using AHCI mode on Lenny, under Squeeze I've tested the others and it does'nt change anything.
In the past I've experienced similar problems with Lenny, some Lenny systems handle hotplug, and other don't. 'dpkg -l' output diffs showed me the presence of smartmontools packages on Lenny where hotplug was working. So I've identified that Smart is needed for sata hotplug, I don't know why, but is verified by experience. Under lenny I need smartmontools.
- Code: Select all
Debian linux-image smartmontools sata-hotplug
Lenny 2.6.26-21lenny4 - -
Lenny 2.6.26-21lenny4 5.38-2+lenny1 Works
Lenny 2.6.26-22lenny1 - -
Lenny 2.6.26-22lenny1 5.38-2+lenny1 Works
Lenny 2.6.26-24 - -
Lenny 2.6.26-24 5.38-2+lenny1 Works
Lenny 2.6.26-24lenny1 - -
Lenny 2.6.26-24lenny1 5.38-2+lenny1 Works
On Lenny I've noticied the presence (or not) of smartd in /usr/sbin to be the thing which does hotplug works or not. I don't need to have start_smartd=yes on /etc/default/smartmontools, I don't need /etc/default/smartmontools, I can also remove /usr/sbin/smartctl, smartd don't have to be running, but smartd must be in /usr/sbin.
On Lenny:
- Code: Select all
smartd-in-sbin-at-boot-time smartd-in-sbin-at-hotplug-time sata-hotplug
- - -
- Yes -
Yes Yes Works
Yes - Works
I don't know why smartd is needed for hotplug, it's undocumented. Manpages, readmes and other infos only speak about health monitoring.
For Squeeze, it's more complicated.
Without smartd, hotplug never works, we know it, but with smartd, hotplug sometimes works, most of the time does'nt work, it's unpredictable. After a reboot, it works, after another reboot, it doesn't works…
- Code: Select all
Debian linux-image smartmontools sata-hotplug
Squeeze 2.6.32-18 - -
Squeeze 2.6.32-18 5.39.1+svn3124-1 Sometime-works¹
¹Sometimes means very rarely !
I've noticed that smartmontools have libcap-ng0 as a new dependance on Squeeze,
- Code: Select all
Debian linux-image smartmontools libcap-ng0 sata-hotplug
Squeeze 2.6.32-18 - - -
Squeeze 2.6.32-18 - 0.6.4-1 -
Squeeze 2.6.32-18 5.39.1+svn3124-1 0.6.4-1 Sometime-works
Smartd is always the thing which do the difference.
Perhaps a collateral damages form a bug in libcap-ng0?
I've tested some frankeinstein experiments, installing Lenny kernel and Lenny Smartmontools under Squeeze, it does'nt change anything. Hotplug does'nt work anymore.
- Code: Select all
Debian linux-image smartmontools sata-hotplug
Squeeze 2.6.32-18 - -
Perhaps the bug is in Squeeze userland (and perhaps not in Squeeze libcap-ng0, because Lenny smartmontools does'nt need it and does'nt work on Squeeze). Like I've already shown the need of smartmontools (I can't explain why, it's a fact) perhaps there is another tool I doesn'nt know…
- Code: Select all
Debian linux-image smartmontools sata-hotplug
Squeeze 2.6.26+17+lenny1 5.38-2+lenny1 -
Also, I've tried to play with /sys !
- Code: Select all
echo "- - -" >/sys/class/scsi_host/host3/scan
It could detect new drive hot plugged, but once.
I insert first drive, I manualy scan, first disk is discovered
I insert second drive, I manualy scan, second disk isn't discovered.
Also with /sys scan, it does'nt detected hotunplug.
I've saw a strange thing: In case of fail when trying to detect hotplug using the /sys way, the drive is detected at shutdown time. It's too late, I don't need to have my drive at shutdown time, but at run time!
Il also tried to install somes power-management related tools, in case of one of them was needed, I've installed laptop task (which provides well-sounding packages names like acpi-support, acpi, acpid, apmd, pm-utils…), it does'nt change anything.
To debug, I know:
- Code: Select all
/var/log/syslog
/var/log/messages
/var/log/kern.log
dmesg
udevadm --debug monitor --kernel --udev --property
When hotplug works, I get verbose logs.
Under Lenny, during sata drive hot(un)plug I can read the following :
=== HotPlug ===
udevadm monitor :
- Code: Select all
UEVENT[1282554575.789002] add /devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0 (scsi)
UEVENT[1282554575.789220] add /class/scsi_disk/1:0:0:0 (scsi_disk)
UDEV [1282554575.811741] add /class/bdi/8:16 (bdi)
UEVENT[1282554575.811892] add /block/sdb/sdb1 (block)
UEVENT[1282554575.812001] add /block/sdb/sdb2 (block)
UEVENT[1282554575.812117] add /class/bdi/8:16 (bdi)
UEVENT[1282554575.812616] add /class/scsi_device/1:0:0:0 (scsi_device)
UEVENT[1282554575.812705] add /class/bsg/1:0:0:0 (bsg)
UDEV [1282554575.827441] add /devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0 (scsi)
UDEV [1282554575.828592] add /class/scsi_disk/1:0:0:0 (scsi_disk)
UDEV [1282554575.833661] add /class/bsg/1:0:0:0 (bsg)
UDEV [1282554575.839596] add /class/scsi_device/1:0:0:0 (scsi_device)
UDEV [1282554575.928786] add /block/sdb (block)
UDEV [1282554575.973361] add /block/sdb/sdb2 (block)
UDEV [1282554576.002254] add /block/sdb/sdb1 (block)
dmesg :
- Code: Select all
[ 237.071496] ata2: exception Emask 0x10 SAct 0x0 SErr 0x4050000 action 0xe frozen
[ 237.071666] ata2: irq_stat 0x00400040, connection status changed
[ 237.071810] ata2: SError: { PHYRdyChg CommWake DevExch }
[ 237.071960] ata2: hard resetting link
[ 242.834769] ata2: link is slow to respond, please be patient (ready=0)
[ 244.906742] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[ 244.909173] ata2.00: ATA-8: MAXTOR STM3500320AS, MX1A, max UDMA/133
[ 244.909173] ata2.00: 976773168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[ 244.936822] ata2.00: configured for UDMA/133
[ 244.936968] ata2: EH complete
[ 244.937223] scsi 1:0:0:0: Direct-Access ATA MAXTOR STM350032 MX1A PQ: 0 ANSI: 5
[ 244.937529] sd 1:0:0:0: [sdb] 976773168 512-byte hardware sectors (500108 MB)
[ 244.937692] sd 1:0:0:0: [sdb] Write Protect is off
[ 244.937832] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[ 244.937867] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 244.938105] sd 1:0:0:0: [sdb] 976773168 512-byte hardware sectors (500108 MB)
[ 244.938267] sd 1:0:0:0: [sdb] Write Protect is off
[ 244.938406] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[ 244.938441] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 244.938505] sdb: sdb1 sdb2
[ 244.963229] sd 1:0:0:0: [sdb] Attached SCSI disk
=== HotUnPlug ===
udevadm monitor :
- Code: Select all
UDEV [1282554740.633724] remove /class/bsg/1:0:0:0 (bsg)
UDEV [1282554740.633796] remove /class/scsi_device/1:0:0:0 (scsi_device)
UDEV [1282554740.633824] remove /class/scsi_disk/1:0:0:0 (scsi_disk)
UDEV [1282554740.633848] remove /class/bdi/8:16 (bdi)
UDEV [1282554740.633868] remove /block/sdb/sdb2 (block)
UDEV [1282554740.633886] remove /devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0 (scsi)
UDEV [1282554740.633903] remove /block/sdb/sdb1 (block)
UEVENT[1282554740.633921] remove /devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0 (scsi)
UDEV [1282554740.635766] remove /block/sdb (block)
dmesg :
- Code: Select all
[ 397.907968] ata2: exception Emask 0x10 SAct 0x0 SErr 0x10000 action 0xe frozen
[ 397.908139] ata2: irq_stat 0x00400000, PHY RDY changed
[ 397.908280] ata2: SError: { PHYRdyChg }
[ 397.908427] ata2: hard resetting link
[ 398.633045] ata2: SATA link down (SStatus 0 SControl 300)
[ 398.633195] ata2: failed to recover some devices, retrying in 5 secs
[ 403.639120] ata2: hard resetting link
[ 403.959153] ata2: SATA link down (SStatus 0 SControl 300)
[ 403.959305] ata2: failed to recover some devices, retrying in 5 secs
[ 408.963251] ata2: hard resetting link
[ 409.283723] ata2: SATA link down (SStatus 0 SControl 300)
[ 409.283870] ata2.00: disabled
[ 409.787746] ata2: EH complete
[ 409.787904] ata2.00: detaching (SCSI 1:0:0:0)
[ 409.788386] sd 1:0:0:0: [sdb] Synchronizing SCSI cache
[ 409.790493] sd 1:0:0:0: [sdb] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK,SUGGEST_OK
[ 409.790777] sd 1:0:0:0: [sdb] Stopping disk
[ 409.790927] sd 1:0:0:0: [sdb] START_STOP FAILED
[ 409.791065] sd 1:0:0:0: [sdb] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK,SUGGEST_OK
When hotplug does'nt work, I've nothing in logs, nowhere, I don't know what look for.
I play with 5 drives, I've tested different installs of Lenny and Squeeze on them with sames results.
Problem does'nt come from hard drive, nor sata controller, nor bios configuration, I think that it does'nt comes from hardware.
Problem comes from software, and is probably elsewhere than kernel and smartmontools. Perhaps it's about a thing I don't know (like previously the need of smartmontools), perhaps it's a bug and there is a cadaver in the next-stable wardrobe !
In bugs I've found bug 570821 which looks similar, but is'nt the same, the guy have something in dmesg, unlike me !
If it's a bug, I don't know where report it, udev, linux-image, smartd, other ?
(Sorry for my poor english speaking, french readers can find easier reading version on french forum).