Slackware 15.0: Fix for system crash caused by running "rescan-scsi-bus -r"
by jwoithe from LinuxQuestions.org on (#6MNZW)
Running "rescan-scsi-bus -r" on a Slackware 15 system will immediately crash the system except if root is on an NVMe device (and even then, most other disk devices will become inaccessible). Due to a change in the format of the output produced by the "sg_inq" command, rescan-scsi-bus treats every SCSI or SCSI-like disk as if they were no longer present. Therefore if the "-r" option is supplied, every disk will be removed from the system. For most people this will include the root filesystem. The end result is a system which can no longer access its own disks. A hard reset is the only way to recover.
The problem has been fixed upstream in the sg3_utils project. See https://github.com/doug-gilbert/sg3_utils/pull/10 for the details and the patch.
I believe it is appropriate to address this issue in Slackware 15. As things stand, almost anyone who runs rescan-scsi-bus with the "-r" option will immediately crash their system - a result that is almost certainly not expected or desired. Slackware 15 currently ships sg3_utils 1.47. Shifting to version 1.48 (which includes the patch) is probably not feasible because it will result in a shared library version change, which would then force the rebuilding of other packages (sdparm, udisks and so on). It may therefore be necessary to cherrypick the patch from the above pull request and apply it to sg3_utils 1.47. It applies cleanly.
The problem does not affect current because it already has sg3_utils 1.48.
The problem has been fixed upstream in the sg3_utils project. See https://github.com/doug-gilbert/sg3_utils/pull/10 for the details and the patch.
I believe it is appropriate to address this issue in Slackware 15. As things stand, almost anyone who runs rescan-scsi-bus with the "-r" option will immediately crash their system - a result that is almost certainly not expected or desired. Slackware 15 currently ships sg3_utils 1.47. Shifting to version 1.48 (which includes the patch) is probably not feasible because it will result in a shared library version change, which would then force the rebuilding of other packages (sdparm, udisks and so on). It may therefore be necessary to cherrypick the patch from the above pull request and apply it to sg3_utils 1.47. It applies cleanly.
The problem does not affect current because it already has sg3_utils 1.48.