ImportError: librsync.so.1: cannot open shared object file

Asked by Ashish Ranjan on 2019-10-01

I've tried following instructions from other links related to this, but it is still not working.

https://serverfault.com/questions/807554/duplicity-0-7-10-fails-after-upgrading-librsync-in-ubuntu-14-04
https://duplicity-talk.nongnu.narkive.com/2tg0Qnxn/problem-with-librsync-so
https://lists.nongnu.org/archive/html/duplicity-talk/2015-05/msg00001.html
https://bugs.launchpad.net/ubuntu/+source/duplicity/+bug/1845599

I also understand that this issue might not be related to duplicity, however if someone could guide me in the right direction it would be really helpful. I've searched StackOverflow, but to no avail.

System: Debian 10
Librsync version 0.9.7-10+b1

Let's say I'm currently in /home/ashish/projects

Steps to reproduce:
1. Install duplicity

sudo apt update
sudo apt install librsync-dev

wget https://code.launchpad.net/duplicity/0.8-series/0.8.04/+download/duplicity-0.8.04.tar.gz
tar xf duplicity-0.8.04.tar.gz

cd duplicity-0.8.04

python3.7 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
pip install pydrive

./compilec.py

deactivate

2. Run duplicity with pydrive as backend

PYTHONPATH=".:.venv/lib/python3.7/site-packages" ./bin/duplicity . gdocs://<email address hidden>/backups/duplicity

ERROR:

Traceback (most recent call last):
  File "./bin/duplicity", line 55, in <module>
    from duplicity.dup_main import main
  File "/home/ashish/projects/duplicity-0.8.04/duplicity/dup_main.py", line 56, in <module>
    from . import commandline
  File "/home/ashish/projects/duplicity-0.8.04/duplicity/commandline.py", line 42, in <module>
    from duplicity import backend
  File "/home/ashish/projects/duplicity-0.8.04/duplicity/backend.py", line 46, in <module>
    from duplicity import dup_temp
  File "/home/ashish/projects/duplicity-0.8.04/duplicity/dup_temp.py", line 31, in <module>
    from duplicity import path
  File "/home/ashish/projects/duplicity-0.8.04/duplicity/path.py", line 47, in <module>
    from duplicity import librsync
  File "/home/ashish/projects/duplicity-0.8.04/duplicity/librsync.py", line 33, in <module>
    from . import _librsync
ImportError: librsync.so.1: cannot open shared object file: No such file or directory

$ ldd duplicity/_librsync.cpython-37m-x86_64-linux-gnu.so

        linux-vdso.so.1 (0x00007ffd18366000)
        librsync.so.1 => /usr/lib/x86_64-linux-gnu/librsync.so.1 (0x00007f8a0f9c3000)
        libpython3.7m.so.1.0 => not found
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8a0f7a6000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8a0f407000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f8a0fdd5000)

I can clearly see that librsync.so.1 is present in cache using,

$ sudo ldconfig -v | grep librsync

ldconfig: Path `/usr/local/lib' given more than once
ldconfig: Path `/lib/x86_64-linux-gnu' given more than once
ldconfig: Path `/usr/lib/x86_64-linux-gnu' given more than once
ldconfig: /lib/x86_64-linux-gnu/ld-2.24.so is the dynamic linker, ignoring

        librsync.so.1 -> librsync.so.1.0.2

$ ls -la /usr/lib/x86_64-linux-gnu/librsync*

lrwxrwxrwx 1 root root 17 Oct 1 08:28 /usr/lib/x86_64-linux-gnu/librsync.so -> librsync.so.1.0.2
lrwxrwxrwx 1 root root 17 Oct 1 08:28 /usr/lib/x86_64-linux-gnu/librsync.so.1 -> librsync.so.1.0.2
-rw-r--r-- 1 root root 56128 Jun 26 2013 /usr/lib/x86_64-linux-gnu/librsync.so.1.0.2

$ ldd /usr/lib/x86_64-linux-gnu/librsync.so

        linux-vdso.so.1 (0x00007fff1eb1b000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f124daf2000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f124e09f000)

Question information

Language:
English Edit question
Status:
Answered
For:
Duplicity Edit question
Assignee:
No assignee Edit question
Last query:
2019-10-02
Last reply:
2019-10-04

librsync.so will not show up on ldconfig. It's compiled into the duplicity directory during install using setup.py. It specifically does not follow normal naming conventions, it's only 'librsync.so'. it looks like it was compiled into the venv. Check the directory "/home/ashish/projects/duplicity-0.8.04/duplicity". There should be a librsync.so file in there.

You might want to run ./setup.py in "/home/ashish/projects/duplicity-0.8.04" to set things up.

Ashish Ranjan (musq) said : #2

So, I repeated the above installation steps, and instead of ./compilec.py, I ran,

$ ./setup.py install

It ran build scripts and copied stuff into the appropriate .venv directories. A complete dump of this command is provided at https://privatebin.net/?5bfbb987d3f66345#GT1VgdFBJkVGb1HkX9B7oC5nHDbkva7R2oDChTRQtset

Then I ran,

$ PYTHONPATH=".venv/lib/python3.7/site-packages" ./bin/duplicity . gdocs://<email address hidden>/backups/duplicity

It still gives the same error.
Also, I'm unable to find librsync.so anywhere in the .venv directory. (I'm using https://github.com/sharkdp/fd as an alternative to the find command).

$ fd -H librsync

.venv/lib/python3.7/site-packages/duplicity/__pycache__/librsync.cpython-37.pyc
.venv/lib/python3.7/site-packages/duplicity/_librsync.cpython-37m-x86_64-linux-gnu.so
.venv/lib/python3.7/site-packages/duplicity/librsync.py
build/lib.linux-x86_64-3.7/duplicity/_librsync.cpython-37m-x86_64-linux-gnu.so
build/lib.linux-x86_64-3.7/duplicity/librsync.py
build/temp.linux-x86_64-3.7/duplicity/_librsyncmodule.o
docs/duplicity.librsync.rst
duplicity/__pycache__/librsync.cpython-37.pyc
duplicity/_librsyncmodule.c
duplicity/librsync.py

edso (ed.so) said : #3

hey Ash,

looks like your problems lies with using venv . either do not use it or find out why loading native libraries might fail in this scenario.

Workaround:
you might wanna try a proven and working method to install multiple duplicity versions as described here (under TIPS)
  https://duply.net/wiki/index.php/Duply-documentation

good luck.. ede/duply.net

Ashish Ranjan (musq) said : #4

I'll try your suggestions. Thank you so much for getting back to me.

Can you help with this problem?

Provide an answer of your own, or ask Ashish Ranjan for more information if necessary.

To post a message you must log in.