Unable to install kernel driver rpm during %post section kickstart RHEL7 - linux

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

Related

RHEL 8 find-debuginfo.sh gdb-add-index: No index was created

Trying to generate rpm on RHEL8 Machine. The same rpm_build.sh script works fine on RHEL6 & RHEL7. But in RHEL 8 its failing to generate debuginfo packages.
RPM BUILD VERSION :
$ sudo yum install rpm-build
Package rpm-build-4.14.3-23.el8.x86_64 is already installed.
+ install -m 755 libclntshcore.so.12.1 /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libclntshcore.so.12.1
+ install -m 755 libnnz12.so /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libnnz12.so
/usr/lib/rpm/find-debuginfo.sh -j8 --strict-build-id -m -i --build-id-seed 23.1.3-1.el8 --unique-debug-suffix -23.1.3-1.el8.x86_64 --unique-debug-src-base my_lib-23.1.3-1.el8.x86_64 --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 -S debugsourcefiles.list /home/opc/rpmbuild/BUILD/my_lib-23.1.3
extracting debug info from /home/opc/rpmbuild/BUILDROOT/my_lib23.1.3-1.el8.x86_64/usr/lib64/pam/libclntshcore.so.12.1
extracting debug info from /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libnnz12.so
gdb-add-index: No index was created for /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libons.so
gdb-add-index: [Was there no debuginfo? Was there already an index?]
gdb-add-index: No index was created for /home/opc/rpmbuild/BUILDROOT/my_lib-23.1.3-1.el8.x86_64/usr/lib64/pam/libclntshcore.so.12.1
gdb-add-index: [Was there no debuginfo? Was there already an index?]
My Spec.file
Name: my_lib-devel
Version: %{pkg_version}
Release: %{pkg_release}%{?dist}
Group: System Environment/Libraries
Source0: %{_sourcedir}/%{name}-%{version}.tar.gz
Requires: my_lib
%global debug_package %{nil}
%global _lib_authn_api_filename libauthn_api.so
%global _package_name my_lib
%description
developemnt package
%prep
%setup -q
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%build
%install
mkdir -p %{buildroot}/%{_includedir}/%{_package_name}
mkdir -p %{buildroot}%{_datadir}/doc/%{name}
cp *.h %{buildroot}/%{_includedir}/%{_package_name}
install -m 644 README %{buildroot}%{_datadir}/doc/%{name}/README
install -m 644 LICENCE %{buildroot}%{_datadir}/doc/%{name}/LICENCE
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
/%{_includedir}/%{_package_name}/*.h
%doc %{_datadir}/doc/%{name}/*
Not sure why it complaints while extracting debug info
When I ran it on RHEL6 / RHEL7 same thing works fine . Is something is updated in RHEL8 which I'm missing or do I need to update the specs to work on RHEL8 . I have tried couple of solution Like %global debug_package %{nil} or %define debug_package %{nil} But nothing works.
Kindly Help !

How to install rpmdev tools on ubuntu?

I am creating my first package using RPM on ubuntu machine.But I am getting so many difficulties.I tried so many commands to install rpmdevtools using "yum" but it is giving error as There are not repos enabled.
When I try to install it using apt-get it gives error as Unable to locate the package.
Can anybody suggest the proper start to end procedure with commands to build a package using RPM?
rpmdev is mostly optional. rpm is enough. The following describes the minimum steps to package a script program into a RPM file on Debian.
Install rpmbuild:
apt-get install rpm
Create a helloworld program:
cat > helloworld <<EOF
#! /bin/bash
printf "Hello World!\n"
EOF
chmod +x helloworld
Create a minimal specification helloworld.spec:
Name: helloworld
Version: 1.0
Release: 1%{?dist}
Summary: Hello World
License: GPLv3+
BuildArch: noarch
%description
Hello World!
%prep
%build
%install
mkdir -p %{buildroot}/%{_bindir}
install -m 0755 %{name} %{buildroot}/%{_bindir}/%{name}
%files
%{_bindir}/%{name}
%changelog
Build the RPMs:
rpmbuild -ba --build-in-place --define "_topdir $(pwd)/rpm" helloworld.spec
mv rpm/SRPMS/*.rpm .
mv rpm/RPMS/*/*.rpm .
rm -rf rpm
But you will not be able to install it on Debian or Ubuntu. The installation requires Fedora or Red Hat.

how to add custom path for rpm dependencies

I am trying to install some software that's required glib 2.14
so I installed it with this tutorial: How to upgrade glibc from version 2.12 to 2.14 on CentOS?
the problem is glib 2.14 path is /opt/glibc-2.14/lib/libc.so.6
so when I try to install software using rpm i still getting this error:
error: Failed dependencies:
libc.so.6(GLIBC_2.14)(64bit) is needed by xyz-4.6.6-1.x86_64
libc.so.6(GLIBC_2.15)(64bit) is needed by xyz-4.6.6-1.x86_64
libc.so.6(GLIBC_2.17)(64bit) is needed by xyz-4.6.6-1.x86_64
how can I add the custom path for rpm dependencies?
It would help a bit if you gave us the name of the package you are trying to install. You can't just provide a path, RPM checks if it's got any packages on record that provide these libraries, and there aren't any. Here are a couple methods you could use:
Use --nodeps
If you already know that you have everything that is required, using --nodeps is completely fine IMO.
Create virtual packages for the missing libraries (advanced)
You are missing the following libraries: libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.15)(64bit) libc.so.6(GLIBC_2.17)(64bit).
Here's an example .spec file to create a virtual package that claims to provide these libraries:
Name: libc-virtual-provides
Provides: libc.so.6(GLIBC_2.14)(64bit)
Provides: libc.so.6(GLIBC_2.15)(64bit)
Provides: libc.so.6(GLIBC_2.17)(64bit)
Version: 1.0
Release: 1
Summary: Virtual package providing libc 2.14, 2.15, 2.17
License: Public domain
%description
Virtual package providing libc 2.14, 2.15, 2.17
%prep
%files
%changelog
To create a virtual package from this SPEC file, first create some directories:
mkdir -p ~/rpmbuild/BUILD ~/rpmbuild/BUILDROOT ~/rpmbuild/RPMS ~/rpmbuild/SOURCES ~/rpmbuild/SPECS ~/rpmbuild/SRPMS
Then copy the SPEC file into ~/rpmbuild/SPECS, and build an RPM:
cp virtual-glibc-provides.spec ~/rpmbuild/SPECS
cd ~/rpmbuild/SPECS
rpmbuild -ba virtual-glibc-provides.spec
You'll get output like this:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.6Jni5u
+ umask 022
+ cd /home/.../rpmbuild/BUILD
+ exit 0
Processing files: glib2.14-virtual-provides-2.14-1.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/.../rpmbuild/BUILDROOT/glib2.14-virtual-provides-2.14-1.x86_64
Wrote: /home/.../rpmbuild/SRPMS/glib2.14-virtual-provides-2.14-1.src.rpm
Wrote: /home/.../rpmbuild/RPMS/x86_64/glib2.14-virtual-provides-2.14-1.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.YNj8gP
+ umask 022
+ cd /home/.../rpmbuild/BUILD
+ /bin/rm -rf /home/.../rpmbuild/BUILDROOT/glib2.14-virtual-provides-2.14-1.x86_64
+ exit 0
And you'll have your RPM under /home/.../rpmbuild/RPMS/, which you can then install using rpm -ivh ....rpm. You should then be able to install the other package without any problems.

Kernel build for CentOS 7: kernel-firmware not generated

I'm in the process of rebuilding the Linux kernel for Cent OS 7 to select a different preemption level.
My steps follow:
sudo yum install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed pesign xmlto audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel gcc patchutils bison make gcc redhat-rpm-config
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
wget http://vault.centos.org/7.2.1511/updates/Source/SPackages/kernel-3.10.0-327.4.4.el7.src.rpm
rpm -i kernel-3.10.0-327.4.4.el7.src.rpm
cd ~/rpmbuild/SPECS
rpmbuild -bp --target=$(uname -m) kernel.spec
Kernel in BUILD configured and config file copied in SOURCES
rpmbuild -bb --with firmware --without kabichk --without debug --without debug-info --without doc --target=`uname -m` kernel.spec 2> build-err.log | tee build-out.log
rpmbuild -bb --with firmware --without kabichk --without debug --without debug-info --without doc --target=noarch kernel.spec 2> build-err.log | tee build-out.log
(--without kabichk is needed because the new preemption level somehow breaks the current ABI)
The problem is that the package kernel-firmware gets not generated.
Any idea of what is missing ?
There doesn't appear to be a kernel-firmware package in CentOS 7 at all. And a quick search through the kernel spec file confirms that kernel-firmware doesn't appear anywhere in it.
There is a linux-firmware package though.
That package is built by the linux-firmware specfile.

/usr/bin/ld: cannot find -lGL Xubuntu 12.10 AMD open source

I am trying to compile the example from the following website: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/
At first CMake was unable to find libGL.so, so I pointed it to where the lib is (/usr/lib/x86_64-linux-gnu/mesa/libGL.so) in the txt file. After that I tried make all and this gave me the following error: /usr/bin/ld: cannot find -lGL. According to what I found this means that ld is unable to find libGL.so, but if I type locate libGL I get the following response:
/home/jacko/.local/share/Steam/SteamApps/common/Cave Story+/lib/libGLU.so.1
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libGLEW.so.1.6
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libGLEW.so.1.6.0
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libGLU.so.1
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libGLU.so.1.3.08004
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/share/doc/nvidia-cg-toolkit/examples/Tools/trace/libGL.so.1.gz
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime.old/i386/usr/lib/i386-linux-gnu/libGLEW.so.1.6
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime.old/i386/usr/lib/i386-linux-gnu/libGLEW.so.1.6.0
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime.old/i386/usr/lib/i386-linux-gnu/libGLU.so.1
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime.old/i386/usr/lib/i386-linux-gnu/libGLU.so.1.3.08004
/home/jacko/.local/share/Steam/ubuntu12_32/steam-runtime.old/i386/usr/share/doc/nvidia-cg-toolkit/examples/Tools/trace/libGL.so.1.gz
/opt/cave-story-plus/lib64/libGLU.so.1
/usr/lib/i386-linux-gnu/libGLU.so.1
/usr/lib/i386-linux-gnu/libGLU.so.1.3.1
/usr/lib/i386-linux-gnu/mesa/libGL.so.1
/usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
/usr/lib/x86_64-linux-gnu/libGLU.a
/usr/lib/x86_64-linux-gnu/libGLU.so
/usr/lib/x86_64-linux-gnu/libGLU.so.1
/usr/lib/x86_64-linux-gnu/libGLU.so.1.3.1
/usr/lib/x86_64-linux-gnu/mesa/libGL.so
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0
/usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so
/usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so.1
/usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so.1.0
/usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so.1.0.0
/usr/lib/x86_64-linux-gnu/qtcreator/plugins/Nokia/libGLSLEditor.so
/usr/lib32/libGL.so
Which looks to me like libGL is fully available.
also:
~$ sudo apt-get install libgl1-mesa-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgl1-mesa-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I am running Xubuntu 12.10 with opensource AMD drivers.
If anyone else encounters this too: the symlinks between /usr/lib/x86_64-linux-gnu/libGL.so and /usr/lib/x86_64-linux-gnu/mesa/libGL.so was gone. I did sudo apt-get remove --purge libgl1-mesa-dev and sudo apt-get install ibgl1-mesa-dev* libglu1-mesa-dev* libqt4-opengl-dev* qt-sdk* to fix this.
Maybe this simple script will help someone. The 1 answer helps me too but this script finish what was missing.
#!/bin/bash
DEPENDS='libx11-dev'
DEPENDS+=' libxmu-dev'
DEPENDS+=' libglu1-mesa-dev'
DEPENDS+=' libgl2ps-dev'
DEPENDS+=' libxi-dev'
DEPENDS+=' libglfw-dev'
DEPENDS+=' g++'
DEPENDS+=' libzip-dev'
DEPENDS+=' libglew*-dev'
MISSING=
echo "Checking for missing packages ..."
for i in $DEPENDS; do
if ! dpkg-query -W --showformat='${Status}\n' $i | grep "install ok installed" > /dev/null; then
MISSING+="$i "
fi
done
if [ -n "$MISSING" ]; then
TXTCOLOR_DEFAULT="\033[0;m"
TXTCOLOR_GREEN="\033[0;32m"
echo -e $TXTCOLOR_GREEN"Missing packages: $MISSING.\nYou may be asked for your password for package installation."$TXTCOLOR_DEFAULT
sudo apt-get --force-yes --yes install $MISSING
fi

Resources