Issue
-
The backup storage cannot be activated (Acronis or CloudLinux backup) on the server due to the error:
The SnapAPI kernel module is not loaded for the kernel 3.10.0-962.3.2.lve1.5.44.2.el7.x86_64 that is running in this system. Install the module for this kernel version, and then retry the backup.
-
In some cases we also can find a second error:
Your kernel headers for kernel 4.18.0-147.8.1.el7h.lve.1.x86_64 cannot be found at
/lib/modules/4.18.0-147.8.1.el7h.lve.1.x86_64/build or /lib/modules/4.18.0-147.8.1.el7h.lve.1.x86_64/source.
You can use the --kernelsourcedir option to tell DKMS where it's located. -
Kernel versions may be different on different servers.
- In general, if there will be issues with the absence of files besides headers, it is worth it to specify the
kernelsourcedir
manually, asuname -r
may not always specify the path needed. - Occasionally, after compiling there might be execution issues while loading the module:
modprobe snapapi26
For such a case, it may help to re-compile the module with the older version of the kernel, although it is recommended to fully update the kernel, reboot, and try again.
modprobe: ERROR: could not insert 'snapapi26': Exec format error
Environment
- Imunify360
- CloudLinux Backup
- Acronis
- snapapi26
Solution
The module should be installed manually according to the following guide:
-
Install headers, devel, and necessary packages (it is worth noting that packages should be installed for the version of the kernel that is running on the server, for which the module will be built):
# yum install kernel-devel kernel-headers elfutils-libelf-devel
-
Check the current SnapAPI version. The latest version installed on the server should be used. In this case, it is 0.8.4.
# ls /usr/src
file_protector-1.1-1485 snapapi26-0.7.135 snapapi26-0.7.142
file_protector-1.1-1487 snapapi26-0.7.139 snapapi26-0.8.4Note: If the directory with the necessary version is missing, e.g.:
Directory: /usr/src/snapapi26-0.8.8 does not exist.
Unpack the archive as follows:
# cd /usr/lib/Acronis/kernel_modules/
# tar xvfz snapapi26-0.8.8-all.tar.gz
# mkdir /usr/src/snapapi26-0.8.8
# mv /usr/lib/Acronis/kernel_modules/dkms_source_tree/* /usr/src/snapapi26-0.8.8/
# sed 's/REMAKE_INITRD/#REMAKE_INITRD/' -i /usr/src/snapapi26-0.8.8/dkms.conf -
Install and load the module manually:
# dkms build -m snapapi26 -v 0.8.4 --config /boot/config-$(uname -r) --arch $(uname -p) --kernelsourcedir /usr/src/kernels/$(uname -r)
# dkms install -m snapapi26 -v 0.8.4
# modprobe snapapi26
# systemctl restart acronis_mmsIf the following issue is received:
# modprobe snapapi26
modprobe: ERROR: could not insert 'snapapi26': Required key not available
The culprit is likely the Secure Boot being enabled
# mokutil --sb-state
SecureBoot enabled
Please, disable Secure boot, it can be done in the UEFI/BIOS. Please, note that to do that server reboot will be required. Your hosting provider should be able to help you with this task.
Then run the following commands:
modprobe snapapi26
lsmod | grep snap
acrocmd list disks
systemctl restart acronis_mms
acrocmd list disks -
Verify, that everything works as expected:
# dkms status snapapi26 |grep installed
snapapi26/0.8.4, 3.10.0-962.3.2.lve1.5.63.el7.x86_64, x86_64: installed
# lsmod | grep snap
snapapi26 50066 3
# systemctl status acronis_mms
● acronis_mms.service - Acronis machine management service
Loaded: loaded (/etc/systemd/system/acronis_mms.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-12-23 10:40:52 -03; 8s ago
Main PID: 923109 (mms)
CGroup: /system.slice/acronis_mms.service
└─923109 /usr/lib/Acronis/BackupAndRecovery/mms
Dec 23 10:40:52 srv.wcorp53.com systemd[1]: Starting Acronis machine management service...
Dec 23 10:40:52 srv.wcorp53.com systemd[1]: Started Acronis machine management service.
After that, the backup can be reactivated again.
Cause
The server does not have the header and devel packages for its current kernel version installed. This issue will be fixed from Acronis side in the future.
Comments
5 comments
Very useful thanks!
I cannot wonder why this command :
dkms build -m snapapi26 -v 0.8.14 --config /boot/config-$(uname -r) --arch $(uname -p) --kernelsourcedir /usr/src/kernels/$(uname -r)
Return me this : Error! echo
Your kernel headers for kernel 4.18.0-372.16.1.lve.el7h.x86_64 cannot be found at
/lib/modules/4.18.0-372.16.1.lve.el7h.x86_64/build or /lib/modules/4.18.0-372.16.1.lve.el7h.x86_64/source.
You can use the --kernelsourcedir option to tell DKMS where it's located.
Solution : writing the kernel manually (adapt this to your own kernel found by uname -r)
For my with my current kernel :
[root@coconut ~]# dkms build -m snapapi26 -v 0.8.14 --config /boot/config-$(uname -r) --arch $(uname -p) --kernelsourcedir /usr/src/kernels/4.18.0-372.19.1.lve.el7h.x86_64
> DKMS: build completed.
Maybe a wrong symbol with copy-past of $(uname -r) ?
Keep going! :)
Greetings.
Dear Nicolas, I'm glad that this article was useful for you. As for your question about the uname command and its output.
We don't have a simple output of the uname -r command in this situation, but from the given entries I can assume that at the time of building, the server was running with kernel 4.18.0-372.16.1.lve.el7h.x86_64 and the uname -r command returned this kernel version. At the same time, the driver was built for the kernel 4.18.0-372.19.1.lve.el7h.x86_64 to the files of which you specified the direct path. While the files for 4.18.0-372.16.1.lve.el7h.x86_64 were not in the correct directory.
The command you showed from the article stipulates that the module will be built on the server for the same kernel that the system is running with. To build a module for a different kernel version, you really need to use the direct path to the directory with the files instead of uname -r command (I think we will add this point to the article soon).
Please let me know (here or in the ticket system) if you have any other questions. We are always ready to help. :)
When trying to run
dkms build -m snapapi26 -v 0.8.15 --config /boot/config-$(uname -r) --arch $(uname -p) --kernelsourcedir /usr/src/kernels/$(uname -r)
I get this message:
Running the pre_build script:
Generate "kernel_config.h" for kernel "5.14.0-214.el9.x86_64" and system map "/lib/modules/5.14.0-214.el9.x86_64//System.map".
Function "printk" not found
Address of the function "blk_mq_submit_bio" was defined
Address of the function "_printk" was defined
Building module:
cleaning build area...
make -j8 KERNELRELEASE=5.14.0-214.el9.x86_64 -C /lib/modules/5.14.0-214.el9.x86_64/build M=/var/lib/dkms/snapapi26/0.8.15/build....(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.14.0-214.el9.x86_64 (x86_64)
Consult /var/lib/dkms/snapapi26/0.8.15/build/make.log for more information.
This is the output of the make.log:
DKMS make.log for snapapi26-0.8.15 for kernel 5.14.0-214.el9.x86_64 (x86_64)
Wed Jan 11 01:05:26 PM UTC 2023
make: Entering directory '/usr/src/kernels/5.14.0-214.el9.x86_64'
grep: ./arch/x86/include/asm/system.h: No such file or directory
grep: ./include/asm/system.h: No such file or directory
grep: ./include/asm-generic/system.h: No such file or directory
grep: ./include/linux/genhd.h: No such file or directory
grep: ./include/linux/genhd.h: No such file or directory
grep: ./include/linux/genhd.h: No such file or directory
grep: ./include/linux/genhd.h: No such file or directory
grep: ./include/linux/genhd.h: No such file or directory
CC [M] /var/lib/dkms/snapapi26/0.8.15/build/snapapi26.o
CC [M] /var/lib/dkms/snapapi26/0.8.15/build/snumbd26.o
/var/lib/dkms/snapapi26/0.8.15/build/snapapi26.c: In function ‘snapapi_ops_submit_bio’:
/var/lib/dkms/snapapi26/0.8.15/build/snapapi26.c:2902:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
2902 | int pended = 0;
| ^~~
/var/lib/dkms/snapapi26/0.8.15/build/snumbd26.c: In function ‘unregister_device’:
/var/lib/dkms/snapapi26/0.8.15/build/snumbd26.c:706:17: error: implicit declaration of function ‘blk_cleanup_disk’; did you mean ‘blk_alloc_disk’? [-Werror=implicit-function-declaration]
706 | blk_cleanup_disk(s->s_disk);
| ^~~~~~~~~~~~~~~~
| blk_alloc_disk
/var/lib/dkms/snapapi26/0.8.15/build/snumbd26.c:695:35: warning: unused variable ‘queue’ [-Wunused-variable]
695 | sn_request_queue *queue;
| ^~~~~
/var/lib/dkms/snapapi26/0.8.15/build/snumbd26.c: In function ‘register_device’:
/var/lib/dkms/snapapi26/0.8.15/build/snumbd26.c:685:9: warning: ignoring return value of ‘add_disk’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
685 | add_disk(s->s_disk);
| ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:321: /var/lib/dkms/snapapi26/0.8.15/build/snumbd26.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1915: /var/lib/dkms/snapapi26/0.8.15/build] Error 2
make: Leaving directory '/usr/src/kernels/5.14.0-214.el9.x86_64'
The aforegoing commands ran just fine without error.
Any idea how to get this to work?
Hi Marc,
Are you running the latest kernel? This could happen when for example you install the latest kernel and kernel-headers from repo, however, you haven't rebooted a server so it runs on the old kernel.
If not the case please create ticket so we can check in place.
I came across this article while trying to install Acronis on a new CentOS 9 Stream server I was setting up to replace an existing CentOS 8 server. I also was having issues building the snapapi26 module. I opened a case with Acronis support and they informed me that they are still working on supporting the new kernel version and do not have an ETA yet. I then switched to Rocky Linux 9 hoping that snapapi26 might build with that kernel but had the same issue.
After doing some research into the errors in the make.log I found articles online that explained that two headers mentioned in my make.log have been replaced in newer kernel versions. system.h was replaced with switch_to.h and genhd.h was replaced with blkdev.h
https://forums.fedoraforum.org/showthread.php?282144-Missing-system-h
https://lore.kernel.org/all/9bb3f4c6-4e21-e1d7-b4e1-f65d273cd3f8@nvidia.com/t/
I edited the source Makefile, snapapi26.c and snumbd26.c, replacing references to the older headers with the newer ones and was able to eliminate those missing file errors from the make.log but there are still other errors that are beyond my skill to troubleshoot since I am not a programmer. Hopefully Acronis will catch up and support the newer kernels soon.
Please sign in to leave a comment.