Understanding SCSI Error Codes in Linux

This document (7006510) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Server 9

Situation

Under certain conditions, SCSI errors can be encountered in /var/log/messages. These messages can be informational, or indicate a problem with hardware and/or software. As these messages can be difficult to interpret, this TID is intended to be a brief guide to understanding and decoding these messages.

The following is a set of example SCSI errors that have been seen in /var/log/messages:

  kernel: sd 0:0:0:70: SCSI error: return code = 0x08000002
  kernel: sdb: Current: sense key: Aborted Command
  kernel:     Additional sense: Internal target failure
  ...
  kernel: sd 0:0:0:70: SCSI error: return code = 0x08070002
  kernel: sdb: Current: sense key: Aborted Command
  kernel:     Additional sense: Internal target failure

The actual return code and sense key data may be different from what is found in the above example. The root cause is specific to the actual error and sense key response being encountered.

Resolution

The SCSI return code in Linux is a 32bit number, which is made up of the following components:

  driver_byte <<24 | host_byte <<16 | msg_byte <<8 | status_byte

Possible codes in each of the above components can be found in the include/scsi/scsi.h file (found in the kernel-source RPM). Using this header file, it is possible to decode the two example SCSI errors as follows:

0x08000002:
    08 - DRIVER_SENSE (driver byte)
    00 - DID_OK (host byte)
    00 - COMMAND_COMPLETE (message byte)
    02 - SAM_STAT_CHECK_CONDITION (status byte)

0x08070002:
    08 - DRIVER_SENSE (driver byte)
    07 - DID_ERROR (host byte)
    00 - COMMAND_COMPLETE (message byte)
    02 - SAM_STAT_CHECK_CONDITION (status byte)

In the case of these two errors, the SCSI target returned a CHECK_CONDITION, which caused the driver to issue a REQUEST_SENSE back to the target automatically. (The REQUEST_SENSE command is used to obtain the current state and possible errors from a target device.) The target responded with the 'Aborted Command'  sense key, with 'Internal target failure' as the additional sense data. This failure caused a second instance of the SCSI error - only this time the DID_ERROR code was set. In response to the second automatic REQUEST_SENSE, the target again issue the same 'Aborted' and 'Internal failure' messages.

Depending on the version of the Linux kernel in use, the SENSE key response may an ASCII string, or a hexadecimal code. In the case of a hex response, further details may be found in scsi.h, or in drivers/scsi/constants.c.

In this particular case, the SCSI errors were being generated on the target side (EMC Symmetrix), and further diagnosis should be done on the SAN.

Additional Information

Additional information on common SCSI return codes can be found at:

     http://www.t10.org/lists/1spc-lst.htm

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7006510
  • Creation Date: 26-Jul-2010
  • Modified Date:03-Mar-2020
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback@suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center