View Full Version : Build DRBD 8.4.2 on Fedora 17

1st December 2012, 09:29 PM
1. fetch sources


says to use

wget http://oss.linbit.com/drbd/8.4/drbd-latest.tar.gz

but you get a 404 and you really need

wget http://oss.linbit.com/drbd/8.4/drbd-8.4.2.tar.gz

2. setup system build environment

yum install rpm-build redhat-rpm-config flex git autoheader autoconf kernel-devel

mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

3. generate spec files

tar xfz drbd-8.4.2.tar.gz
cd drbd-8.4.2
./configure --with-km
./configure --enable-spec --with-km
cp ../drbd-8.4.2.tar.gz ~/rpmbuild/SOURCES/
cp drbd*.spec ~/rpmbuild/SPECS/
cd ~/rpmbuild/SPECS/

4. Hack /usr/lib/rpm/redhat/macros

Sad but true


--- /root/macros.orig 2012-12-01 12:38:05.101671058 -0500
+++ /usr/lib/rpm/redhat/macros 2012-12-01 12:44:55.011215451 -0500
@@ -238,7 +238,7 @@
done \
fi \
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
- echo "%%global kernel_source() /usr/src/kernels/%kverrel-\\\$([ %%%%{1} = default ] || echo "%%%%{1}-")%_target_cpu" \
+ echo "%%global kernel_source() /usr/src/kernels/%kverrel.\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
if [ ! -z "%{-f*}" ] \
then \
filelist="%{-f*}" \

Two "-" should be "."

5. Hack the drbd-kernel.spec file too.

Admittedly I'm not proud about this hack job. If you have improvements please post them.

$ diff -u drbd-kernel.spec.orig drbd-kernel.spec
--- drbd-kernel.spec.orig 2012-12-01 11:58:40.668370638 -0500
+++ drbd-kernel.spec 2012-12-01 18:55:39.117136636 -0500
@@ -89,10 +89,27 @@
rm -f drbd.conf
mkdir -p $RPM_BUILD_ROOT/etc/depmod.d
-echo "override drbd * weak-updates" \
+echo "override drbd * extra" \
> $RPM_BUILD_ROOT/etc/depmod.d/drbd.conf

+# Somehow depmod gets run and the files it produces are not in any
+# packages so rpmbuild fails to produce the desired rpm.
+# Remove the output of depmod
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.alias
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.alias.bin
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.dep
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.dep.bin
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.devname
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.softdep
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.symbols
+rm $RPM_BUILD_ROOT/lib/modules/%{kernel_version}.%{_target_cpu}/modules.symbols.bin
rm -rf %{buildroot}

6. Build and install the RPMs

cd ~/rpmbuild/SPECS
rpmbuild -ba drbd.spec
rpmbuild -ba drbd-kernel.spec
cd ../RPMS/x86_64
yum install heartbeat pacemaker xen
rpm -i drdb*

7. Cry about the fact that depmod doesn't find the 8.4.2 version of drbd.ko but it's easy to work around by using insmod instead of modprobe.

insmod /lib/modules/3.6.7-4.fc17.x86_64/extra/drbd/drbd.ko

1st December 2012, 10:07 PM
If you install the rpmdevtools package, this:

mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
can be replaced with this (just be in your user home top directory):


2nd December 2012, 01:06 AM
@PabloTwo Thanks!

drbd-kernel.spec is trying to rely on %kernel_module_package but either it is calling it wrong or there are (more) bugs in /usr/lib/rpm/redhat/* (or both.)

23rd March 2013, 06:49 PM
I'm the package maintainer for DRBD in Fedora and I've just pushed drbd 8.4.2 for Fedora 17 since I had a bugzilla ticket for it. The package is in testing now if you'd rather use that than compile from source.


24th March 2013, 01:28 PM
@rackerhacker Thanks.

I have moved on to Fedora 18 since starting this thread.

I needed a test lab for configuring RHEL6 multipathing so I threw together

The lab all been repurposed and the production environment has been configured dual-pathing against an iSCSI appliance.

It was way faster and cheaper than getting a test appliance.