Skip to content

Inventory Script Issues (e.g. CentOS 7)

Symptoms

If the hardware inventory shell script is executed on an old operating system, such as CentOS 7, the following error message may appear:

  • lsblk: invalid option -- 'J'

Cause

The version of util-linux is too old and does not support the -J option.

Solution

The hardware collection shell script takes into account the .bashrc file, which makes it simple to set up an alias for a newer binary of lsblk/lscpu. Here's an example for CentOS 7:

yum groupinstall "Development tools" -y
cd
wget https://github.com/util-linux/util-linux/archive/refs/tags/v2.38.1.tar.gz
tar xfvz v2.38.1.tar.gz
cd util-linux-2.38.1/
./autogen.sh && ./configure && make
echo "
alias lsblk='$(pwd)/lsblk'
alias lscpu='$(pwd)/lscpu'" >> ~/.bashrc

Then execute the script:

# wget -qO - … | bash -s '...'
{"message":"success"}

After completion, the lsblk / lscpu alias should be removed again from ~/.bashrc, e.g.:

sed -i '/alias lscpu=/d' ~/.bashrc
sed -i '/alias lsblk=/d' ~/.bashrc

These steps do not replace the default version of lsblk/lscpu and do not make any permanent changes to the system, except for the installation of the "Development tools" program.

Why the script doesn't include this workaround?

We do not include these steps in the script, to avoid making significant changes to the system without the administrator's knowledge (installing "Development tools" in that case).

However, you can create a separate wrapper shell script to automate these steps if needed. This must be done on your own.