[Debian12] Fresh install - Torrents paused, unable to resume.

General support for problems installing or using Deluge
toastboy
New User
New User
Posts: 6
Joined: Sat Jan 27, 2024 4:24 pm

[Debian12] Fresh install - Torrents paused, unable to resume.

Post by toastboy »

Hi guys!
So, I was trying to run deluged on my new home server, but it's bug-city! :cry:
The server is running Debian Bookworm (12.4); I've done a regular install from the repo ('# apt install deluged') -
which currently results in:
* deluged 2.0.3
* libtorrent: 2.0.8.0
* Python: 3.11.2

Then disabled the systemd service that is for some reason auto-enabled ('# systemctl disable deluged.service');
Started deluged ('$ deluged'); killed it ('$ pkill deluged'); edited core.conf and auth to enable remote access.
Downloaded ltConfig.egg to /plugins.
Started deluged again; connected via thin client to deluged.
It got my IP correctly and started connecting to DHT nodes.
Changed a few settings:
* download -> set folders for download and move on completion
* bandwidth -> raised the values+disabled rate limiting overhead
* queue -> raised the values+ignore slow torrents
* network -> enabled encryption
* plugins -> enabled blocklist+ltConfig
* ltConfig -> enabled announce to all tiers+announce to all trackers

Then tried a test-torrent:
Dropped torrent file in thin client -> torrent immediately paused.
Note: the "add paused" option was not enabled!
"Resume" not working.


Went back to server; restarted deluged; reconnected.
It's still able to find my IP and DHT nodes, but the torrent stays paused.

Tried starting deluged with logfile + loglevel "info":
A bunch of warnings and exceptions thrown in my face; apparently the broken log.py is >still< a thing on Debian.
By now it's the 3rd or 4th machine where I have to fix this...
Updated Twisted via pip3 ('# pip3 install --upgrade Twisted --break-system-packages').
Went to /usr/lib/python3/dist-packages/deluge; edited log.py ('# nano log.py').
Changed "findCaller(self, stack_info=False)" to "findCaller(self, *args, **kwargs)"; saved & exited.

Finally able to run deluged with logfile+loglevel without all the log.py rubbish.
Loglevel 'info' -> everything OK; no errors or warnings; still torrent won't start.
Loglevel 'debug' -> LOTS of info; I 'THINK' the important part 'MIGHT' be this bit:

Code: Select all

16:31:15 [DEBUG   ][deluge.core.rpcserver         :1622] intevents: {}
16:31:15 [DEBUG   ][deluge.core.torrent           :1622] State from lt was: downloading | Session is paused: True
Torrent state set from "None" to "Paused" (9231ee2aee44cd8ab903cc10889bd444b28b3ca5)
16:31:15 [DEBUG   ][deluge.core.torrent           :1622] Torrent object created.
16:31:15 [DEBUG   ][deluge.core.rpcserver         :1622] intevents: {}
16:31:15 [DEBUG   ][deluge.core.torrentmanager    :1622] Torrent added: 9231ee2aee44cd8ab903cc10889bd444b28b3ca5
16:31:15 [INFO    ][deluge.core.torrentmanager    :1622] Torrent 2023-12-11-raspios-bookworm-armhf-lite.img.xz from user "User123" loaded
16:31:15 [INFO    ][deluge.core.torrentmanager    :1622] Finished loading 1 torrents in 0:00:00.286234
16:31:15 [DEBUG   ][deluge.core.rpcserver         :1622] intevents: {}
16:31:15 [DEBUG   ][deluge.core.torrent           :1622] State from lt was: downloading | Session is paused: True
Torrent state set from "Paused" to "Paused" (9231ee2aee44cd8ab903cc10889bd444b28b3ca5)
16:31:15 [DEBUG   ][deluge.core.torrent           :1622] State from lt was: downloading | Session is paused: True
Torrent state set from "Paused" to "Paused" (9231ee2aee44cd8ab903cc10889bd444b28b3ca5)
16:31:15 [INFO    ][deluge.core.torrentmanager    :1622] on_alert_external_ip: 12.34.56.789
16:31:15 [DEBUG   ][deluge.core.rpcserver         :1622] intevents: {}
Where does this "Session is paused: True" come from; how is it normally set to 'False'; and why is it being set multiple times?!

If this is not it, then ...dunno...


I've already tried a full purge and reinstall of deluged: same game.
I've also tried connecting to deluged via deluge-console, but the cli crashed almost immediately (Seriously, how come Deluge is so totally broken on Debian?! :shock: ).

And now... I really, REALLY dont know what else to do or check anymore.... :/
Help?
toastboy
New User
New User
Posts: 6
Joined: Sat Jan 27, 2024 4:24 pm

Re: [Debian12] Fresh install - Torrents paused, unable to resume.

Post by toastboy »

OK, it gets weirder...
When I add torrents via magnet link, there is no torrent file created in ~/.config/deluge/state
And when I restart deluged, all torrents added via magnet link are gone.

This is also reflected in the log of the next start (after having added a magnet and killed deluged) :

Code: Select all

00:15:47 [INFO    ][deluge.core.torrentmanager    :1622] Successfully loaded torrents.fastresume: /home/User123/.config/deluge/state/torrents.fastresume
00:15:47 [WARNING ][deluge.core.torrentmanager    :1622] Unable to open torrent file /home/User123/.config/deluge/state/9b00090d6683aa23595591e41dca92e9f3dc1df6.torrent: No such file or directory
00:15:47 [INFO    ][deluge.core.torrentmanager    :1622] Torrent 2023-12-11-raspios-bookworm-armhf-lite.img.xz from user "localclient" loaded
00:15:47 [WARNING ][deluge.core.torrentmanager    :1622] Torrent handle is invalid!
Side notes:
* magnet links are also added in a paused state (despite the option being disabled) and not resume-able.
* the dir ~/.config/deluge and all subdirs are owned by the user that's running deluged and has rw file permissions and rwx dir permissions...

Debug log of adding a new magnet (I made these logs AFTER the log above and used a different magnet here!):

Code: Select all

13:53:20 [DEBUG   ][deluge.core.alertmanager      :1622] torrent_added_alert: debian-live-12.4.0-amd64-cinnamon.iso added
13:53:20 [DEBUG   ][deluge.core.alertmanager      :1622] state_changed_alert: debian-live-12.4.0-amd64-cinnamon.iso: state changed to: dl metadata
13:53:20 [DEBUG   ][deluge.core.alertmanager      :1622] Handling alert: state_changed_alert
13:53:20 [DEBUG   ][deluge.core.alertmanager      :1622] add_torrent_alert: added torrent: 88a4d6ef20963e0dda018d453300a53015f19922
13:53:20 [DEBUG   ][deluge.core.alertmanager      :1622] Handling alert: add_torrent_alert
13:53:20 [WARNING ][deluge.core.torrentmanager    :1622] Torrent id not in torrents loading list: '88a4d6ef20963e0dda018d453300a53015f19922'
later -after a bunch of "session_stats_alert: session stats (291 values)"- more info on the new magnet:

Code: Select all

13:53:27 [DEBUG   ][deluge.core.rpcserver         :1622] RPC dispatch core.add_torrent_magnet
13:53:27 [DEBUG   ][deluge.core.core              :1622] Attempting to add by magnet uri: magnet:?xt=urn:btih:88a4d6ef20963e0dda018d453300a53015f19922&dn=debian-live-12.4.0-amd64-cinnamon.is
o&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.opentrackr.org:1337/announce
13:53:27 [DEBUG   ][deluge.configmanager          :94  ] Getting config: core.conf
13:53:27 [DEBUG   ][deluge.core.torrentmanager    :1622] remove prefetch magnet from session
13:53:27 [DEBUG   ][deluge.core.torrentmanager    :1622] options: {'add_paused': False,'auto_managed': True,'download_location': '/tmp','max_connections': -1,'max_download_spe
ed': -1.0,'max_upload_slots': 6,'max_upload_speed': -1.0,'move_completed': True,'move_completed_path': '/finished_torrents','pre_allocate_storage': False,'prioritize_first_l
ast_pieces': True,'remove_at_ratio': False,'sequential_download': False,'shared': False,'stop_at_ratio': False,'stop_ratio': 2.0,'super_seeding': False,'file_priorities': (),'mapped_
files': {},'name': '','owner': 'RemoteUser','seed_mode': False}
13:53:27 [DEBUG   ][deluge.core.torrent           :1622] Creating torrent object 88a4d6ef20963e0dda018d453300a53015f19922
13:53:27 [DEBUG   ][deluge.configmanager          :94  ] Getting config: core.conf
13:53:27 [DEBUG   ][deluge.configmanager          :94  ] Getting config: core.conf
13:53:27 [DEBUG   ][deluge.core.rpcserver         :1622] intevents: {1: ['NewVersionAvailableEvent', 'TorrentFileRenamedEvent', 'TorrentFolderRenamedEvent', 'TorrentRemovedEvent', 'ConfigValueChangedEvent', 'PluginEnabledEvent', 'PluginDisabledEvent', 'TorrentStateChangedEvent', 'TorrentAddedEvent', 'TorrentResumedEvent', 'SessionPausedEvent', 'SessionResumedEvent', 'TorrentQueueChangedEvent']}
13:53:27 [DEBUG   ][deluge.core.rpcserver         :1622] Emit Event: TorrentStateChangedEvent ['88a4d6ef20963e0dda018d453300a53015f19922', 'Paused']
13:53:27 [DEBUG   ][deluge.core.torrent           :1622] State from lt was: downloading_metadata | Session is paused: True
Torrent state set from "None" to "Paused" (88a4d6ef20963e0dda018d453300a53015f19922)
13:53:27 [DEBUG   ][deluge.core.torrent           :1622] Torrent object created.
13:53:27 [DEBUG   ][deluge.core.alertmanager      :1622] Alerts queued: 6
13:53:27 [DEBUG   ][deluge.core.alertmanager      :1622] torrent_removed_alert:  -  removed
13:53:27 [DEBUG   ][deluge.core.alertmanager      :1622] torrent_delete_failed_alert:  -  torrent deletion failed: Success
13:53:27 [DEBUG   ][deluge.core.alertmanager      :1622] cache_flushed_alert:  - 
13:53:27 [DEBUG   ][deluge.core.alertmanager      :1622] torrent_added_alert: debian-live-12.4.0-amd64-cinnamon.iso added
13:53:27 [DEBUG   ][deluge.core.alertmanager      :1622] state_changed_alert: debian-live-12.4.0-amd64-cinnamon.iso: state changed to: dl metadata
13:53:27 [DEBUG   ][deluge.core.alertmanager      :1622] Handling alert: state_changed_alert
13:53:27 [DEBUG   ][deluge.core.alertmanager      :1622] add_torrent_alert: added torrent: debian-live-12.4.0-amd64-cinnamon.iso
13:53:27 [DEBUG   ][deluge.core.alertmanager      :1622] Handling alert: add_torrent_alert
13:53:27 [DEBUG   ][deluge.core.rpcserver         :1622] intevents: {1: ['NewVersionAvailableEvent', 'TorrentFileRenamedEvent', 'TorrentFolderRenamedEvent', 'TorrentRemovedEvent', 'ConfigValueChangedEvent', 'PluginEnabledEvent', 'PluginDisabledEvent', 'TorrentStateChangedEvent', 'TorrentAddedEvent', 'TorrentResumedEvent', 'SessionPausedEvent', 'SessionResumedEvent', 'TorrentQueueChangedEvent']}
13:53:27 [DEBUG   ][deluge.core.rpcserver         :1622] Emit Event: TorrentAddedEvent ['88a4d6ef20963e0dda018d453300a53015f19922', False]
13:53:27 [DEBUG   ][deluge.core.torrentmanager    :1622] Torrent added: 88a4d6ef20963e0dda018d453300a53015f19922
13:53:27 [INFO    ][deluge.core.torrentmanager    :1622] Torrent debian-live-12.4.0-amd64-cinnamon.iso from user "RemoteUser" added
13:53:27 [DEBUG   ][deluge.core.torrentmanager    :1622] Creating the temporary file: /home/User123/.config/deluge/state/torrents.state.tmp
13:53:27 [DEBUG   ][deluge.core.torrent           :1622] State from lt was: downloading_metadata | Session is paused: True
Torrent state set from "Paused" to "Paused" (88a4d6ef20963e0dda018d453300a53015f19922)
13:53:27 [WARNING ][deluge.core.torrentmanager    :1622] Torrent id not in torrents loading list: '88a4d6ef20963e0dda018d453300a53015f19922'
13:53:27 [DEBUG   ][deluge.core.torrentmanager    :1622] Creating backup of torrents.state at: /home/User123/.config/deluge/state/torrents.state.bak
13:53:27 [DEBUG   ][deluge.core.torrentmanager    :1622] Saving torrents.state to: /home/User123/.config/deluge/state/torrents.state
PS. Sorry for double-posting. Didn't want to make the first post even more "TLDR". ;)
mhertz
Moderator
Moderator
Posts: 2216
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Debian12] Fresh install - Torrents paused, unable to resume.

Post by mhertz »

Sorry dunno, and haven't tested that version you're using for this, but indeed as you say, it seems session of libtorrent paused, meaning also e.g. no metadata saved for magnets and so no torrent for it saved in state and deluge "forgets" these on your version, but Cas fixed for us in 2.0.4+ - I can find the commit for you if needed, or a quick terminal one-liner I posted a few years ago on forum/bug-ticket, but mind you, really would be better to just use newest deluge from e.g. pypi, or if can get the PPA to work for your debian version etc, as deluge 2.0.3 pretty old, but your call.

I don't know why session paused all of sudden, but would start with fresh profile on server, with deluged closed - the console-UI also is broken probably in that old version, as remember Cas fixed alot issues for us, but "deluge-console pause '*'" pauses whole session, and "deluge-console resume '*'" resumes whole session(single quotes needed on both these), though just strange that retains this upon killed/restarted deluged, as doesn't here, but was deluge 2.1.1 and libtorrent 2.0.9 I tested here though.

Just a few thoughts.

Edit: and/or try another libtorrent, preferably 1.2.x with that old deluge.
toastboy
New User
New User
Posts: 6
Joined: Sat Jan 27, 2024 4:24 pm

Re: [Debian12] Fresh install - Torrents paused, unable to resume.

Post by toastboy »

Hi mhertz!
Thanks for your thoughts!
:)
I specifically chose a regular repo install, because I didn't want the "bloat" (web- & gtk-ui, cli) that a pypi install would bring to the new system.
As you can see, this turned out great for me^^'
Anyways, I'm also unsure if the 2.0.3 gtk client (on my desktop) is still fully compatible with 2.1.1 deluged...do you happen to know?
...the PPA only offers a full install with all UIs too, right?! :/
Kind of weird to have a server/client model as one of Deluge's main selling points, but then not be able to install them separately... *frustrated*
I think, for now I'd like to see that one-liner you mentioned... If that doesn't work or I encounter more problems, I'll probably have to bite the bullet. :/

As a side note:
Honestly, I don't know too much about the topic, but shouldn't it be possible to arrange the pypi install in a way similar to how some of the repos serve Deluge?!
I.e. giving control over which parts (deluged,gtk-ui,web-ui,cli) are installed by pip.
The pypi page mentions the possibility to install with or without optional dependencies, which gave me the impression there is a kind of "selection mechanism" available...
If indeed possible, I'd love to get future versions of deluged from pypi. ;)
mhertz
Moderator
Moderator
Posts: 2216
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Debian12] Fresh install - Torrents paused, unable to resume.

Post by mhertz »

Thanks buddy :)

I feel you, I don't have the GTK-UI etc installed either myself, though honestly is only a few MBs at most I would guess, as not pulling in deps to e.g. GTK and whatnot, if not having already, but like minimalism as well ;) Yes the pypi package could easily be made like that, just none have bothered or maybe disagree in needing, not sure honestly.

All 2.x clients and servers are compatible, yes. Yeah the PPA is same if remember right - scratch that, I just checked and indeed split, so couild try your luck with that, easy to find online on how use for debian etc, I mean about manually need add gpg keys or whatever was, and match ubuntu to debain version etc. Also, could try deluge packages from debain sid and see if can get that to work with not too much deps issues I mean.

Anyway, the command-line I talked about, was just to fix a single issue of magnets without any downloading yet, is forgotten upon restarts, because of a change in libtorrent, which Cas fixed a workaround for, and I added a line here to fix before that, just a quick and dirty one, as usual, when not the best at such, but atleast works, but can use the official if wanted too(preferably of-course, just little longer process). It's from this post: viewtopic.php?p=233680#p233680 and official fix in my linked bug-ticket at bottom from Cas's closing link/fix.


However, still no help for your paused session etc, so irregardless of you said fresh install, then I would try rename profile to end in bak or alike, with deluged closed, and try again fresh. And else, try that deluge-console command i.e. resume '*' which resumes session, not just torrents - found that in code once, surprising to me did that. Or can use GTK-UI to resume session, from the tray, I believe.

As said, would downgrade libtorrent to 1.2.x if I was using deluge 2.0.3, e.g. is one in the PPA, or else maybe in a debian repo - the ones in pypi are not working for py3.11 as you use sadly, only up to 3.10 - i'm actually currently in process of building them for that, and probably 3.12 and post here, to install with single command, but have some issues needing fix first, with the static openssl I built isn't used and only dynamic installed one used, but I wan't everything static, libtorrent, boost and openssl, inside python wrapper, except glibc, like on pypi(just with fixed https issue by default), but shouldn't be that hard figure out presumably, when I get around to it, and just little different on my used distro, where static libs usually stripped, so need provide/force myself etc.

Good luck :)
toastboy
New User
New User
Posts: 6
Joined: Sat Jan 27, 2024 4:24 pm

Re: [Debian12] Fresh install - Torrents paused, unable to resume.

Post by toastboy »

First of all: THANKS mhertz!
Great info as always! I've read many of your comments on here and they are always friendly, thoughtful, and illuminating.
I honestly wish every open-source project came with mhertz-like support! ;)

With that said, back to business:

Oh man... what a ride.
Turns out I was wrong: Installing just deluged from the PPA works!
And it seems to have fixed the "magnets disappear on restart"-bug, too.
Now, so far it looks like the Ubuntu version is running on Debian without any additional issues...
However, to get rid of the "session is paused"-bug, I had to start from scratch with a clean config.
At first, I tried the old config - and this time the "lost" magnets actually got loaded correctly - but the session was still not resume-able.
Of course this piqued my curiosity as to what part of my config was causing this...
So I started slowly recreating my config, restarting deluged after every change, to see if my torrents were still resume-able or stuck in a paused state.
And I actually found it: the bug occurs, when you activate the blocklist plugin and set "Import blocklist on startup", but then don't specify a blocklist uri/file.
Without this option set, everything runs smoothly, even if no list is specified - but once set, it expects a list or else it keeps your session paused.
Seems during my initial setup I ticked that option, expecting to be able to "simply add the file later"
...but no dice!! Deluge is a fickle and unforgiving mistress...

Though, I'm still perplexed I wasn't able to fix this issue on the older version of deluged...
I've tried setting up new configs at least three times, but the torrents always stayed paused...as if something internal just got locked or stuck or something...

Anyways: SOLVED! (for now)


BTW:
Great to hear you're working on newer versions of libtorrent for pypi!
Just today I've run into that incompatibility, when I was trying to see if a different libtorrent would fix my issues.^^



------------------------------------------
------------------------------------------
EDIT:
Already ran into the next bug: this one.
Disabling "Prioritize first & last pieces" seems to have fixed the situation temporarily.
It's exactly as you described:
* "skip" is not respected
* file size in the UI doesn't change
* "prioritize first&last" is somehow involved
Looks like you've already done some extensive testing on this one, so I don't think there is anything I can provide that would help.
Can only confirm that this issue exists in my current setup:
* deluged 2.1.1
* libtorrent: 2.0.8.0
* Python: 3.11.2
mhertz
Moderator
Moderator
Posts: 2216
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Debian12] Fresh install - Torrents paused, unable to resume.

Post by mhertz »

If in real life then would have to give you a big hug my friend, that was so sweet of you to say and I appreciate that alot and made me smile big :)

Awesome troubleshooting skills, and will remember that, as remember atleast one other in older times stating torrents paused for no reason now that you say it, so probably that again. I'll make a bug-ticket about it later, and do see the issue in code as per your nice details, so can be looked at. About the other issue you encountered, thanks for reproducing and posting details, i'll try look at it again soon, and else hopefully the good people developing deluge can fix it for us preferably. Thanks again for your helpfullness and as said putting a big smile on my face, take care buddy :)
toastboy
New User
New User
Posts: 6
Joined: Sat Jan 27, 2024 4:24 pm

Re: [Debian12] Fresh install - Torrents paused, unable to resume.

Post by toastboy »

Glad to hear I made you smile! :)
But: Hey, I'm just saying it as it is! You're doing an amazing job!

I'm looking forward to see the blocklist kink - and hopefully that "Prioritize first & last"-bug too - ironed out in future releases!

So, for now, that's it from me.
Thanks again for your input. You take care too, my friend, and keep up the awesome work! ;)
mhertz
Moderator
Moderator
Posts: 2216
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: [Debian12] Fresh install - Torrents paused, unable to resume.

Post by mhertz »

Ticket for blocklist: https://dev.deluge-torrent.org/ticket/3626#ticket

I'll look into the file-priorities issue again soon as said i.e. I don't think I captured and compared the generated long list of file-priorities deluge generates and compare to a working list from previous working version, etc. and will add to the bug-ticket/thread if finding something - annoying bug and pretty big issue too, so thanks for reminding about it.

Appreciate having good people like you around, thanks bro :)
toastboy
New User
New User
Posts: 6
Joined: Sat Jan 27, 2024 4:24 pm

Re: [Debian12] Fresh install - Torrents paused, unable to resume.

Post by toastboy »

Appreciate the upgrade to toastMASTER! xDDD
Really made me laugh.
No need to feel bad about this! I love it! ;)
Post Reply