Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ata_id failed get info for my external usb hdd #24921

Closed
Ratio2 opened this issue Oct 5, 2022 · 0 comments
Closed

Ata_id failed get info for my external usb hdd #24921

Ratio2 opened this issue Oct 5, 2022 · 0 comments
Labels
bug 🐛 Programming errors, that need preferential fixing udev

Comments

@Ratio2
Copy link
Contributor

Ratio2 commented Oct 5, 2022

systemd version the issue has been seen with

251

Used distribution

Armbian 22.08.1 Bullseye

Linux kernel version used

5.15.63-sunxi64

CPU architectures issue was seen on

aarch64

Component

udevadm

Expected behaviour you didn't see

$ sudo ata_id -x /dev/sda || echo $?
ID_ATA=1
ID_TYPE=disk
ID_BUS=ata
ID_MODEL=WDC_WD50NMZW-11BGRS1
ID_MODEL_ENC=WDC\x20WD50NMZW-11BGRS1\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_REVISION=01.01A01
ID_SERIAL=WDC_WD50NMZW-11BGRS1_WD-WX62D81PKZTZ
ID_SERIAL_SHORT=WD-WX62D81PKZTZ
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_FEATURE_SET_SECURITY=1
ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=66442
ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=66442
ID_ATA_FEATURE_SET_SMART=1
ID_ATA_FEATURE_SET_SMART_ENABLED=1
ID_ATA_FEATURE_SET_PUIS=1
ID_ATA_FEATURE_SET_PUIS_ENABLED=0
ID_ATA_FEATURE_SET_APM=1
ID_ATA_FEATURE_SET_APM_ENABLED=1
ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=254
ID_ATA_DOWNLOAD_MICROCODE=1
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_SATA_SIGNAL_RATE_GEN1=1
ID_ATA_ROTATION_RATE_RPM=5400
ID_WWN=0x50014ee269fc2b36
ID_WWN_WITH_EXTENSION=0x50014ee269fc2b36

Unexpected behaviour you saw

$ sudo /lib/udev/ata_id -x /dev/sda || echo $?
2

Steps to reproduce the problem

if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c) &&

The ata_id program parses the response code incorrectly. It is necessary to take only 7 bits out of 8.

Proofs:

  1. https://salsa.debian.org/linux-blocks-team/sg3-utils/-/blob/master/lib/sg_lib.c#L1777
  2. https://www.stix.id.au/wiki/SCSI_Sense_Data
  3. https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf

This further leads to head parking and spindle time management issues in Debian.

Additional program output to the terminal or log subsystem illustrating the issue

Hdparm also parses the response code incorrectly(SG_IO: bad/missing sense data, sb[]:), but the options are set successfully.

$ sudo hdparm -B254 --verbose /dev/sda

/dev/sda:
APT: USB ID = 0x1058:0x2667 (0x2007)
APT: Unsupported device
 setting Advanced Power Management level to 0xfe (254)
outgoing cdb:  85 06 20 00 05 00 fe 00 00 00 00 00 00 40 ef 00
SG_IO: ATA_16 status=0x2, host_status=0x0, driver_status=0x8
SG_IO: sb[]:  f0 00 01 00 50 40 fe 0a 80 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: bad/missing sense data, sb[]:  f0 00 01 00 50 40 fe 0a 80 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: desc[]:  80 00
      ATA_16 stat=00 err=00 nsect=1d lbal=00 lbam=00 lbah=00 dev=00
outgoing cdb:  85 08 0e 00 00 00 01 00 00 00 00 00 00 40 ec 00
SG_IO: ATA_16 status=0x0, host_status=0x0, driver_status=0x0
SG_IO: sb[]:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
incoming_data:  7a 42 ff 3f 37 c8 10 00 00 00 00 00 3f 00 00 00 00 00 00 00 20 20 20 20 57 20 2d 44 58 57 32 36 38 44 50 31 5a 4b 5a 54 00 00 00 00 00 00 31 30 30 2e 41 31 31 30 44 57 20 43 44 57 30 35 4d 4e 57 5a 31 2d 42 31 52 47 31 53 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 10 80 00 40 00 2f 01 40 00 00 00 00 06 00 ff 3f 10 00 3f 00 10 fc fb 00 00 01 ff ff ff 0f 00 00 07 01 03 00 78 00 78 00 78 00 78 00 00 4d 00 00 00 00 00 00 00 00 00 00 1f 00 0e 9d 06 00 44 00 00 00 fe 07 6d 00 6b 70 69 74 23 61 69 70 49 b4 23 61 7f 00 c5 81 c5 81 fe 00 fe ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0 d9 2f 46 02 00 00 00 00 00 ff 00 03 60 00 00 01 50 e2 4e fc 69 36 2b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 40 18 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 60 81 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b5 30 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 15 00 00 00 00 00 00 00 00 7e 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a5 4c
SG_IO: desc[]:  00 00
      ATA_16 stat=00 err=00 nsect=00 lbal=00 lbam=00 lbah=00 dev=00
 APM_level	= 254

$ sudo hdparm -S60 --verbose /dev/sda

/dev/sda:
APT: USB ID = 0x1058:0x2667 (0x2007)
APT: Unsupported device
 setting standby to 60 (5 minutes)
outgoing cdb:  85 06 20 00 00 00 3c 00 00 00 00 00 00 40 e3 00
SG_IO: ATA_16 status=0x2, host_status=0x0, driver_status=0x8
SG_IO: sb[]:  f0 00 01 00 50 40 3c 0a 80 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: bad/missing sense data, sb[]:  f0 00 01 00 50 40 3c 0a 80 00 00 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: desc[]:  80 00
      ATA_16 stat=00 err=00 nsect=1d lbal=00 lbam=00 lbah=00 dev=00
@Ratio2 Ratio2 added the bug 🐛 Programming errors, that need preferential fixing label Oct 5, 2022
@github-actions github-actions bot added the udev label Oct 5, 2022
Ratio2 added a commit to Ratio2/systemd that referenced this issue Oct 5, 2022
The Response Code is contained in the first byte of the SCSI Sense Data.
Bit number 7 is reserved or has a different meaning for some Response Codes
and is set to 1 for some drives.
yuwata pushed a commit that referenced this issue Oct 6, 2022
The Response Code is contained in the first byte of the SCSI Sense Data.
Bit number 7 is reserved or has a different meaning for some Response Codes
and is set to 1 for some drives.
@Ratio2 Ratio2 closed this as completed Oct 6, 2022
yuwata added a commit to yuwata/systemd that referenced this issue Oct 30, 2022
Previously, ata_id might not be able to retrieve attributes correctly,
and properties from usb_id were used as a fallback. See issue systemd#24921
and PR systemd#24923. To keep backward compatibility, still we need to create
symlinks based on USB serial.

Fixes systemd#25179.
bluca pushed a commit that referenced this issue Oct 30, 2022
Previously, ata_id might not be able to retrieve attributes correctly,
and properties from usb_id were used as a fallback. See issue #24921
and PR #24923. To keep backward compatibility, still we need to create
symlinks based on USB serial.

Fixes #25179.
bluca pushed a commit to bluca/systemd that referenced this issue Jan 27, 2023
Previously, ata_id might not be able to retrieve attributes correctly,
and properties from usb_id were used as a fallback. See issue systemd#24921
and PR systemd#24923. To keep backward compatibility, still we need to create
symlinks based on USB serial.

Fixes systemd#25179.

(cherry picked from commit 479da11)
(cherry picked from commit b61fcac)
mikhailnov pushed a commit to mikhailnov/systemd that referenced this issue Jun 2, 2023
Previously, ata_id might not be able to retrieve attributes correctly,
and properties from usb_id were used as a fallback. See issue systemd#24921
and PR systemd#24923. To keep backward compatibility, still we need to create
symlinks based on USB serial.

Fixes systemd#25179.
valentindavid pushed a commit to valentindavid/systemd that referenced this issue Aug 8, 2023
The Response Code is contained in the first byte of the SCSI Sense Data.
Bit number 7 is reserved or has a different meaning for some Response Codes
and is set to 1 for some drives.

(cherry picked from commit 2be1ae5)
valentindavid pushed a commit to valentindavid/systemd that referenced this issue Aug 8, 2023
Previously, ata_id might not be able to retrieve attributes correctly,
and properties from usb_id were used as a fallback. See issue systemd#24921
and PR systemd#24923. To keep backward compatibility, still we need to create
symlinks based on USB serial.

Fixes systemd#25179.

(cherry picked from commit 479da11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Programming errors, that need preferential fixing udev
Development

No branches or pull requests

1 participant