Updated: 16 November 2026 · Applies to: R1Soft backup agent (r1soft-cki and serverbackup-setup) on AlmaLinux 9, Rocky Linux 9 and Ubuntu 24.04
When r1soft-cki fails with "Unable to find a valid source directory", it cannot find the kernel headers for the kernel the server is running right now, so it has nothing to build the backup kernel module against. Install the headers that match uname -r exactly, then run the module build again.
1. Check the running kernel
uname -r
The headers you install must carry exactly this version. Headers for a newer or older kernel do not help.
2. Install the matching headers
On AlmaLinux, Rocky Linux and other RHEL-based systems:
dnf install kernel-devel-$(uname -r)
On Ubuntu and Debian:
apt install linux-headers-$(uname -r)
Then confirm the headers are there:
rpm -q kernel-devel
ls /lib/modules/$(uname -r)/build
The second command must list a directory, not report "No such file or directory".
3. Build the module again
Older R1Soft agents build the module with the tool from the error message:
r1soft-cki
Newer agents use serverbackup-setup instead. According to R1Soft's documentation, the module is built with:
serverbackup-setup --get-module
R1Soft's documentation then restarts the agent so it loads the new module:
/etc/init.d/cdp-agent restart
According to R1Soft, serverbackup-setup builds the module with R1Soft's online build service, so the server needs internet access. For a server without it, R1Soft documents an offline route that starts with serverbackup-setup --tarball-only.
If the exact headers are not available
This is the most common reason the fix does not work: the server is running an older kernel than the one in the repositories. In a lab test on AlmaLinux 9.8 whose running kernel was older than the repository kernel, the exact package could not be found:
dnf list kernel-devel-$(uname -r)
Output (lab example):
Error: No matching Packages to list
Listing the available versions showed only the newer kernel:
dnf list --showduplicates kernel-devel
Output (lab example, shortened):
kernel-devel.x86_64 5.14.0-687.66.2.el9_8 appstream
You have two ways out:
- Update the kernel and reboot (recommended). After the reboot, the running kernel and the available headers match:
dnf upgrade kernel kernel-devel
reboot
Then repeat steps 1 to 3. - Find the headers for the old kernel. If you cannot reboot yet, the matching
kernel-develpackage may still be in your distribution's archive (vault) repositories. Install that exact version, then build the module.
Other causes
- A custom or provider kernel. If the server boots a kernel that did not come from the distribution's repositories, no package will match it. Boot a distribution kernel, or point the build at the kernel's source tree; according to R1Soft,
serverbackup-setup --get-moduleaccepts--kernel-dirfor this. - A kernel the agent does not support yet. A very new kernel can be ahead of what the R1Soft build service supports. Update the agent to its latest version, and if the build still fails, ask R1Soft support whether your kernel is supported.
For the related "unable to get kernel module" message, see Unable to get kernel-module for r1soft backup. If you would like our engineers to sort out the backup agent on your server, see server management.