#1467 closed defect (fixed)
Autodetection under OpenBSD assumes full SCSI for sd-Devices
Reported by: | Martin Ziemer | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | Release 7.3 |
Component: | all | Version: | |
Keywords: | openbsd | Cc: |
Description
Under OpenBSD not only SCSI devices, but also sata devices have names like /dev/sd0.
When autodetectiong such a device, smartmontools uses the full scsi commandset instead of only sat commands.
One way to fix this would be to change line 592 in os_openbsd.cpp to something like this:
return new openbsd_scsi_device(this, name, "", true /*scanning*/);
Change History (10)
comment:1 by , 4 years ago
Keywords: | openbsd added; OpenBSD removed |
---|---|
Milestone: | → undecided |
comment:2 by , 4 years ago
The command was just smartctl -a /dev/sd0c.
I dont know, how to see the scsi-command, which was issued.
I found the solution by reproducing the behaviour of smartmontools 7.1, where the sat-flag was given.
In the daemon-process it is detected correctly. Also there are no Problems, if i add "-d sat" to the commandline.
comment:3 by , 4 years ago
To complete the Bug-Desription Command and output as copy/pasta:
(126) horrad@dozer:/usr/ports/sysutils/smartmontools $ doas /usr/obj/ports/smartmontools-7.2/build-amd64/smartctl -a /dev/sd0c smartctl 7.2 2020-12-30 r5155 [OpenBSD 6.9 amd64] (local build) Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org User Capacity: 2,000,398,934,016 bytes [2.00 TB] Logical block size: 512 bytes Physical block size: 4096 bytes LB provisioning type: not reported [LBPME=1, LBPRZ=0] Form Factor: 2.5 inches >> Terminate command early due to bad response to IEC mode page A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.
comment:4 by , 4 years ago
Needs to be further investigated by an OpenBSD expert. Leaving open as undecided for now.
follow-up: 8 comment:6 by , 4 years ago
Ok, was able to reproduce it in vbox, using virtual ahci controller and OpenBSD 6.8.
Please try this patch:
-
os_openbsd.cpp
588 588 // XXX get USB vendor ID, product ID and version from sd(4)/umass(4). 589 589 // XXX check sat device via get_usb_dev_type_by_id(). 590 590 591 // No USB bridge found, assume regular SCSI device592 return get_scsi_device(name, " scsi");591 // No USB bridge found, assume regular SCSI or SAT device 592 return get_scsi_device(name, ""); 593 593 } 594 594 if (!strncmp(net_dev_scsi_tape, test_name, strlen(net_dev_scsi_tape))) 595 595 return get_scsi_device(name, "scsi");
And let me know if it works for you.
TODO: check if same apply to netbsd which is based on the same code logic.
comment:7 by , 4 years ago
P.S. had a quick look on the kernel to see if its easy/possible to get usb device detection attached to scsi and seems that this information is not exported to userland. I would recommend to request that from OpenBSD folks if you want to have this in smartmontools.
comment:8 by , 4 years ago
Replying to Alex Samorukov:
Ok, was able to reproduce it in vbox, using virtual ahci controller and OpenBSD 6.8.
Please try this patch:
os_openbsd.cpp
588 588 // XXX get USB vendor ID, product ID and version from sd(4)/umass(4). 589 589 // XXX check sat device via get_usb_dev_type_by_id(). 590 590 591 // No USB bridge found, assume regular SCSI device592 return get_scsi_device(name, " scsi");591 // No USB bridge found, assume regular SCSI or SAT device 592 return get_scsi_device(name, ""); 593 593 } 594 594 if (!strncmp(net_dev_scsi_tape, test_name, strlen(net_dev_scsi_tape))) 595 595 return get_scsi_device(name, "scsi"); And let me know if it works for you.
TODO: check if same apply to netbsd which is based on the same code logic.
This patch works for me.
BUT i have only sata and USB disks to test at hand. -- So i dont know, of it breaks real scsi disks!
comment:9 by , 4 years ago
Thank you for testing. It should not break real scsi. There is a way to be even more strict and do SAT check ONLY when sc_bus != SCSI, but i think it is overkill + device is not yet open when we doing return get_scsi_device
. Also checked with netbsd - it should not be relevant as NetBSD always adds AHCI devices as wd* and not sd*. We also doing sat check by default on Linux/FreeBSD, so that should not harm.
comment:10 by , 4 years ago
Milestone: | undecided → Release 7.3 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Should be fixed in r5215
Which smartctl command is used?
Which SCSI commands are erroneously issued?
Is SAT detected later or not?
The
scanning
flag should only set duringsmartctl --scan
or smartd.confDEVICESCAN
. The autodetect code in os_openbsd.cpp may need some rework.