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

Blank tape #71

Closed
sunwire opened this issue May 14, 2022 · 6 comments
Closed

Blank tape #71

sunwire opened this issue May 14, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@sunwire
Copy link
Contributor

sunwire commented May 14, 2022

I've tested the latest version (f5856d7) and it throws an error when an blank tape is in the drive.

Old behavior:

# stenc -f /dev/nst1 --detail
Status for /dev/nst1
--------------------------------------------------
Device Mfg:              HP      
Product ID:              Ultrium 4-SCSI  
Product Revision:        U64D
Drive Encryption:        off
Drive Output:            Not decrypting
                         Raw encrypted data not outputted
Drive Input:             Not encrypting
Key Instance Counter:    0

New old behavior:

# stenc -f /dev/nst1 --detail
Status for /dev/nst1
--------------------------------------------------
Vendor:                  HP      
Product ID:              Ultrium 4-SCSI  
Product Revision:        U64D
Drive Encryption:        off
Drive Output:            Not decrypting
                         Raw encrypted data not outputted
Drive Input:             Not encrypting
Key Instance Counter:    0
Sense Code:              Blank tape (0x08)
 ASC:                    0x14
 ASCQ:                   0x03
 Additional data:        0x00000000000000000000000000000000
@jmwilson
Copy link
Contributor

Can you try the cleanup branch on jmwilson/stenc? I'm unable to get a blank tape to trigger this sense code. The old code would ignore all errors in the next block encryption status query, so I added a media access check but my hardware will not report a blank tape.

@sunwire
Copy link
Contributor Author

sunwire commented May 15, 2022

Can you try the cleanup branch on jmwilson/stenc?

Still the same error, blank tape. But it fixes #72
If I add O_NONBLOCK flag to line

unique_fd fd {open(device.c_str(), O_RDONLY)};

it also fixes #12 (under Linux)

@jonasstein jonasstein added the bug Something isn't working label May 15, 2022
@jmwilson
Copy link
Contributor

This could be a drive firmware bug then. HP docs say this about the blank tape sense key:

If “blank media” is encountered during a space (in other words, the drive attempted to space on an unformatted tape), the drive behaves as if EOD was at BOM. It will then respond with GOOD status to a request to space to EOD, and with CHECK CONDITION to any other forward spacing request. Additional sense is set to 1403h (End of data not found).

Requesting status will not move the tape. The firmware might be incorrectly returning this code during the normal media access check when the next block encryption status page is processed. An erased tape returns Volume Encryption: Unable to determine on a HP LTO-6.

The old code simply ignored all errors from the next block encryption status query, but this probably not good in general. It sounds like the best idea to ignore BLANK CHECK sense key in this specific case.

@jmwilson
Copy link
Contributor

@sunwire I forced pushed the cleanup branch again with a check for the BLANK CHECK sense - can you see if this handles your situation?

@sunwire
Copy link
Contributor Author

sunwire commented May 16, 2022

can you see if this handles your situation?
Everything works!

@sunwire
Copy link
Contributor Author

sunwire commented Jun 5, 2022

Fixed

@sunwire sunwire closed this as completed Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants