Issues with HP P420i and SMART

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:
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:
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?
 
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 !
 
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:
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
 
To all who might find it useful, I had a PVE use-case where there are actually two smart array controllers with disks attached. A quick modification to @joanandk 's script by forcing the output of SA_ID into an array and iterating through it appeared to fix that issue for me.

Bash:
#!/bin/bash
# ----------------------------------------------------------
# Wrapper for smartctl for supporting HP P2XX/P4XX/P8XX HBA's and USB
# Sandisk.
#
# Author: lclements0
# Created: Apr 28, 2022 by joanandk
# Modified: June 8, 2022 by lclements0
# 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))
if [ ! -z ${SA_ID} ]; then
        for i in "${SA_ID[@]}"; do
        SA_PD=$(readlink /sys/class/block/$PD_ADR | grep $i)
                if [ ! -z ${SA_PD} ]; then
                   PD_ALL=$(readlink /sys/block/sd* | grep $i | 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 2
                      fi
                      INDEX=$[$INDEX+1]
                   done
                fi
        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}
 
anyone know/tried if mail alert works with the wrapper ?

edit: it's not. created a crontab job like this
 
Last edited:
Thank you everyone. Worked perfectly for me and my HP SmartArray H240 in HBA Mode.

Here's what I did:

mv /usr/sbin/smartctl /usr/sbin/smartctl.orig

nano /usr/sbin/smartctl

I put the latest version of the script by @lclements0 in there and saved. I didn't change anything.

chmod 755 /usr/sbin/smartctl

Go to your pve node -> Disks -> Reload
and now you should see SMART results for all those drives.

Thanks again!!
 
Hi, this problem is solved in smartmontools 7.3, which is available in Debian testing, but the .deb package can't be installed in proxmox due dependencies versions.

https://github.com/smartmontools/smartmontools/releases/tag/RELEASE_7_3

1685556281681.png

So I compiled and installed it from sources.

Following are the steps for Proxmox 7.4

Code:
# install required packages for build
root@pve:~# apt install build-essential libsystemd-dev libselinux-dev libcap-ng-dev

# get sources
root@pve:~# wget https://github.com/smartmontools/smartmontools/releases/download/RELEASE_7_3/smartmontools-7.3.tar.gz
root@pve:~# tar zxvf smartmontools-7.3.tar.gz
root@pve:~# cd smartmontools-7.3/

# configure, use configuration params from current smartctl, you can get them running smartctl --version
root@pve:~/smartmontools-7.3# ./configure '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--localstatedir=/var' '--disable-option-checking' '--disable-silent-rules' '--libdir=${prefix}/lib/x86_64-linux-gnu' '--runstatedir=/run' '--disable-maintainer-mode' '--disable-dependency-tracking' '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sysconfdir=/etc' '--mandir=/usr/share/man' '--with-initscriptdir=no' '--docdir=/usr/share/doc/smartmontools' '--with-attributelog=/var/lib/smartmontools/attrlog.' '--with-drivedbdir=/var/lib/smartmontools/drivedb' '--with-exampledir=/usr/share/doc/smartmontools/examples/' '--with-savestates=/var/lib/smartmontools/smartd.' '--with-smartdplugindir=/etc/smartmontools/smartd_warning.d' '--with-smartdscriptdir=/usr/share/smartmontools' '--with-systemdenvfile=/etc/default/smartmontools' '--with-systemdsystemunitdir=/lib/systemd/system' '--with-libsystemd=auto' '--with-selinux' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fsigned-char -Wall' 'LDFLAGS=-Wl,-z,relro -Wl,-z,now' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fsigned-char -Wall'

# build
root@pve:~/smartmontools-7.3# make

# check if new version works as expected
root@pve:~/smartmontools-7.3# ./smartctl --version
root@pve:~/smartmontools-7.3# ./smartctl -a /dev/sda

# if it works, install it over current version
root@pve:~/smartmontools-7.3# make install

# restart smartd service
root@pve:~/smartmontools-7.3# systemctl restart smartmontools.service

Now proxmox GUI and email notifications works as expected.
 
Last edited:
  • Like
Reactions: johnyb0y
Oddly, this is still an issue for me on a ProLiant DL380p Gen8, with a brand new install of Proxmox 8.0.3, with smartmontools 7.3-pve1:

1688409774857.png

Code:
root@pve:~# pveversion -v
proxmox-ve: 8.0.1 (running kernel: 6.2.16-3-pve)
pve-manager: 8.0.3 (running version: 8.0.3/bbf3993334bfa916)
pve-kernel-6.2: 8.0.2
pve-kernel-6.2.16-3-pve: 6.2.16-3
ceph-fuse: 17.2.6-pve1+3
corosync: 3.1.7-pve3
criu: 3.17.1-2
glusterfs-client: 10.3-5
ifupdown2: 3.2.0-1+pmx3
ksm-control-daemon: 1.4-1
libjs-extjs: 7.0.0-3
libknet1: 1.25-pve1
libproxmox-acme-perl: 1.4.6
libproxmox-backup-qemu0: 1.4.0
libproxmox-rs-perl: 0.3.0
libpve-access-control: 8.0.3
libpve-apiclient-perl: 3.3.1
libpve-common-perl: 8.0.5
libpve-guest-common-perl: 5.0.3
libpve-http-server-perl: 5.0.3
libpve-rs-perl: 0.8.3
libpve-storage-perl: 8.0.2
libspice-server1: 0.15.1-1
lvm2: 2.03.16-2
lxc-pve: 5.0.2-4
lxcfs: 5.0.3-pve3
novnc-pve: 1.4.0-2
proxmox-backup-client: 3.0.1-1
proxmox-backup-file-restore: 3.0.1-1
proxmox-kernel-helper: 8.0.2
proxmox-mail-forward: 0.2.0
proxmox-mini-journalreader: 1.4.0
proxmox-widget-toolkit: 4.0.5
pve-cluster: 8.0.1
pve-container: 5.0.4
pve-docs: 8.0.4
pve-edk2-firmware: 3.20230228-4
pve-firewall: 5.0.2
pve-firmware: 3.7-1
pve-ha-manager: 4.0.2
pve-i18n: 3.0.4
pve-qemu-kvm: 8.0.2-3
pve-xtermjs: 4.16.0-3
qemu-server: 8.0.6
smartmontools: 7.3-pve1
spiceterm: 3.3.0
swtpm: 0.8.0+pve1
vncterm: 1.8.0
zfsutils-linux: 2.1.12-pve1
root@pve:~#

Code:
root@pve:~# smartctl -H -A -f brief /dev/sda
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.2.16-3-pve] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

/dev/sda: requires option '-d cciss,N'
Please specify device type with the -d option.

Use smartctl -h to get a usage summary

root@pve:~#

Code:
root@pve:~# smartctl -H -A -d cciss,0 -f brief /dev/sda
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.2.16-3-pve] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Status not supported: Incomplete response, ATA output registers missing
SMART overall-health self-assessment test result: PASSED
Warning: This result is based on an Attribute check.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAGS    VALUE WORST THRESH FAIL RAW_VALUE
  1 Raw_Read_Error_Rate     POSR-K   200   200   051    -    0
  3 Spin_Up_Time            POS--K   170   170   021    -    6475
  4 Start_Stop_Count        -O--CK   100   100   000    -    80
  5 Reallocated_Sector_Ct   PO--CK   200   200   140    -    0
  7 Seek_Error_Rate         -OSR-K   200   200   000    -    0
  9 Power_On_Hours          -O--CK   078   078   000    -    16690
 10 Spin_Retry_Count        -O--CK   100   253   000    -    0
 11 Calibration_Retry_Count -O--CK   100   253   000    -    0
 12 Power_Cycle_Count       -O--CK   100   100   000    -    30
192 Power-Off_Retract_Count -O--CK   200   200   000    -    20
193 Load_Cycle_Count        -O--CK   200   200   000    -    68
194 Temperature_Celsius     -O---K   117   102   000    -    33
196 Reallocated_Event_Count -O--CK   200   200   000    -    0
197 Current_Pending_Sector  -O--CK   200   200   000    -    0
198 Offline_Uncorrectable   ----CK   100   253   000    -    0
199 UDMA_CRC_Error_Count    -O--CK   200   200   000    -    6
200 Multi_Zone_Error_Rate   ---R--   100   253   000    -    0
                            ||||||_ K auto-keep
                            |||||__ C event count
                            ||||___ R error rate
                            |||____ S speed/performance
                            ||_____ O updated online
                            |______ P prefailure warning

root@pve:~#
 
Oddly, this is still an issue for me on a ProLiant DL380p Gen8, with a brand new install of Proxmox 8.0.3, with smartmontools 7.3-pve1:

View attachment 52538

Code:
root@pve:~# pveversion -v
proxmox-ve: 8.0.1 (running kernel: 6.2.16-3-pve)
pve-manager: 8.0.3 (running version: 8.0.3/bbf3993334bfa916)
pve-kernel-6.2: 8.0.2
pve-kernel-6.2.16-3-pve: 6.2.16-3
ceph-fuse: 17.2.6-pve1+3
corosync: 3.1.7-pve3
criu: 3.17.1-2
glusterfs-client: 10.3-5
ifupdown2: 3.2.0-1+pmx3
ksm-control-daemon: 1.4-1
libjs-extjs: 7.0.0-3
libknet1: 1.25-pve1
libproxmox-acme-perl: 1.4.6
libproxmox-backup-qemu0: 1.4.0
libproxmox-rs-perl: 0.3.0
libpve-access-control: 8.0.3
libpve-apiclient-perl: 3.3.1
libpve-common-perl: 8.0.5
libpve-guest-common-perl: 5.0.3
libpve-http-server-perl: 5.0.3
libpve-rs-perl: 0.8.3
libpve-storage-perl: 8.0.2
libspice-server1: 0.15.1-1
lvm2: 2.03.16-2
lxc-pve: 5.0.2-4
lxcfs: 5.0.3-pve3
novnc-pve: 1.4.0-2
proxmox-backup-client: 3.0.1-1
proxmox-backup-file-restore: 3.0.1-1
proxmox-kernel-helper: 8.0.2
proxmox-mail-forward: 0.2.0
proxmox-mini-journalreader: 1.4.0
proxmox-widget-toolkit: 4.0.5
pve-cluster: 8.0.1
pve-container: 5.0.4
pve-docs: 8.0.4
pve-edk2-firmware: 3.20230228-4
pve-firewall: 5.0.2
pve-firmware: 3.7-1
pve-ha-manager: 4.0.2
pve-i18n: 3.0.4
pve-qemu-kvm: 8.0.2-3
pve-xtermjs: 4.16.0-3
qemu-server: 8.0.6
smartmontools: 7.3-pve1
spiceterm: 3.3.0
swtpm: 0.8.0+pve1
vncterm: 1.8.0
zfsutils-linux: 2.1.12-pve1
root@pve:~#

Code:
root@pve:~# smartctl -H -A -f brief /dev/sda
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.2.16-3-pve] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

/dev/sda: requires option '-d cciss,N'
Please specify device type with the -d option.

Use smartctl -h to get a usage summary

root@pve:~#

Code:
root@pve:~# smartctl -H -A -d cciss,0 -f brief /dev/sda
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.2.16-3-pve] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Status not supported: Incomplete response, ATA output registers missing
SMART overall-health self-assessment test result: PASSED
Warning: This result is based on an Attribute check.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAGS    VALUE WORST THRESH FAIL RAW_VALUE
  1 Raw_Read_Error_Rate     POSR-K   200   200   051    -    0
  3 Spin_Up_Time            POS--K   170   170   021    -    6475
  4 Start_Stop_Count        -O--CK   100   100   000    -    80
  5 Reallocated_Sector_Ct   PO--CK   200   200   140    -    0
  7 Seek_Error_Rate         -OSR-K   200   200   000    -    0
  9 Power_On_Hours          -O--CK   078   078   000    -    16690
 10 Spin_Retry_Count        -O--CK   100   253   000    -    0
 11 Calibration_Retry_Count -O--CK   100   253   000    -    0
 12 Power_Cycle_Count       -O--CK   100   100   000    -    30
192 Power-Off_Retract_Count -O--CK   200   200   000    -    20
193 Load_Cycle_Count        -O--CK   200   200   000    -    68
194 Temperature_Celsius     -O---K   117   102   000    -    33
196 Reallocated_Event_Count -O--CK   200   200   000    -    0
197 Current_Pending_Sector  -O--CK   200   200   000    -    0
198 Offline_Uncorrectable   ----CK   100   253   000    -    0
199 UDMA_CRC_Error_Count    -O--CK   200   200   000    -    6
200 Multi_Zone_Error_Rate   ---R--   100   253   000    -    0
                            ||||||_ K auto-keep
                            |||||__ C event count
                            ||||___ R error rate
                            |||____ S speed/performance
                            ||_____ O updated online
                            |______ P prefailure warning

root@pve:~#

Hi, this only works only if controller is set in HBA mode. Which is your controller model?
 
Hi, this only works only if controller is set in HBA mode. Which is your controller model?
Ah ha! I was thinking it was already in HBA mode, but it's a P420i... apparently at one point I set each drive to its own raid0 as a workaround for not being able to boot from this controller when it's set to HBA.

Nowadays I have it booting off a separate SSD running off one of the SATA ports inside the chassis, so I should be able to work around that now. Thanks!
 
Last edited:

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 yours easily in our online shop.

Buy now!