Skip to main content

CloudLinux Knowledge Base

The SnapAPI kernel module is not loaded for the kernel

Comments

5 comments

  • Nicolas Laruelle

    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! :)

    0
  • Permanently deleted user

    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. :)

    1
  • Marc Oh

    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?

    0
  • Bogdan Shyshka

    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.

    0
  • D Stevenson

    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.

    0

Please sign in to leave a comment.