Deluge lost all configs and torrent after upgrade to version 2.0.3

General support for problems installing or using Deluge
Shadallark
Member
Member
Posts: 23
Joined: Sat Oct 14, 2017 2:43 pm

Re: Deluge lost all configs and torrent after upgrade to version 2.0.3

Post by Shadallark »

spookymulder84 wrote:
mhertz wrote: In meantime, tobbez posted some python code to translate your state file:

Code: Select all

import pickle
with open('torrents.state', 'rb') as f:
    d = pickle.load(f, encoding='latin1')

with open('torrents.state', 'wb') as f2:
    pickle.dump(d, f2)
I wanted to say thank you very much for this python code! It really worked for me!! Much love!!!
None of the torrents would show up for me but now it's all here!
Upgrading my Raspberry Pi from Raspian-Debian-Jessie to Raspian-Debian-Buster I also made the leap from Deluge v1.3.x to 2.0.x. Until I found this post I was not able to get all my old torrents to show up on the new system. Initially, after backing up the ~/.config/deluge/ directory I copied over the ~/.config/deluge/session.state file and ~/.config/deluge/state/ directory, then used the code above but Deluge was still not seeing all my torrents.

At that point I removed the ~/.config/deluge/session.state file and ~/.config/deluge/state/ directory before copying them over from the old system again. This time, after using the code above, deluged is showing all the torrents. It looks like I will have to Force Recheck all of them, but at least they are all there.

EDIT: Actually, no I am not going to have to Force Recheck them, they were all paused I so far I have only had to Resume them for them to start seeding; doing them in chunks in case I need to Force Recheck some of them).

Thanks again @spookymulder84, @mhertz and @tobbez!

Shadalalrk
Running Deluged v2.0.x on a Raspberry Pi 3b running Raspian (Debian Buster) with a Mac OSX Thin Client.
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge lost all configs and torrent after upgrade to version 2.0.3

Post by mhertz »

I'm glad to hear it, thanks for feedback :) Again, curtesy off, and all credits to, tobbez, thanks again mate :)

Btw, if using a dev version of deluge, like some distros like arch-linux, or if building yourself, then you have a comparable fix included by Cas, so will/should work automatically: https://git.deluge-torrent.org/deluge/c ... b8dd624ade

(The above fixes mentioned should only be needed when having torrents with filenames featuring non-ascii characters btw, e.g in my testings with just a single or two torrents of Linux distros did transfer from deluge 1.3.15 to 2.0.3 automatically without needing tobbez's code, as no non-ASCII filenames encountered).
One-Eighty
New User
New User
Posts: 3
Joined: Wed Jul 20, 2022 1:16 am

Re: Deluge lost all configs and torrent after upgrade to version 2.0.3

Post by One-Eighty »

hello all, I'm noob to programming so forgive if this question stupid. i'm am on new version of deluge for windows 10. now that it's out - I'm so happy to update! but I have the issue in this topic and don't know how to use that python script to fix torrent state. i want new version to pull my old torrent state.

would anyone please be so kind to help? a step by step guide for how to do this on windows 10 would be greatly appreciated!

thank you!
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge lost all configs and torrent after upgrade to version 2.0.3

Post by mhertz »

There's code in deluge from v2.0.4 and up, auto-run and doing pretty much the same as tobbez code discussed in this thread, only small diffs like latin1 instead utf8 etc. A few times it was reported not working, though did reportedly work for many others, and I don't know why honestly.

Anyway, just in case then I can post intsructions for doing it with tobbez fix, tomorrow I think, though as said doubt any difference, but regardless, and as requested. Please keep your deluge-profiles back-up'd as every time starting and closing deluge with no torrents listed, then torrents.state overwritten empty I believe, and only has one backup on first time.

Btw, when pickling as this fix uses, then it actually executes the python code, here from torrents.state, meaning needs deluge and it's dependant modules importable - and the freezed installer don't work for this, as besides not having a python.exe, then also doesn't provide main deluge module and sub-modules in a way importable to an external python, so I need add instructions for also getting deluge source and it's deps like twisted etc, besides embedded pyhon zip, and as probably noticed i'm not good at being short and concise/to-the-point, so was thinking about just bundling everything up into an e.g. 7z switchless installer or NSIS installer, not actually installing anything, but merely doing this fix and cleaning up after itself afterwards, though of-course then need trust me for that, so will think about it, but again, a long shot regardless i'm affraid.
One-Eighty
New User
New User
Posts: 3
Joined: Wed Jul 20, 2022 1:16 am

Re: Deluge lost all configs and torrent after upgrade to version 2.0.3

Post by One-Eighty »

just to be clear I am on windows 10 and upgraded from deluge 1.3.15 to 2.1.1. now that it was released to windows officially. i did backup my whole appdata folder for deluge in case of issues.

i tried running python script but like i said i'm not familiar with it and i couldn't get it to work. for now i downgraded to 1.3.15 again. my torrents are loading fine. is there anything i can do in 1.3.15 to ensure that they transfer to 2.1.1? i would like to upgrade but if not fixable for now i have to stay with 1.3.15. i am happy the new version is on windows though!

i am appreciative of all the help you are willing to give and i do trust you for any fixes. :)
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge lost all configs and torrent after upgrade to version 2.0.3

Post by mhertz »

Thanks, appreciate that mate :)

Here's the fix packed into a 7z sfx switchless installer - nothing installed just runs fix and cleans up afterwards. Double-click to run and no admin-rights needed. It selects by default the path to '%appdata%\deluge' but can be changed if using custom profile location.

It's little big(28mb) because includes isolated copy of python and deluge with it's non-GUI deps, I used 32 bit versions of them so works on both x32 and x64 windows/deluge. I didn't bother trim down further or change icons etc.

Again I doubt this will change anything, as pretty much same as deluge already does itself, but just in case, and again all credit tobbez for fix. Please backup deluge profile before running fix.

Anyway, the issue is about characters of torrents in non-ascii, like umlauts and whatnot, maybe tildes also etc, foreign characters in general, so if can identify them and rename, then should help, but then again why the fix or deluge itself doesn't work for this also, I have no idea honestly.

Good luck.

deluge_state_fix.exe

(Payload, sfx-module and config-file with commands run can be extracted and verified through 7z_splitter here: https://github.com/OlegScherbakov/7zSFX ... er_1017.7z)
One-Eighty
New User
New User
Posts: 3
Joined: Wed Jul 20, 2022 1:16 am

Re: Deluge lost all configs and torrent after upgrade to version 2.0.3

Post by One-Eighty »

mhertz wrote: Thu Jul 21, 2022 7:22 pm Thanks, appreciate that mate :)

Here's the fix packed into a 7z sfx switchless installer - nothing installed just runs fix and cleans up afterwards. Double-click to run and no admin-rights needed. It selects by default the path to '%appdata%\deluge' but can be changed if using custom profile location.

It's little big(28mb) because includes isolated copy of python and deluge with it's non-GUI deps, I used 32 bit versions of them so works on both x32 and x64 windows/deluge. I didn't bother trim down further or change icons etc.

Again I doubt this will change anything, as pretty much same as deluge already does itself, but just in case, and again all credit tobbez for fix. Please backup deluge profile before running fix.

Anyway, the issue is about characters of torrents in non-ascii, like umlauts and whatnot, maybe tildes also etc, foreign characters in general, so if can identify them and rename, then should help, but then again why the fix or deluge itself doesn't work for this also, I have no idea honestly.

Good luck.

deluge_state_fix.exe

(Payload, sfx-module and config-file with commands run can be extracted and verified through 7z_splitter here: https://github.com/OlegScherbakov/7zSFX ... er_1017.7z)
that DID work! wow! :o i thank you and tobbez so much for everything! you are so helpful! :)

i backed up and tested without applying the fix first. deluge 2.1.1 (x64 version) still didn't load my torrent state.
then i exited deluge, applied fix, and opened deluge up again. just like that, all my torrents were there!
i can't tell you how much i am thankful for this! you and tobbez saved the day! :D
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge lost all configs and torrent after upgrade to version 2.0.3

Post by mhertz »

Awesome, great to hear it worked, and you're very welcome mate - also thanks likewise for your very kind and appreciative words buddy :)

That was surprising to me honestly, so now will have to make a bug-ticket about this then, linking this thread, so hopefully can be fixed in deluge itself for feature, so thanks alot for raising issue again and testing/replying back, appreciated.

Thank you tobbez!

Edit: https://dev.deluge-torrent.org/ticket/3537#ticket
idic
New User
New User
Posts: 7
Joined: Wed Jul 11, 2018 6:28 pm

Re: Deluge lost all configs and torrent after upgrade to version 2.0.3

Post by idic »

mhertz wrote: Sun Nov 17, 2019 8:46 pm
In meantime, tobbez posted some python code to translate your state file:

Code: Select all

import pickle
with open('torrents.state', 'rb') as f:
    d = pickle.load(f, encoding='latin1')

with open('torrents.state', 'wb') as f2:
    pickle.dump(d, f2)
I haven't tried it myself though.
Thanks to you and tobbez! This saved me also and turned out to be such a simple thing to get updated on the new version.

Anyone else just finding this, from the command line just go into python3 and copy and paste that code snip. Keep a backup of the original file just to be extra safe.
mhertz
Moderator
Moderator
Posts: 2215
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Deluge lost all configs and torrent after upgrade to version 2.0.3

Post by mhertz »

You're welcome, and all credit tobbez, thanks!

@all, as said, a comparable fix is in deluge 2.0.4 and up, just using utf8 instead latin1, though latter a subset of former however, so little bit thinking maybe a coincidence and would have worked anyway on next startup(in deluge 2.0.4+), and have seen torrents "hidden" temporarily myself also, needing a restart to "come back" but regardless did submit ticket about this thread previously, as posted a few posts up.
Post Reply