Issues with HP P420i and SMART

ccg

New Member
Jan 13, 2022
4
0
1
42

ccg

New Member
Jan 13, 2022
4
0
1
42
After you run the script, what does `echo $?` show? If it's not 0, the GUI will not include the information it seems.

In my setup it now works as expected, showing drive details and SMART info. Your HP raid controller is in HBA mode, right?

Screenshot (pve and disk details are whitened)

1645907959082.png
 
Last edited:

t0mc@

Active Member
Nov 27, 2017
44
2
28
45
After you run the script, what does `echo $?` show? If it's not 0, the GUI will not include the information it seems.
As the last line you (and so me either) added to the script is "exit 0" it's not very surprising, "echo $?" shows "0" after running...


1645917915755.png


For me it looks like the script doesn't even start at all when called from the GUI...
 
Last edited:

t0mc@

Active Member
Nov 27, 2017
44
2
28
45
In my setup it now works as expected, showing drive details and SMART info. Your HP raid controller is in HBA mode, right?

Screenshot (pve and disk details are whitened)

View attachment 34651
Yes, its in HBA mode, otherwise ZFS would make problems as far as I know.

What I'm really wondering is the GUIs error message "Exec format error"... how can a Shell Script have an "exec format error"? And why doesn't it make any problems at cmdline but it does when called from the GUI?
 

t0mc@

Active Member
Nov 27, 2017
44
2
28
45
Finally I found the (stupid) solution...
While writing the 2 last posts I pushed myself in the right direction... somehow through copy-pasting the script there got two newlines right at the beginning, so the Shebang ("#!/bin/bash") wasn't at the very first position in the file where it has to be for correctly recognize the Shell to be used.
Simply deleting the newlines make things work.
Silly me :S ... sorry !
 

firworks

New Member
Mar 24, 2022
1
0
1
I'm trying to get this working as well. I've got the wrapper added and it functions correctly from the shell.

Code:
root@pve:~# smartctl -A /dev/sde
Running Wrapped smartctl
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.13.19-6-pve] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
Current Drive Temperature:     33 C
Drive Trip Temperature:        60 C

Accumulated power on time, hours:minutes 29253:57
Manufactured in week 09 of year 2015
Specified cycle count over device lifetime:  50000
Accumulated start-stop cycles:  26
Specified load-unload count over device lifetime:  600000
Accumulated load-unload cycles:  1077
Elements in grown defect list: 0
root@pve:~# echo $?
0

I added an echo to the start of the wrapper just so it's clear that the wrapped version is being run. Also I tested without it and it has no impact on the GUI functioning.

However the GUI still shows UNKNOWN and errors when you attempt to Show S.M.A.R.T. Values. I'm not sure what I'm missing. The specific error is Error getting S.M.A.R.T. data: Exit code: -1 (500).

I'm running on Proxmox 7.1-10. This specific server is a DL380G8 running the P420i in HBA mode. Also I'm clustered. I'm not sure if that could be having any impact here. Is there anywhere I can check a log or something to see maybe what specific command the GUI is trying to run that is failing? Also I have confirmed the permissions on the file look right, it does not have windows line endings in it and the shebang is at the top of the file.

EDIT:
I solved it. I went and looked up Diskmanage.pm in the PVE source repo and saw that it's using the full path /usr/sbin/smartctl to call the smart tools to populate the GUI. I put the patched version in /usr/bin/smartctl assuming that it would just be calling it as smartctl. Moving the patch to sbin instead of bin solved it and now my GUI is showing all of the SMART data.
 
Last edited:

joanandk

New Member
Apr 28, 2022
1
4
3
Hi,
I have created a script which should (in theory) work dynamically:

Bash:
#!/bin/bash
# ----------------------------------------------------------
# Wrapper for smartctl for supporting HP P212 HBA and USB
# Sandisk.
#
# Author: joanandk
# Created: Apr 28, 2022
# Modified:
# License: GNU Affero General Public License
# Inspired by: udo.rader@bestsolution.at
# ----------------------------------------------------------
# Instructions:
# Move the binary in /usr/sbin/smartctl to smartctl.orig
# create a script with this code and make it executable

SMARTCTL=/usr/sbin/smartctl.orig
# Get the block name:
OPTIONS=("$*")
TEMP=${OPTIONS#*/dev/}
[ -z "${TEMP}" ] && exit
PD_ADR="${TEMP:0:3}"

# Hack for disks connected to HP Smart Array:
SA_ID=$(lspci -D | grep "Smart Array" | cut -d\  -f1)
SA_PD=$(readlink /sys/class/block/$PD_ADR | grep $SA_ID)
if [ ! -z ${SA_ID} ] && [ ! -z ${SA_PD} ]; then
   PD_ALL=$(readlink /sys/block/sd* | grep $SA_ID | rev | cut -d/ -f1 | rev)
   INDEX=0
   for Search_PD in $PD_ALL; do
      if [ "${PD_ADR}" == "${Search_PD}" ]; then
         OPTIONS="-d cciss,${INDEX} ${OPTIONS}"
         break
      fi
      INDEX=$[$INDEX+1]
   done
fi

# Hack for USB pendrives:
USB_DEV=$(readlink /sys/class/block/$PD_ADR | grep usb | cut -d/ -f6)
if [ ! -z ${USB_DEV} ]; then
   OPTIONS="-d scsi ${OPTIONS}"
fi

exec $SMARTCTL ${OPTIONS}

This script should work on system with one Smart Array controller, disks do not have to be adjacent (so sda, sdc, sdg ... will work). If the assignment of sda -> 0, sdc->1, sdg->2 is correct has not been checked. It is extensible by an additional if clause for other hacks (USB is implemented as well). May be someone will have additional optimization for the script (the get block name can surely be done more elegantly).

BR
 

idanoo

Member
Apr 13, 2020
2
0
6
30
Thanks! That last one worked flawlessly on a DL360p G8 with P420i card in HBA mode
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!