From 896f9e4a059ec68e0c92a2fcda9f6c01b6da024d Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Thu, 25 Apr 2019 18:37:17 -0700 Subject: [PATCH] Explicitly define smartctl tolerance levels * Fixes issue #104 --- .bin/Scripts/functions/hw_diags.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.bin/Scripts/functions/hw_diags.py b/.bin/Scripts/functions/hw_diags.py index 4b018447..09226f49 100644 --- a/.bin/Scripts/functions/hw_diags.py +++ b/.bin/Scripts/functions/hw_diags.py @@ -84,7 +84,15 @@ class DiskObj(): self.get_size() # Try enabling SMART - run_program(['sudo', 'smartctl', '--smart=on', self.path], check=False) + run_program( + cmd=[ + 'sudo', + 'smartctl', + '--tolerance=permissive', + '--smart=on', + self.path, + ], + check=False) # Get NVMe/SMART data and set description self.get_smart_details() @@ -349,7 +357,14 @@ class DiskObj(): def get_smart_details(self): """Get data from smartctl.""" - cmd = ['sudo', 'smartctl', '--all', '--json', self.path] + cmd = [ + 'sudo', + 'smartctl', + '--tolerance=verypermissive', + '--all', + '--json', + self.path, + ] self.smartctl = get_json_from_command(cmd, check=False) # Check for attributes @@ -1514,7 +1529,13 @@ def run_smart_short_test(state, test): # Start short test print_standard('Running self-test...') - cmd = ['sudo', 'smartctl', '--test=short', dev.path] + cmd = [ + 'sudo', + 'smartctl', + '--tolerance=normal', + '--test=short', + dev.path, + ] run_program(cmd, check=False) # Monitor progress