Yabbie
Posts: 25
Joined: Mon Oct 12, 2020 5:02 am

Deluge not working on bullseye

Wed Nov 10, 2021 10:51 am

Hello,

I've installed Deluge and when I run it, I get this:

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/_libtorrent.py", line 23, in <module>
    import deluge.libtorrent as lt
ModuleNotFoundError: No module named 'deluge.libtorrent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/deluged", line 33, in <module>
    sys.exit(load_entry_point('deluge==2.0.3', 'console_scripts', 'deluged')())
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 90, in start_daemon
    from deluge.core.daemon import is_daemon_running
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 22, in <module>
    from deluge.core.core import Core
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 28, in <module>
    from deluge._libtorrent import LT_VERSION, lt
  File "/usr/lib/python3/dist-packages/deluge/_libtorrent.py", line 25, in <module>
    import libtorrent as lt
ImportError: /lib/arm-linux-gnueabihf/libtorrent-rasterbar.so.10: undefined symbol: __atomic_fetch_add_8
Raspberry Pi4
Bullseye
I've run a update and upgrade

Is anyone able to help?

LTolledo
Posts: 6657
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Deluge not working on bullseye

Wed Nov 10, 2021 12:53 pm

I've tried installing and running deluge on a bullseye headless setup....
but on another SBC....
and it worked fine...
its starting some downloads now....

have not tried it yet on the RPi board as the RPiOS bullseye version seems to be having some "teething problems" at this point...

oh... make sure that all python commands are in python3
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

Yabbie
Posts: 25
Joined: Mon Oct 12, 2020 5:02 am

Re: Deluge not working on bullseye

Thu Nov 11, 2021 2:26 am

LTolledo wrote: have not tried it yet on the RPi board as the RPiOS bullseye version seems to be having some "teething problems" at this point...
Hmm. Was afraid that was the case.
LTolledo wrote:oh... make sure that all python commands are in python3
I would have thought all that would be updated as part of the install of Deluge?

dudmuck
Posts: 9
Joined: Mon Feb 29, 2016 8:54 pm

Re: Deluge not working on bullseye

Thu Nov 11, 2021 2:03 pm

the required symbol is in /lib/arm-linux-gnueabihf/libatomic.so.1.2.0
but ldd /lib/arm-linux-gnueabihf/libtorrent-rasterbar.so.10 doesnt list libatomic as a dependency.
LD_PRELOAD is something that can force the dependency.
I'm not sure how to do that with a python daemon.

Zakave
Posts: 1
Joined: Mon Nov 15, 2021 6:30 am

Re: Deluge not working on bullseye

Mon Nov 15, 2021 6:32 am

I am seeing exactly the same issue as OP, fresh install on rbpi4 with Raspbian bullseye.

Similar post over on the Deluge forums, maybe this will mean something to someone:
https://forum.deluge-torrent.org/viewto ... ye#p233810
Last edited by Zakave on Mon Nov 15, 2021 6:52 am, edited 1 time in total.

dudmuck
Posts: 9
Joined: Mon Feb 29, 2016 8:54 pm

Re: Deluge not working on bullseye

Wed Nov 17, 2021 1:05 am

libtorrent-rasterbar-1.2.4 can be built correctly using

Code: Select all

 LIBS=-latomic ./configure --enable-python-binding --with-libiconv --with-boost-libdir=/usr/lib/arm-linux-gnueabihf
deluge doesnt work with libtorrent-rasterbar-2,
Deluge-2.0.3 builds correctly with 1.2.4 library, but something else wrong is still going on because deluge-web isnt saving anything, and i get a traceback
builtins.TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given

madkrok
Posts: 3
Joined: Sun Nov 21, 2021 12:38 pm

Re: Deluge not working on bullseye

Tue Nov 23, 2021 10:07 am

dudmuck wrote:
Wed Nov 17, 2021 1:05 am
libtorrent-rasterbar-1.2.4 can be built correctly using

Code: Select all

 LIBS=-latomic ./configure --enable-python-binding --with-libiconv --with-boost-libdir=/usr/lib/arm-linux-gnueabihf
deluge doesnt work with libtorrent-rasterbar-2,
Deluge-2.0.3 builds correctly with 1.2.4 library, but something else wrong is still going on because deluge-web isnt saving anything, and i get a traceback
builtins.TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given
Hello, I have attempted building libtorrent-rasterbar-1.2.4 following your suggestion above and building instructions on Deluge website, but for some reason I seem to end up with a 64bit version of the library.

I end up with the following error when attempting to import libtorrent from a Python prompt:

Code: Select all

ImportError: /usr/local/lib/python3.9/dist-packages/libtorrent.so: wrong ELF class: ELFCLASS64
Did you configure anything explicitly to obtain a 32bit version? Thanks!

jools72
Posts: 131
Joined: Sun Sep 29, 2019 12:40 pm

Re: Deluge not working on bullseye

Tue Nov 23, 2021 12:17 pm

dudmuck wrote:
Wed Nov 17, 2021 1:05 am
libtorrent-rasterbar-1.2.4 can be built correctly using

Code: Select all

 LIBS=-latomic ./configure --enable-python-binding --with-libiconv --with-boost-libdir=/usr/lib/arm-linux-gnueabihf
deluge doesnt work with libtorrent-rasterbar-2,
Deluge-2.0.3 builds correctly with 1.2.4 library, but something else wrong is still going on because deluge-web isnt saving anything, and i get a traceback
builtins.TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given
You need a newer deluge. That error has been fixed in a patch after version 2.0.3. Try installing the dev version from git. Why they cannot release 2.0.4? I don't know :roll:

jools72
Posts: 131
Joined: Sun Sep 29, 2019 12:40 pm

Re: Deluge not working on bullseye

Wed Nov 24, 2021 4:27 pm

dudmuck wrote:
Wed Nov 17, 2021 1:05 am
libtorrent-rasterbar-1.2.4 can be built correctly using

Code: Select all

 LIBS=-latomic ./configure --enable-python-binding --with-libiconv --with-boost-libdir=/usr/lib/arm-linux-gnueabihf
deluge doesnt work with libtorrent-rasterbar-2,
Deluge-2.0.3 builds correctly with 1.2.4 library, but something else wrong is still going on because deluge-web isnt saving anything, and i get a traceback
builtins.TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given
Use this version of you have arm64 instead:

Code: Select all

LIBS=-latomic ./configure --enable-python-binding --with-libiconv --with-boost-libdir=/usr/lib/aarch64-linux-gnu

kapitainsky
Posts: 11
Joined: Wed Jan 26, 2022 1:53 pm

Re: Deluge not working on bullseye

Wed Jan 26, 2022 2:12 pm

dudmuck wrote:
Thu Nov 11, 2021 2:03 pm
the required symbol is in /lib/arm-linux-gnueabihf/libatomic.so.1.2.0
but ldd /lib/arm-linux-gnueabihf/libtorrent-rasterbar.so.10 doesnt list libatomic as a dependency.
LD_PRELOAD is something that can force the dependency.
I'm not sure how to do that with a python daemon.
I have managed to make Deluge 2.0.5 work:

Code: Select all

sudo pip install deluge
with libtorrent 2.0.5, build from source:

Code: Select all

python setup.py build && sudo python setup.py install
The trick was to make sure that debian libtorrent is removed

Code: Select all

sudo apt remove python3-libtorrent libtorrent-rasterbar10
and LD_PRELOAD is set for user running deluge.

The easiest was to add LD_PRELOAD to deluged systemd:

Code: Select all

[Service]
Environment="LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0"

Dranoc
Posts: 2
Joined: Thu Feb 10, 2022 1:56 pm

Re: Deluge not working on bullseye

Mon Feb 14, 2022 2:10 pm

Hi everybody are raspberry os devs aware of this issue ?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 14923
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Deluge not working on bullseye

Mon Feb 14, 2022 7:03 pm

Dranoc wrote:
Mon Feb 14, 2022 2:10 pm
Hi everybody are raspberry os devs aware of this issue ?
ask them where the developers are, that is NOT here!

kapitainsky
Posts: 11
Joined: Wed Jan 26, 2022 1:53 pm

Re: Deluge not working on bullseye

Mon Feb 14, 2022 7:07 pm

Dranoc wrote:
Mon Feb 14, 2022 2:10 pm
Hi everybody are raspberry os devs aware of this issue ?
There is no point to worry about it anymore as 64 bit version of raspberry pi OS does not have this problem anymore.

I find it the biggest advantage of moving to 64 bits - a lot of 3rd party devs focus pretty much only on 64 bit versions of their software not spending time to fix some 32 bits quirks.

Dranoc
Posts: 2
Joined: Thu Feb 10, 2022 1:56 pm

Re: Deluge not working on bullseye

Sun Feb 20, 2022 2:29 am

mahjongg wrote:
Dranoc wrote:
Mon Feb 14, 2022 2:10 pm
Hi everybody are raspberry os devs aware of this issue ?
ask them where the developers are, that is NOT here!
Hi I am sorry but I thought they were on the forum too... And I didn't know that was an annoying question.
kapitainsky wrote:
Dranoc wrote:
Mon Feb 14, 2022 2:10 pm
Hi everybody are raspberry os devs aware of this issue ?
There is no point to worry about it anymore as 64 bit version of raspberry pi OS does not have this problem anymore.

I find it the biggest advantage of moving to 64 bits - a lot of 3rd party devs focus pretty much only on 64 bit versions of their software not spending time to fix some 32 bits quirks.
I am on Raspberry OS lite x64 and my deluge-web is dead via systemd so I don't know how you have resolved the issue ...
Same configuration worked on Buster x64 too so ...

john.lescault
Posts: 5
Joined: Sun Nov 10, 2019 1:23 pm

Re: Deluge not working on bullseye

Thu Feb 24, 2022 1:12 am

Dranoc wrote:
Sun Feb 20, 2022 2:29 am
mahjongg wrote:
Dranoc wrote:
Mon Feb 14, 2022 2:10 pm
Hi everybody are raspberry os devs aware of this issue ?
ask them where the developers are, that is NOT here!
Hi I am sorry but I thought they were on the forum too... And I didn't know that was an annoying question.
kapitainsky wrote:
Dranoc wrote:
Mon Feb 14, 2022 2:10 pm
Hi everybody are raspberry os devs aware of this issue ?
There is no point to worry about it anymore as 64 bit version of raspberry pi OS does not have this problem anymore.

I find it the biggest advantage of moving to 64 bits - a lot of 3rd party devs focus pretty much only on 64 bit versions of their software not spending time to fix some 32 bits quirks.
I am on Raspberry OS lite x64 and my deluge-web is dead via systemd so I don't know how you have resolved the issue ...
Same configuration worked on Buster x64 too so ...
I am also on a fresh install of Raspberry OS lite x64. Having issued with deluged running the server. Web or my clients can't connect.

kapitainsky
Posts: 11
Joined: Wed Jan 26, 2022 1:53 pm

Re: Deluge not working on bullseye

Thu Feb 24, 2022 10:36 am

john.lescault wrote:
Thu Feb 24, 2022 1:12 am
I am also on a fresh install of Raspberry OS lite x64. Having issued with deluged running the server. Web or my clients can't connect.
You have to troubleshoot it step by step.

Is your server (deluged.service) running? Can you connect to its port locally?

Then move to deluge-web.service - is it running? can you connect to its port locally?

I am running deluge 2.0.5 and libtorrent 2.0.5 without any issues but to configure everything properly some work was required.

kapitainsky
Posts: 11
Joined: Wed Jan 26, 2022 1:53 pm

Re: Deluge not working on bullseye

Thu Feb 24, 2022 11:24 am

Here you are my steps to make all working:

0. if installed uninstall debian provided software (it is old anyway)

Code: Select all

sudo apt remove python3-libtorrent libtorrent-rasterbar10 
sudo apt remove deluged deluge-web deluge-console 
sudo apt autoremove
1. install latest libtorrent

Code: Select all

sudo apt install libboost-tools-dev libboost-dev libboost-system-dev libboost-python-dev

git clone --recurse-submodules https://github.com/arvidn/libtorrent.git

cd libtorrent

python setup.py build

sudo python setup.py install
2. install the latest deluge via pip

Code: Select all

sudo pip install deluge[All]
3. Follow deluge instructions to configure all needed services:

https://deluge.readthedocs.io/en/latest ... rvice.html

Here are my services files,

/etc/systemd/system/deluged.service

Code: Select all

[Unit]
Description=Deluge Bittorrent Client Daemon
Documentation=man:deluged
After=network-online.target

[Service]
Type=simple
UMask=007

Environment="LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0"

ExecStart=/usr/local/bin/deluged -d

Restart=on-failure

# Time to wait before forcefully stopped.
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target
/etc/systemd/system/deluge-web.service

Code: Select all

[Unit]
Description=Deluge Bittorrent Client Web Interface
Documentation=man:deluge-web
After=network-online.target deluged.service
Wants=deluged.service

[Service]
Type=simple
UMask=027

ExecStart=/usr/local/bin/deluge-web -d

Restart=on-failure

[Install]
WantedBy=multi-user.target
4. At least for 32 bit version of raspbian add the following to deluged.service [Service] section:

Code: Select all

[Service]
Environment="LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0"
Now you should have the latest deluge and libtorrent working

sudo systemctl status deluge-web.service deluged.service

Code: Select all

● deluge-web.service - Deluge Bittorrent Client Web Interface
     Loaded: loaded (/etc/systemd/system/deluge-web.service; disabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/deluge-web.service.d
             └─user.conf
     Active: active (running) since Thu 2022-02-24 13:02:36 CET; 3s ago
       Docs: man:deluge-web
   Main PID: 6688 (deluge-web)
      Tasks: 1 (limit: 3749)
        CPU: 1.827s
     CGroup: /system.slice/deluge-web.service
             └─6688 deluge-web

Feb 24 13:02:36 bikuben systemd[1]: Started Deluge Bittorrent Client Web Interface.

● deluged.service - Deluge Bittorrent Client Daemon
     Loaded: loaded (/etc/systemd/system/deluged.service; disabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/deluged.service.d
             └─user.conf
     Active: active (running) since Thu 2022-02-24 13:02:36 CET; 3s ago
       Docs: man:deluged
   Main PID: 6687 (deluged)
      Tasks: 3 (limit: 3749)
        CPU: 1.800s
     CGroup: /system.slice/deluged.service
             └─6687 /usr/bin/python3 /usr/local/bin/deluged -d

Feb 24 13:02:36 bikuben systemd[1]: Started Deluge Bittorrent Client Daemon.

Yabbie
Posts: 25
Joined: Mon Oct 12, 2020 5:02 am

Re: Deluge not working on bullseye

Thu Mar 24, 2022 12:12 pm

So months later, and I've tried again.

I've created a deluged.service and deluge-web.service, and both appear to work.

Via my browser, I can connect to the web client, but when I try and download, that's when the problems start.

I tried accessing deluged via the console, and after just sitting there, when I quit, I get this:

Code: Select all

Unhandled error in Deferred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/deluge/ui/client.py", line 436, in __on_login_fail
    login_deferred.errback(result)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 501, in errback
    self._startRunCallbacks(fail)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/deluge/ui/client.py", line 408, in __on_connect_fail
    self.daemon_info_deferred.errback(reason)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 501, in errback
    self._startRunCallbacks(fail)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 561, in _startRunCallbacks
    raise AlreadyCalledError
twisted.internet.defer.AlreadyCalledError:

Temporarily disabling observer LegacyLogObserverWrapper(<bound method TwistedLoggingObserver.emit of <deluge.log.TwistedLoggingObserver object at 0x7fa7c8e340>>) due to exception: [Failure instance: Traceback: <class 'TypeError'>: findCaller() takes from 1 to 2 positional arguments but 3 were given
/usr/lib/python3/dist-packages/twisted/internet/defer.py:962:__del__
/usr/lib/python3/dist-packages/twisted/logger/_logger.py:190:failure
/usr/lib/python3/dist-packages/twisted/logger/_logger.py:144:emit
--- <exception caught here> ---
/usr/lib/python3/dist-packages/twisted/logger/_observer.py:131:__call__
/usr/lib/python3/dist-packages/twisted/logger/_legacy.py:93:__call__
/usr/lib/python3/dist-packages/deluge/log.py:204:emit
/usr/lib/python3.9/logging/__init__.py:1489:critical
/usr/lib/python3.9/logging/__init__.py:1573:_log
]
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 962, in __del__
    log.failure(format,
  File "/usr/lib/python3/dist-packages/twisted/logger/_logger.py", line 190, in failure
    self.emit(level, format, log_failure=failure, **kwargs)
  File "/usr/lib/python3/dist-packages/twisted/logger/_logger.py", line 144, in emit
    self.observer(event)
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/logger/_observer.py", line 131, in __call__
    observer(event)
  File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 93, in __call__
    self.legacyObserver(event)
  File "/usr/lib/python3/dist-packages/deluge/log.py", line 204, in emit
    getattr(LoggingLoggerClass, event_dict['log_level'].name)(
  File "/usr/lib/python3.9/logging/__init__.py", line 1489, in critical
    self._log(CRITICAL, msg, args, **kwargs)
  File "/usr/lib/python3.9/logging/__init__.py", line 1573, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
builtins.TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given
I'm running:
Pi OS Bullseye
Deluge 2.0.3

Yabbie
Posts: 25
Joined: Mon Oct 12, 2020 5:02 am

Re: Deluge not working on bullseye

Thu Mar 24, 2022 12:27 pm

Hmm. I seem to have "fixed" it.

Changed UMask=007 to UMask=000 in the deluged.service and boom! All working.

Code: Select all

[Service]
Type=simple
UMask=000

ExecStart=/usr/bin/deluged -d

Restart=on-failure
I don't understand why this works? I believe setting a umask of 000 is "bad"? Why doesn't 007 work?

Following various guides to setup Deluge, I haven't created any new "users" or anything, so everything should just be the pi user, right? In that case, why does the umask 000 thing fix things?

Appreciate any help.

Yabbie
Posts: 25
Joined: Mon Oct 12, 2020 5:02 am

Re: Deluge not working on bullseye

Thu Mar 24, 2022 1:24 pm

Ok, spoke too soon. Deluge console doesn't work. I still get the error(s) above (Unhandled error in Deferred).

Yabbie
Posts: 25
Joined: Mon Oct 12, 2020 5:02 am

Re: Deluge not working on bullseye

Thu Mar 24, 2022 1:25 pm

I think all my issues are related to users and permissions.

Yabbie
Posts: 25
Joined: Mon Oct 12, 2020 5:02 am

Re: Deluge not working on bullseye

Thu Mar 24, 2022 1:41 pm

This is definately a mixture of user permissions and a bug I think.

Because I didn't create a deluge user and group (I assumed things would default to 'pi') some funky things happened.

ls -l in /var/lib revealed deluged is owned (I think) by debian-deluged. This is not a user I created.

sudo -u pi deluge-console doesn't work (same issue described previously).
sudo -u debian-deluged deluge-console doesn't work.
sudo -u root deluge-console DOES WORK!

Sorry, it's getting late where I am, and I'm tired and getting confused, lol.

Hopefully someone can explain to me the user situation I have (seemingly) created and which is causing all the issues!

kapitainsky
Posts: 11
Joined: Wed Jan 26, 2022 1:53 pm

Re: Deluge not working on bullseye

Thu Mar 24, 2022 2:06 pm

Yabbie wrote:
Thu Mar 24, 2022 1:41 pm
This is definately a mixture of user permissions and a bug I think.

Because I didn't create a deluge user and group (I assumed things would default to 'pi') some funky things happened.

ls -l in /var/lib revealed deluged is owned (I think) by debian-deluged. This is not a user I created.

sudo -u pi deluge-console doesn't work (same issue described previously).
sudo -u debian-deluged deluge-console doesn't work.
sudo -u root deluge-console DOES WORK!

Sorry, it's getting late where I am, and I'm tired and getting confused, lol.

Hopefully someone can explain to me the user situation I have (seemingly) created and which is causing all the issues!
Yes looks like you run deluged as root.

when you run deluge as USER it uses config from this USER home this is why when you follow:

https://deluge.readthedocs.io/en/latest ... rvice.html

it explicitely set HOME of deluged user to /var/lib/deluge

Code: Select all

sudo adduser --system  --gecos "Deluge Service" --disabled-password --group --home /var/lib/deluge deluge
when you run as root it uses config from $ROOT_HOME/.config/deluge

it does not matter really what user you use but you have to make sure that both deluged and deluge-web are run as the same user.

It is not good practive to run programs as root. My best advice is that if you are not sure just follow deluged services guide exactly - without modifications.

Yabbie
Posts: 25
Joined: Mon Oct 12, 2020 5:02 am

Re: Deluge not working on bullseye

Thu Mar 24, 2022 2:09 pm

kapitainsky wrote:
Thu Mar 24, 2022 2:06 pm
It is not good practive to run programs as root. My best advice is that if you are not sure just follow deluged services guide exactly - without modifications.
Thanks for the reply.

I want to run as pi. I'm literally working on it now. I got it working using those instructions, but using pi. It worked. Just have to see if it survived reboot.

kapitainsky
Posts: 11
Joined: Wed Jan 26, 2022 1:53 pm

Re: Deluge not working on bullseye

Thu Mar 24, 2022 2:13 pm

Yabbie wrote:
Thu Mar 24, 2022 2:09 pm
kapitainsky wrote:
Thu Mar 24, 2022 2:06 pm
It is not good practive to run programs as root. My best advice is that if you are not sure just follow deluged services guide exactly - without modifications.
Thanks for the reply.

I want to run as pi. I'm literally working on it now. I got it working using those instructions, but using pi. It worked. Just have to see if it survived reboot.
Sure running as pi is also an option - but your config won't be in /var/lib/deluge/.config/deluge but in /home/pi/.config/deluge

You have to also make sure that in services config you speciafy pi user

Return to “Troubleshooting”