-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hard time installing the python bindings #8
Comments
So you probably want to know first of all that this isn't the main libnbd repo, that's: https://gitlab.com/nbdkit/libnbd But in answer to your question, can you give a bit more information like .. what system you're using, what you've tried, and that sort of thing? |
Thank you for the quick response, so I'm using ubuntu 22.04 and I installed a package called virtnbdbackup: https://github.com/abbbi/virtnbdbackup which creates full backups for running virtual machines. The virtnbdbackup package has a "python3-libnbd" dependency, unfortunately the "python3-libnbd" package provided by ubuntu is an old version "1.10.5-1". So I downloaded the latest tarball https://download.libguestfs.org/libnbd/1.16-stable/libnbd-1.16.3.tar.gz. I followed the instructions to build it: ./configure It built the code without any errors, the problem is that I don't know how to integrate the python library that was built into the ubuntu's python packages. Since you are the author I was hoping that maybe you could guide me in the right direction. Thank you. |
One way to use libnbd & python is to use the
which will set up some Another way would be to use a Python virtualenv, but TBH I'm not very familiar with how that would work with the libnbd bindings. We might be able to add support for building a venv possibly. (@nirs any ideas??) |
Thank you. |
There is a script for creating venv here: I tested the basic steps and they work. But the venv does not isolate from I think a better way would be to install virtnbdbackup in a container: |
Unfortunately a docker container is not an option for this project, however the solution you suggested about running the program this way kind of works:
The above solution tries to run virtnbdbackup but then it throws the following error:
Then I checked the libnbd python directory and the libnbdmod.py is missing, however there is a libnbdmod.c, it looks like the libnbdmod.py is not being generated at built time. |
@ctorres-addc did you check the script for creating venv? |
There should exist |
To be clear there is never any file called |
It doesn't look like anything was built in the Did it detect Python during the What happens if you do |
Hello, this is what I get when I run |
Python wasn't configured. You need to install |
Or install all the build dependencies listed here: https://salsa.debian.org/debian/libnbd/-/blob/debian/master/debian/control |
OCaml 5 is stricter than earlier versions about correct locking. We must release the OCaml runtime lock when calling nbd_close since it may do some long-running operations and we want to allow concurrent threads to run. However specifically if there are callbacks (eg. a debug callback) then we would end up trying to re-acquire the lock in the callback, resulting in a crash: (gdb) bt #0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44 libguestfs#1 0x00007f47ffc8f773 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78 libguestfs#2 0x00007f47ffc3e71e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 libguestfs#3 0x00007f47ffc2687f in __GI_abort () at abort.c:79 libguestfs#4 0x0000560c9eb62779 in caml_fatal_error () libguestfs#5 0x0000560c9eb63238 in caml_plat_fatal_error () libguestfs#6 0x0000560c9eb4ea77 in caml_acquire_domain_lock () libguestfs#7 0x0000560c9eb65cdc in caml_leave_blocking_section () libguestfs#8 0x0000560c9eaf8a87 in debug_wrapper (user_data=0x560ca0af2670, context=0x7f47fff8ca60 "nbd_close", msg=0x560ca0af28b0 "closing handle") at ../nbd-c.c:187 #9 0x00007f47fff7072f in nbd_internal_debug (h=h@entry=0x560ca0b57db0, context=0x7f47fff8ca60 "nbd_close", context@entry=0x0, fs=fs@entry=0x7f47fff8ca6a "closing handle") at /home/rjones/d/libnbd/lib/debug.c:90 #10 0x00007f47fff73f23 in nbd_close (h=0x560ca0b57db0) at /home/rjones/d/libnbd/lib/handle.c:127 #11 0x0000560c9eae8dbe in nbd_internal_ocaml_handle_finalize ( hv=<optimized out>) at ../handle.c:39 #12 nbd_internal_ocaml_nbd_close (hv=<optimized out>) at ../handle.c:62 #13 <signal handler called> #14 0x0000560c9eae84dc in camlTest_140_explicit_close__entry () at NBD.ml:148 #15 0x0000560c9eae5c5b in caml_program () #16 <signal handler called> #17 0x0000560c9eb6cb77 in caml_startup_common () #18 0x0000560c9eb6cbef in caml_main () #19 0x0000560c9eae5910 in main ()
Thank you for the support and the quick responses, I solved the issue by using Debian 12 instead of Ubuntu 22.04 and installing this package https://packages.debian.org/bookworm/virtnbdbackup. |
Would you please care to explain how to install the python bindings, I already built the code and I don't know how to make this library available to python. Thank you.
The text was updated successfully, but these errors were encountered: