Package: hdparm Version: 9.53+ds-1 Severity: normal Tags: patch hdparm tries to configure APM on every (non-USB/non-firewire) disk in the system without first checking if APM is supported. This *should* be OK, since hdparm fails gracefully in this case. However, sending APM commands to disks that don't support it can have side-effects. I received a report that this was causing bus resets on a Cavium Sabre system with the disk below that would sometimes escalate to a boot failure.
It seems safer to just avoid sending APM command to disks when they don't advertise support for it - see attached patch. # hdparm -i /dev/sdj /dev/sdj: Model=SDLFOCAM-800G-1HA1, FwRev=ZZ37RE92, SerialNo=0006C7CE Config={ NotMFM DTR>5Mbs RotSpdTol>.5% dStbOff FmtGapReq } RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=50 BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=off CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1562824368 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120} PIO modes: pio0 pio3 pio4 DMA modes: mdma0 mdma1 mdma2 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 AdvancedPM=no WriteCache=enabled Drive conforms to: unknown: ATA/ATAPI-1,2,3,4,5,6,7 * signifies the current active mode # hdparm -B 254 /dev/sdj /dev/sdj: setting Advanced Power Management level to 0xfe (254) SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 04 53 40 fe 21 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 APM_level = not supported -- System Information: Debian Release: buster/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 4.15.0-rc8-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages hdparm depends on: ii libc6 2.26-6 ii lsb-base 9.20170808 Versions of packages hdparm recommends: ii powermgmt-base 1.31+nmu1 Versions of packages hdparm suggests: pn apmd <none> -- no debconf information
diff -urpN hdparm-9.53+ds.orig/debian/hdparm-functions hdparm-9.53+ds/debian/hdparm-functions --- hdparm-9.53+ds.orig/debian/hdparm-functions 2018-01-06 05:37:12.000000000 -0700 +++ hdparm-9.53+ds/debian/hdparm-functions 2018-02-21 15:23:49.516224316 -0700 @@ -56,7 +56,15 @@ hdparm_try_apm() return 1 ;; esac - return 0 + + # Only activate APM on disks that support it. + if [ -z "$ID_ATA_FEATURE_SET_APM" ]; then + local ID_ATA_FEATURE_SET_APM="$(udevadm info -n "$1" -q property 2>/dev/null | sed -n 's/^ID_ATA_FEATURE_SET_APM=//p')" || true + fi + if [ "$ID_ATA_FEATURE_SET_APM" = "1" ]; then + return 0 + fi + return 1 } # parse /etc/hdparm.conf and spit out a list of options for the specified