veeam / blksnap

Nonpersistent block device snapshot with block-level change-tracking capabilities.
GNU General Public License v2.0
78 stars 21 forks source link

Problems compiling module with Slackware64-Current and kernel 6.9 #89

Closed barcoboy closed 1 month ago

barcoboy commented 3 months ago

Distribution

Slackware64-Current

Architecture

x86_64

Kernel version

6.9.5

Blksnap version

Branches VAL-6.0 or VAL-7.0 with commits as of 6/17/2024

Bug description

I am trying to compile the kernel module for use with Slackware64-Current. Before the kernel changed from 6.6 to 6.9, I had the module working with the VAL6.0 branch (as I am using Veeam 6.0), but now with kernel 6.9, I get the following output for "./mk.sh build"

Making ... make: Entering directory '/usr/src/linux-6.9.5' grep: warning: stray \ before # grep: warning: stray \ before # CC [M] /usr/src/blksnap/module/bdevfilter.o CC [M] /usr/src/blksnap/module/log.o CC [M] /usr/src/blksnap/module/big_buffer.o CC [M] /usr/src/blksnap/module/cbt_map.o CC [M] /usr/src/blksnap/module/chunk.o CC [M] /usr/src/blksnap/module/ctrl.o CC [M] /usr/src/blksnap/module/diff_io.o CC [M] /usr/src/blksnap/module/diff_area.o /usr/src/blksnap/module/log.c:246:5: warning: no previous prototype for ‘log_processor’ [-Wmissing-prototypes] 246 | int log_processor(void data) | ^~~~~ /usr/src/blksnap/module/diff_area.c: In function ‘diff_area_free’: /usr/src/blksnap/module/diff_area.c:128:17: error: implicit declaration of function ‘blkdev_put’; did you mean ‘bdev_fput’? [-Wimplicit-function-declaration] 128 | blkdev_put(diff_area->orig_bdev, NULL); | ^~~~~~ | bdev_fput CC [M] /usr/src/blksnap/module/diff_buffer.o /usr/src/blksnap/module/ctrl.c:438:5: warning: no previous prototype for ‘ioctl_mod’ [-Wmissing-prototypes] 438 | int ioctl_mod(unsigned long arg) | ^~~~~ /usr/src/blksnap/module/ctrl.c:448:5: warning: no previous prototype for ‘ioctl_setlog’ [-Wmissing-prototypes] 448 | int ioctl_setlog(unsigned long arg) | ^~~~ CC [M] /usr/src/blksnap/module/diff_storage.o /usr/src/blksnap/module/diff_area.c: In function ‘diff_area_new’: /usr/src/blksnap/module/diff_area.c:283:16: error: implicit declaration of function ‘blkdev_get_by_dev’; did you mean ‘blkdev_get_no_open’? [-Wimplicit-function-declaration] 283 | bdev = blkdev_get_by_dev(dev_id, FMODE_READ | FMODE_WRITE, NULL, NULL); | ^~~~~ | blkdev_get_no_open /usr/src/blksnap/module/diff_area.c:283:14: error: assignment to ‘struct block_device ’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] 283 | bdev = blkdev_get_by_dev(dev_id, FMODE_READ | FMODE_WRITE, NULL, NULL); | ^ /usr/src/blksnap/module/diff_io.c:45:6: warning: no previous prototype for ‘diff_io_endio’ [-Wmissing-prototypes] 45 | void diff_io_endio(struct bio *bio) | ^~~~~ make[2]: [scripts/Makefile.build:244: /usr/src/blksnap/module/diff_area.o] Error 1 make[2]: Waiting for unfinished jobs.... /usr/src/blksnap/module/diff_storage.c: In function ‘diff_storage_free’: /usr/src/blksnap/module/diff_storage.c:123:17: error: implicit declaration of function ‘blkdev_put’; did you mean ‘bdev_fput’? [-Wimplicit-function-declaration] 123 | blkdev_put(storage_bdev->bdev, NULL); | ^~~~~~ | bdev_fput /usr/src/blksnap/module/diff_storage.c: In function ‘diff_storage_add_storage_bdev’: /usr/src/blksnap/module/diff_storage.c:162:16: error: implicit declaration of function ‘blkdev_get_by_dev’; did you mean ‘blkdev_get_no_open’? [-Wimplicit-function-declaration] 162 | bdev = blkdev_get_by_dev(dev_id, FMODE_READ | FMODE_WRITE, NULL, NULL); | ^~~~~ | blkdev_get_no_open /usr/src/blksnap/module/diff_storage.c:162:14: error: assignment to ‘struct block_device *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] 162 | bdev = blkdev_get_by_dev(dev_id, FMODE_READ | FMODE_WRITE, NULL, NULL); | ^ make[2]: [scripts/Makefile.build:244: /usr/src/blksnap/module/diff_storage.o] Error 1 make[1]: [/usr/src/linux-6.9.5/Makefile:1918: /usr/src/blksnap/module] Error 2 make: *** [Makefile:240: __sub-make] Error 2 make: Leaving directory '/usr/src/linux-6.9.5'

Other branched of VAL-6.* give similar output. I am however able to compile using the VAL-7.0 branch, but when trying to load the module, it displays the following:

insmod: ERROR: could not insert module ./bdevfilter.ko: Operation not supported

and dmesg shows the following:

bdevfilter: Failed to get address of the 'get_option' bdevfilter: Failed to prepare pointers to internal functions

Trying to run "insmod blkveeamsnap.ko" results in:

insmod: ERROR: could not insert module veeamblksnap.ko: Unknown symbol in module

and dmesg shows:

veeamblksnap: Unknown symbol bdevfilter_register (err -2) veeamblksnap: Unknown symbol bdevfilter_free (err -2) veeamblksnap: Unknown symbol bdevfilter_detach_all (err -2) veeamblksnap: Unknown symbol bdevfilter_unregister (err -2) veeamblksnap: Unknown symbol submit_bio_noacct_notrace (err -2)

Assuming that the first four symbols are provided by the bdevfilter module, but wasn't sure about the last message so included it just in case.

Steps to reproduce

No response

Expected behavior

No response

Additional information

No response

diepeterpan commented 3 months ago

Same problem with Fedora and kernel 6.9.

Fantu commented 3 months ago

VAL-6.0 branch is old and not updated, support up to kernel 6.5 (probably also 6.6 if there were no changes to the used functions, I didn't remember)

Latest update are in VAL-6.1.2 and VAL-7.0 branches up to kernel 6.8

From a fast look 7.0 seems that have important changes (improvements from work for the upstream), so is not compatible with older VAL versions, 6.1.2 instead don't seem to have important changes so is possible that have API compatibility.

Work for upstream was updated for 6.9 (https://github.com/SergeiShtepa/linux/tree/blksnap-lk6.9) but FWIK is not compatible with VAL 6. Unfortunately, until blksnap will be integrated upstream, support for the new kernels will be "delayed" and if someone want "faster" support for the latest stable versions will have to compile it manually from git, if present, as other users have already done previously. In this case support for 6.9 seems still not present on branches of kernel module for VAL, need a reply from @SergeiShtepa to know if he already prepared it but not yet pushed.

SergeiShtepa commented 3 months ago

Hi, thanks for the feedback!

Yes, there is a problem with the 6.9 kernel. There is no fix in the VAL-6.1.2 branch yet. Strangely enough, no one from the support service has complained yet.

We are preparing for the next release VAL-6.2. It has support for new kernels. It is in testing. I have synchronized it with the public repository. There are no significant changes in this branch. Only bug fixes. But no one has tested the compatibility of the module from the VAL-6.2 branch with the 6.1.2 release. Therefore, no one can guarantee that it works.

I can only advise to contact support and/or wait for the next release.

In the VAL-7.0 branch, support for the 6.9 kernel is implemented, but this module is definitely not compatible with the 6.1.2 release.

barcoboy commented 3 months ago

Hi @SergeiShtepa, thanks for your response.

I just tried building and loading VAL-6.2 now, and it does build successfully, but I get the same issues trying to load the modules as I do with VAL-7.0 as mentioned above. But regardless of which version of Veeam I am running, if the module is able to be built, shouldn't it at least still load successfully, even if it isn't compatible with the agent? In other words, I should be able to build and load the modules even on a machine that doesn't have Veeam installed?

SergeiShtepa commented 3 months ago

barcoboy Yes, the module is an independent component. You can build it, load it to kernel, build the blksnap tool and create snapshots using console commands.

I do not know how you build it. I advise you to build packages and install them.

SergeiShtepa commented 3 months ago

insmod: ERROR: could not insert module veeamblksnap.ko: Unknown symbol in module

and dmesg shows:

veeamblksnap: Unknown symbol bdevfilter_register (err -2) veeamblksnap: Unknown symbol bdevfilter_free (err -2) veeamblksnap: Unknown symbol bdevfilter_detach_all (err -2) veeamblksnap: Unknown symbol bdevfilter_unregister (err -2) veeamblksnap: Unknown symbol submit_bio_noacct_notrace (err -2)

Please note that the module consists of two parts. One is veeamblksnap, the other is bdevfilter. Install the module correctly and use the modprobe command.

barcoboy commented 3 months ago

Here are the commands I am using to build the module:

cd /usr/src git clone --branch VAL-6.2 https://github.com/veeam/blksnap.git cd blksnap/module ./mk.sh build

If the compile is successful, I run "./mk.sh install", and then use modprobe to try to load the modules, but get the results:

modprobe: ERROR: could not insert 'bdevfilter': Operation not supported modprobe: ERROR: could not insert 'veeamblksnap': Operation not supported

...and dmesg shows the errors listed in my first post.

I've also tried "./mk.sh load" and got the same results.

Let me know if I am doing something wrong.

I am running the Slackware64-Current distribution, so Debian/Ubuntu packages are no good for me... have to compile from source.

Fantu commented 3 months ago

From a fast search seems that one user had it working with VAL-6.2 on Slackware64-current: https://www.linuxquestions.org/questions/slackware-14/slackware64-current-can%27t-compile-blksnap-kernel-module-4175737054/#post6510704

barcoboy commented 3 months ago

@Fantu that was me that started the forum post you linked to above. I have replied to the user who said he was able to compile VAL-6.2 to ask him if he is able to load the module after compiling, and linked back to the issue here.

lonestaritaly commented 3 months ago

@barcoboy Yes you're right. I had only checked that it compiles without errors, but actually when trying to modprobe the mod, it gives your same error. I tried with kernel 6.9.6.

dmesg after "modprobe veeamblksnap": [ 445.011356] bdevfilter: loading out-of-tree module taints kernel. [ 445.011915] bdevfilter: Failed to get address of the 'get_option' [ 445.011918] bdevfilter: Failed to prepare pointers to internal functions

What Slackware64-current uses is really the vanilla kernel from www.kernel.org, so it seems to me that it should be not really an issue related to the distribution in use but something inherent to the module and the kernel 6.9.x

SergeiShtepa commented 3 months ago

Hi! I checked it out. Autotests are successful on Debian 12 with kernel 6.9.7-zabbly+.

@lonestaritaly - I'm guessing the problem is specific to your kernel configuration.

[ 445.011915] bdevfilter: Failed to get address of the 'get_option' [ 445.011918] bdevfilter: Failed to prepare pointers to internal functions

These messages inform us that the module was unable to perform initialization. See: https://github.com/veeam/blksnap/blob/VAL-6.2/module/bdevfilter.c#L482 Due to the fact that they could not get the address of the 'get_option' function. See: https://github.com/veeam/blksnap/blob/VAL-6.2/module/bdevfilter.c#L445 Because the register_kprobe() function failed with an error code.

Please look at your kernel configs. This is usually /boot/config-\<kernel version>. You need to check the CONFIGKPROBES* configs. You may need to rebuild the kernel by changing these configurations. We already had a similar problem with liquorix kernel.

lonestaritaly commented 3 months ago

Hello @SergeiShtepa

Please look at your kernel configs. This is usually /boot/config-. You need to check the CONFIGKPROBES* configs. You may need to rebuild the kernel by changing these configurations. We already had a similar problem with liquorix kernel.

I did recompile the kernel with CONFIG_KPROBES enabled and it does load the module without any errors:

[  144.292506] bdevfilter: loading out-of-tree module taints kernel.
[  144.433308] veeamblksnap: Loading
[  144.433414] veeamblksnap-snapimage: Snapshot image block device major 250 was registered
[  144.433419] veeamblksnap-ctrl: Register control device [235:0].
[  144.433462] veeamblksnap-sysfs: Create 'major' sysfs attribute

lsmod | grep veeam:

root@opensim:/usr/src/blksnap/module# lsmod | grep veeam
veeamblksnap          180224  0
bdevfilter             12288  1 veeamblksnap

Gotta see how it goes with the backup itself. Thanks a lot!

lonestaritaly commented 3 months ago

@SergeiShtepa @barcoboy I confirm that it works. After the modules being correctly loaded, the backup with agent was successful.

SergeiShtepa commented 3 months ago

@lonestaritaly Great! I'm glad I could help.

But I have to remind everyone that the module from the VAL-6.2 branch is still in the testing stage. Slackware is also not included in the list of supported distributions for Veeam Agent. See release notes.

I will close this issue when version 6.2 is released.

es-x commented 2 months ago

worked on fedora 40 with kernel 6.9.8-200.fc40.x86_64

cd /usr/src
git clone --branch VAL-6.2 https://github.com/veeam/blksnap.git
cd blksnap/module
./mk.sh build
./mk.sh install 
sudo lsmod | grep veeam
veeamblksnap          217088  2
bdevfilter             20480  1 veeamblksnap
SergeiShtepa commented 1 month ago

Veeam Agent for Linux 6.2 has been released. Kernel versions 6.9 and 6.10 are supported.