rpm built not fully installed

Hello
First time that I have to build a rpm so, maybe the following error will be easy to fix …
I tried to build drbd rpms for a SLES 12 SP5 (I don’t have access to the HA repo with official delivery), here is what I’ve done:

  1. On my “production server”, download sources from Linbit (drbd-9.0.24-1 and utils 9.0.3).
  2. deploy the tar.gz files under /usr/src/package/SOURCES
  3. for drbd-9.0.24-1 : go to the directory, add some lines in drbd-kernel.spec
%files
%defattr(-,root,root,-)
/lib/modules/4.12.14-122.63-default/updates/drbd.ko
/lib/modules/4.12.14-122.63-default/updates/drbd_transport_tcp.ko
  1. make a rpmbuild -ba drbd-kernel.spec => no issue displayed, 2 rpms were created
  2. for utils : go to the directory, launch ./autogen and ./configure --enable-spec
  3. make a rpmbuild -ba drbd.spec => no issue, 8 rpms created

Here is the list of created RPMs:
drbd-9.3.0-1.x86_64.rpm drbd-man-ja-9.3.0-1.x86_64.rpm
drbd-bash-completion-9.3.0-1.x86_64.rpm drbd-pacemaker-9.3.0-1.x86_64.rpm
drbd-heartbeat-9.3.0-1.x86_64.rpm drbd-udev-9.3.0-1.x86_64.rpm
drbd-kernel-9.0.24-1.x86_64.rpm drbd-utils-9.3.0-1.x86_64.rpm
drbd-kmp-default-9.0.24_k4.12.14_122.63-1.x86_64.rpm drbd-xen-9.3.0-1.x86_64.rpm

So, I uploaded these rpms on my test server, created a repo for zypper and tried a zypper in drbd-kernel and zypper in drbd
During the second command, I had warning messages :
> (2/6) Installing: drbd-kmp-default-9.0.24_k4.12.14_122.63-1.x86_64 […done]

Additional rpm output:
WARNING: drbd-kmp-default-9.0.24_k4.12.14_122.63-1 does not contain any kernel modules
cat: /var/tmp/weak-modules2.veGkOx/krel-drbd-kmp-default-9.0.24_k4.12.14_122.63-1: No such file or directory
/usr/lib/module-init-tools/weak-modules2: line 89: /var/tmp/weak-modules2.veGkOx/modules-drbd-kmp-default-9.0.24_k4.12.14_122.63-1: No such file or directory
/usr/lib/module-init-tools/weak-modules2: line 488: /var/tmp/weak-modules2.veGkOx/basenames-drbd-kmp-default-9.0.24_k4.12.14_122.63-1: No such file or directory
warning: %post(drbd-kmp-default-9.0.24_k4.12.14_122.63-1.x86_64) scriptlet failed, exit status 1 

If I look at lsmod, drbd is not here, if I try a drbdadm status, I have the error :
> modinfo: ERROR: Module drbd not found.

modprobe: FATAL: Module drbd not found in directory /lib/modules/**4.12.14-122.60-default**
Failed to modprobe drbd (No such file or directory)

When I search for drbd.ko, I found it but under another kernel :
/lib/modules/4.12.14-122.63-default/updates/drbd.ko

If I try : insmod /lib/modules/4.12.14-122.63-default/updates/drbd.ko, I have an error :
> insmod: ERROR: could not insert module /lib/modules/4.12.14-122.63-default/updates/drbd.ko: Unknown symbol in module
in dmesg, I saw the error drbd: Unknown symbol crc32c (err 0)

So, I miss something…

There is a small rpmbuild howto:
https://forums.suse.com/discussion/comment/59158/#Comment_59158
Remove step 5). => You can easily destroy your system!
Be aware of tainted kernel:
https://forums.suse.com/discussion/comment/59486
And you should not mix kernel modules from different kernel (sources).
Check your rpm installation(s):

rpm -qa |grep -i drbd

rpm -ql drbd

rpm -V drbd

rpm -Va

Thanks Andreas
Not sure to understand why you suggest to remove the step 5 : without making the couple autogen/configure --enable-specs, I won’t have the drbd.spec file to build the rpm.

However, I will search a version for my current kernel to go on.

I have another solution : compile and install directly from source for each deployment, it’s less “pretty” but it works.