Skip to end of metadata
Go to start of metadata

Compiling a module on a Debian 5.0 w/ Linux 2.6.29 and higher

Symptom


Debian, Suse, and other distributions with recent 2.6.29 and higher kernels,
package their kernel headers in a new architecture-specific manner,
which breaks compatibility with earlier established methods of building modules for kernels.

Prior to CDP 4.0.0, attempting to build kernel modules on these Linux distributions can prove unsuccessful.

This is the excerpted output from one attempt. In our example here, we use r1soft-setup, but this applies for r1soft-cki in CDP2 as well.

root@box~# /usr/bin/r1soft-setup Checking for binary module .. No binary module found Gathering kernel information Gathering kernel information complete. Creating kernel headers package Checking '/usr/src/linux-headers-2.6.30-1-common' for kernel headers Found headers in '/usr/src/linux-headers-2.6.30-1-common' Compressing... uploading kernel package 100% 3863KB 3.8MB/s 00:01 Starting module build... ............................gathering required information... sending request for kernel module... kernel module installer failed. (0): chroot chroot make make[1]: Entering directory `/' ~~~~~~ make: Entering an unknown directory make: *** /usr/src/linux-headers-2.6.30-1-common: No such file or directory. Stop. make: Leaving an unknown directory make[4]: *** [all] Error 2 ~~~~~~

Cause


This issue is known to affect Debian, Suse, and other distros using separate architecture-specific module directories in their header packages.
Thanks to Chris at Interspire.com for working closely with us to discover a resolution.

The Debian developers have removed their common/architecture specific symlinks for the kernel headers in 2.6.29 and higher,
and in the process, have broken a whole heap of kernel module building, including the R1Soft CDPAgent module
(refer to here: http://bugs.debian.org/cgi-bin/bugrepaort.cgi?bug=521515)

Basically, there are now two kernel module directories, both of which contain necessary files:

drwxr-xr-x 4 root root 4096 2010-01-20 05:43 linux-headers-2.6.32-trunk-amd64
drwxr-xr-x 4 root root 4096 2010-01-20 05:47 linux-headers-2.6.32-trunk-common

Resolution


Copying the contents of these two directories into a temporary directory, with the proper makefile chosen,
will allow the r1soft-cki process to compile a module successfully.

cd /usr/src/ rsync -avz linux-headers-2.6.32-3-amd64/ /usr/src/r1build/ rsync -avz linux-headers-2.6.32-3-common/ /usr/src/r1build/

Now, point the r1soft-cki utility to use your temporary directory, with the following flags added to the command.

CDP2

# /usr/bin/r1soft-cki --kernel-dir /usr/src/r1build

CDP3 

# /usr/bin/r1soft-setup --get-module --kernel-dir /usr/src/r1build

After a successful build, you can delete the temporary directory, start the agent, and enjoy Continuous Data Protection!

rm -r /usr/src/r1build /etc/init.d/cdp-agent restart

Related Articles


Page: Restoring the Root Linux File System (Knowledge Base) Labels: linux_3, restore_3
Page: Supporting Linux OCFS2 File System (Knowledge Base) Labels: file_system_3, ext3_3, ext2_3, reiserfs3_3, linux_3
Page: Using r1soft-setup with later Debian kernels (Knowledge Base) Labels: linux_3, kernel_3
Page: Compiling a Module on Debian with Linux Kernel 2.6.29 and Higher with Xen (Knowledge Base) Labels: linux_3, kernel_3, debian
Page: Compiling a Module on Debian with Linux Kernel 2.6.29 and Higher (Knowledge Base) Labels: linux_3, kernel_3, debian
Page: Using r1soft-setup with later Debian kernels (Knowledge Base) Labels: linux_3, kernel_3
Page: Compiling a Module on Debian with Linux Kernel 2.6.29 and Higher with Xen (Knowledge Base) Labels: linux_3, kernel_3, debian
Page: Compiling a Module on Debian with Linux Kernel 2.6.29 and Higher (Knowledge Base) Labels: linux_3, kernel_3, debian
Labels:
linux_3 linux_3 Delete
kernel_3 kernel_3 Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 10, 2012

    Note: 2/10/2012.

     r1soft-setup will correctly find and send the appropriate headers in a Debian distro in the next major release. Stay tuned .