Error installing Mellanox OFED on CentOS 7.9.

I’m trying to install the Mellanox OFED on a CentOS 7.9 that I have on a Singularity container with the following command:

./mlnxofedinstall --add-kernel-support --force --skip-repo

However, I get the following error:

/lib/modules/4.17.0-rc2/build/scripts is required to build mlnx-ofa_kernel RPM.

Please install the corresponding kernel-source or kernel-devel RPM.

Error: One or more required packages for installing OFED-internal are missing.

Please install the missing packages using your Linux distribution Package Management tool.


yum install kernel-devel-4.17.0-rc2

Failed to build MLNX_OFED_LINUX for 4.17.0-rc2

When I try yum install kernel-dev-4.17.0-rc2, I get the following error:

No package kernel-devel-4.17.0-rc2 available.

Error: Nothing to do

And when I try yum install kernel-dev, an older version 3.something is installed that does not fix the issue.

This is output of uname -s -r:

Linux 4.17.0-rc2

And this is the output of ls -l /usr/src/kernels/:




Could you please let me know how I can fix this?

Hello Mehran,

Thank you for posting your inquiry on the NVIDIA Networking Community.

As you want to install MLNX_OFED on a non-default kernel on CentOS 7.6, please make sure you have the following RPMS installed as mentioned in the RN under section →

Be aware that in some cases, it is not possible to rebuild the driver against the installed non-default kernel, if the kernel is much more recent than the MLNX_OFED version you want to install.

Also make sure you use the same GCC version on which your kernel is build.

Another method, is to run the ‘’ script manually, by pointing towards the correct kernel source. Use the ‘help’ option for the available options.

Thank you and regards,

~NVIDIA Networking Technical Support

Hi Martijn,

Thanks a lot for your response. I’m wondering if this is the correct approach I’m pursuing for enabling Infiniband on a Singularity container. I have not been able to find suitable instructions. I would be so grateful if you could kindly help with that.

(I need to compile MVAPICH (MPI for Infiniband) on my Singularity container which requires enabling IB on my container.)