I'm trying to install a custom driver rpm that I custom built. I have a kickstart file bundled into a RHEL7.2 iso with a %post
section. In the %post
, I have a yum install of the driver rpm which seems to get installed, but I notice that depmod logs fatal errors when the driver rpm gets installed:
Installing : kmod-xnxx-1.0-1_test.x86_64 depmod: FATAL: could not load 3.10.0-327.el7.x86_64: No such file or directory warning: %post(kmod-xnxx-1.0-1_test.x86_64) scriptlet failed, exit status 1 Non-fatal POSTIN scriptlet failure in rpm package kmod-xnxx-1.0-1_test.x86_64 Verifying : kmod-xnxx-1.0-1_test.x86_64 Installed : kmod-xnxx-1.0-1_test.x86_64 Complete!
As the rpm gets installed, it runs a depmod -a and dracut to rebuild the ramdisk. I'm not sure why these errors a re occurring during the anaconda post install? I've confirmed that the same kernel "3.10.0-327.el7.x86_64" is being used during the post so I have no idea why the module doesn't get installed correctly without the "depmod" errors. I recall from the past that the running kernel during the anaconda install has differences with the kernel that actually gets installed. I'm not sure if this is attributed to the issue I'm having with the post. Any suggestions on how to overcome this would be great. Thanks!
Below is the spec file that I'm using to build the kernel driver rpm(kmod) against kernel 3.10.0-327.el7.x86_64:
%define build_kernel 3.10.0-327.el7.x86_64
%define current_kernel %(uname -r)
%define destdir /lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/net/
Summary: driver
Name: kmod-xnxx
Version: 1.0
Release: 1_test
License: GPL
Group: Hardware driver
BuildArch: x86_64
BuildRoot: %{buildroot}
%description
Creating a xn4xx kernel module RPM
%prep
%install
mkdir -p %{buildroot}%{destdir}
if [ “%{build_kernel}” != “%{current_kernel}” ]; then
echo “This rpm is for %{build_kernel} kernel version. Ensure that you are using right module/kernel”
exit 1
fi
ls %{destdir} > /dev/null 2> /dev/null
if [ $? != 0 ]; then
echo “%{destdir} is not there. Unable to install the driver.”
exit 1
fi
install -m 644 %(pwd)/BUILD/xnxx.ko %{buildroot}%{destdir}xnxx.ko
%clean
rm -rf %{buildroot}
%post
/sbin/depmod -a %{current_kernel}
/sbin/dracut -v -f /boot/initramfs-%{current_kernel}.img %{current_kernel}
%files
%defattr(-,root,root)
%{destdir}xnxx.ko
%changelog