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

UF2 BOOT drives fail to handle SMART requests appropriately #70

Open
dhalbert opened this issue Apr 16, 2019 · 6 comments
Open

UF2 BOOT drives fail to handle SMART requests appropriately #70

dhalbert opened this issue Apr 16, 2019 · 6 comments

Comments

@dhalbert
Copy link
Collaborator

See adafruit#50. Programs that make SMART requests to UF2 BOOT drives can cause the drive to lock up, not appear, etc. I'll look at this, but if one of you knows an obvious fix, let me know. Will PR any fixes back to you.

Extensive testing by @vitorio described in https://forums.adafruit.com/viewtopic.php?f=60&t=149791&p=743111#p743089. I also duplicated this finding. Example below. Note that the drive (or the driver?) is reporting SMART support is available.

$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
[...]
/dev/sdc            7934       513      7421   7% /media/halbert/CPLAYBOOT


$ smartctl --all -d scsi /dev/sdc
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.15.0-47-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               CPlay Ex
Product:              press
Revision:             1.00
User Capacity:        8,192,000 bytes [8.19 MB]
Logical block size:   512 bytes
scsiModePageOffset: response length too short, resp_len=4 offset=4 bd_len=0
Device type:          disk
scsiModePageOffset: response length too short, resp_len=4 offset=4 bd_len=0
Local Time is:        Tue Apr 16 09:09:16 2019 EDT
SMART support is:     Available - device has SMART capability.
SMART support is:     Enabled
Temperature Warning:  Disabled or Not Supported

=== START OF READ SMART DATA SECTION ===
^C^C^C^C
[hangs, killed process, which became a zombie, eventually timed out]
@dhalbert
Copy link
Collaborator Author

dhalbert commented Apr 16, 2019

smartmontools source available here:
https://github.com/mirror/smartmontools

Trying a few USB sticks. Most respond like this:

$ sudo smartctl --all -d scsi /dev/sdc
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.15.0-47-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               USB 2.0
Product:              USB Flash Drive
Revision:             1100
User Capacity:        4,057,989,120 bytes [4.05 GB]
Logical block size:   512 bytes
>> 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.

A high-quality Samsung stick I have does this:

$ sudo smartctl --all -d scsi /dev/sdc
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.15.0-47-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               Samsung
Product:              Flash Drive FIT
Revision:             1100
Compliance:           SPC-4
User Capacity:        32,086,425,600 bytes [32.0 GB]
Logical block size:   512 bytes
LU is fully provisioned
scsiModePageOffset: response length too short, resp_len=4 offset=4 bd_len=0
Logical Unit id:      0x00010200000608040x2020030102060804error: SCSI name string
Serial number:        AA00000000000489
Device type:          disk
scsiModePageOffset: response length too short, resp_len=4 offset=4 bd_len=0
Local Time is:        Tue Apr 16 09:47:19 2019 EDT
SMART support is:     Available - device has SMART capability.
SMART support is:     Disabled
Temperature Warning:  Disabled or Not Supported

=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK
Current Drive Temperature:     0 C
Drive Trip Temperature:        0 C

Error Counter logging not supported

scsiModePageOffset: response length too short, resp_len=4 offset=4 bd_len=0
Device does not support Self Test logging

@mmoskal
Copy link
Member

mmoskal commented Apr 16, 2019

Probably would be best to compare usb trace from the Beagle usb debugger from the cheap pendrive and CPX.

if these smart tools work on macos i can do that

@dhalbert
Copy link
Collaborator Author

@mmoskal I was just planning to do that, with the wireshark USB tracer. But if you have time to do this soon, and have the expertise in your group, I would leave it to you. We've seen a recent noticeable increase in the number of people who are hitting this problem.

@mmoskal
Copy link
Member

mmoskal commented Apr 16, 2019

Sorry, on macOS all I get is

$ sudo smartctl --all -d scsi disk2
smartctl 7.0 2018-12-30 r4883 [Darwin 18.5.0 x86_64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

disk2: Not a device of type 'scsi'
=======> VALID ARGUMENTS ARE: ata, scsi[+TYPE], nvme[,NSID], sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,p][,x][,N], usbprolific, usbsunplus, sntjmicron[,NSID], intelliprop,N[+TYPE], auto, test <=======

Use smartctl -h to get a usage summary


$ sudo smartctl --all  disk2
smartctl 7.0 2018-12-30 r4883 [Darwin 18.5.0 x86_64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

Smartctl open device: disk2 failed: Operation not supported by device

@vitorio
Copy link

vitorio commented Apr 16, 2019

Hi @mmoskal, looks like you're using a newer smartctl than we were!

The manpage for smartctl 7.0 says a couple things: first that SCSI support under Darwin isn't implemented, and second to get SMART data from USB drives you need to install a driver: https://github.com/kasbert/OS-X-SAT-SMART-Driver or https://github.com/RJVB/OS-X-SAT-SMART-Driver

Installing the former driver on OS X may alone result in your UF2 BOOT device failing to appear, since that was my experience. I haven't tried the latter driver. (And, of course, manually triggering SMART on Linux also made my UF2 BOOT device lock up, per the original post.)

@dhalbert
Copy link
Collaborator Author

I have a test bootloader that I've passed to @vitorio and another user. It acts more like most USB sticks and card readers, returning a malformed response to MODE SENSE for page 0x1c, which causes smartctl (and presumably other SMART-aware software) to give up trying to read SMART data. If it works for the users, I'll PR it.

mmoskal pushed a commit that referenced this issue Jun 23, 2019
Update config: accelerometer type in pybadge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants