Can't open preferences after converting to thin client

General support for problems installing or using Deluge
quixly
New User
New User
Posts: 6
Joined: Sat May 20, 2023 10:17 pm

Can't open preferences after converting to thin client

Post by quixly »

Hi,

I'm running v2.1.1 of the GUI, server & web-gui on Ubuntu 22.04 LTS.

After configuring the server backend and web gui, I switched the GTK GUI to be a thin client and can no longer open the preferences. I get the following error to stderr:

Unhandled error in Deferred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/deluge/transfer.py", line 126, in _handle_complete_message
self.message_received(
File "/usr/lib/python3/dist-packages/deluge/ui/client.py", line 130, in message_received
d.callback(request[2])
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 661, in callback
self._startRunCallbacks(result)
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 763, in _startRunCallbacks
self._runCallbacks()
--- <exception caught here> ---
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 857, in _runCallbacks
current.result = callback( # type: ignore[misc]
File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/preferences.py", line 332, in on_get_session_status
self._show()
File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/preferences.py", line 506, in _show
widget.set_active(value)
builtins.TypeError: Must be number, not str

I've gone through all the .config/deluge/*.conf files for the GTK app and the deluged home directory and haven't found any value that is misconfigured as a string instead of a number. I've compared the conf files to the server conf files as well. Lastly, I installed and configured deluge-gtk on another linux server (2.03 was the repo version) and saved off the .config/deluge directory at each step. The issue definitely starts after switching the GTK app from standalone to thin client. Once I disconnect from the deluged server, the preferences dialog appears though everything is disabled since I'm no longer connected.

I've tried turning on debug logging but nothing popped out as to which configuration item is affected. I also tried playing with the preferences.py script (making a backup of it first, of course) to see if I can get it to print the affected configuration item but my python skills are lacking.

Is there any other way to determine which configuration item is causing this? The thin client, web gui and GTK gui seem to be otherwise working fine.

Thanks!
User avatar
ambipro
Moderator
Moderator
Posts: 446
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: Can't open preferences after converting to thin client

Post by ambipro »

I'm not entirely sure based on the logs, but my first question would be whether or not you are running any plugins?

You said you tested on other instances, does this problem occur on a vanilla/fresh instance of deluge with default setting but connected via thin client as well? Or only after you've copied over your configuration files?

If you do have plugins enabled, you will need to have the same plugin .egg files in your local thin client deluge directories as you have on the server, although I'm not sure this would prevent the preferences from opening....it may though.
quixly
New User
New User
Posts: 6
Joined: Sat May 20, 2023 10:17 pm

Re: Can't open preferences after converting to thin client

Post by quixly »

Hi,

The only plugin egg file I added to the server is YaRSS2 using the CLi though it's not showing as enabled:

$ deluge-console plugin -s
Enabled Plugins:
<Deferred at 0x7f57ff218190 current result: None>

Also, the server's plugins directory is empty.

On a server that's never had deluge installed:

1. I started up the GTK app, then quit out and backed up the config.
2. Then I configured it through the preferences how I like it, quit out, and backed up the config again.
3. On the third execution, I went into preferences, changed it to a thin client and connected to the deluged server. I was no longer able to get into preferences and the aforementioned error was produced. As soon as I disconnected from the server, the preferences popped up.

I'm guessing the bad .conf parameter is on the server side. I've gone through all of the servers .conf files but didn't find any parameters that looked like they were the wrong type.
User avatar
ambipro
Moderator
Moderator
Posts: 446
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: Can't open preferences after converting to thin client

Post by ambipro »

I''m only guessing on this, but perhaps you're connected via a user that does not have "ADMIN" level? Also is "Allow Remote Connections" enabled?

You could try connecting via the default localclient account (password should be available in the "auth" file) if you are using another account presently.

Both are in "Daemon" under preferences...

I know this is probably a stretch but just ruling out the obvious first.
quixly
New User
New User
Posts: 6
Joined: Sat May 20, 2023 10:17 pm

Re: Can't open preferences after converting to thin client

Post by quixly »

In the servers core.conf:

"allow_remote": true,

While I have been using a new user I created with ADMIN access, I also tried the localclient user with the same results. I wasn't able to bring up the preferences in the GTK app while connected to the server.
quixly
New User
New User
Posts: 6
Joined: Sat May 20, 2023 10:17 pm

Re: Can't open preferences after converting to thin client

Post by quixly »

A little more information.

The following error shows in the deluged log upon starting:

12:33:58 [ERROR ][deluge.component :128 ] [Failure instance: Traceback: <class 'TypeError'>: No registered converter was able to produce a C++ rvalue of type long from this Python object of type str
/usr/lib/python3/dist-packages/twisted/internet/base.py:1325:mainLoop
/usr/lib/python3/dist-packages/twisted/internet/base.py:991:runUntilCurrent
/usr/lib/python3/dist-packages/twisted/internet/defer.py:661:callback
/usr/lib/python3/dist-packages/twisted/internet/defer.py:763:_startRunCallbacks
--- <exception caught here> ---
/usr/lib/python3/dist-packages/twisted/internet/defer.py:857:_runCallbacks
/usr/lib/python3/dist-packages/twisted/internet/task.py:869:cb
/usr/lib/python3/dist-packages/deluge/core/preferencesmanager.py:158:start
/usr/lib/python3/dist-packages/deluge/core/preferencesmanager.py:172:do_config_set_func
/usr/lib/python3/dist-packages/deluge/core/preferencesmanager.py:454:_on_set_proxy
/usr/lib/python3/dist-packages/deluge/core/core.py:246:apply_session_settings


Also, in the deluged core.conf, I see this is set to an empty string:

"proxy": { ... "type": "" ... }

However, in a freshly installed and executed deluge, it's set to a number:

"proxy": { ... "type": 0 ... }

I tried stopping deluged, changing it to 0, but it changes it back to an empty string when I restart it.
User avatar
ambipro
Moderator
Moderator
Posts: 446
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: Can't open preferences after converting to thin client

Post by ambipro »

I'm not sure what's going on in your case, but I don't use any proxy in my deluge instance (ran in docker on unraid) - my proxy block is below...

Code: Select all

"proxy": {
        "anonymous_mode": false,
        "force_proxy": false,
        "hostname": "",
        "password": "",
        "port": 8080,
        "proxy_hostnames": true,
        "proxy_peer_connections": true,
        "proxy_tracker_connections": true,
        "type": 0,
        "username": ""
    },
Running 2.1.1 btw.
mhertz
Moderator
Moderator
Posts: 2217
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Can't open preferences after converting to thin client

Post by mhertz »

Sorry don't know either, but something specifically wrong with core.conf of server yes, as you say string not int in a setting, as per error. I tracked the error lines, which are pretty generic but little before error mentions a line referring to cache status tab of preferences.

When checking with deluge-console, then it will by default check under local user server, if running, so if running server under e.g. deluge user, then easy way is to say e.g. 'sudo -u deluge deluge-console xxxxxxx', or use the -c flag to direct to profile dir of server, e.g. usually /var/lib/deluge/.config/deluge or whatever was.

I would as ambipro stated, try with all plugins off, and with new fresh config, e.g. can re-setup server with just deleting core.conf again, or whole profile dir, well back it up first probably.

Anyway I'll butt out again, and sorry no actual help to offer - most of the settings doesn't even offer string input support, e.g. they are defined as string values only for most part in GTK, when such value needed etc, so very stumped myself too.

Carry on, and good job in being super helpful as usual ambipro, all around :)

Edit: Missed a bunch, well a few, post I see while typing, sorry probably outdated now, haven't checked propperly just quickly skimmed through...

Edit2: Indeed, it's the string designation of proxy type triggering this, I just tested, with same error as you, when changing 0 to "" manually in core.conf. Good job spotting that quixly :) I'm sorry I have no idea why does that you explain. I'll return if can think of something though, but not sure honestly,

Edit3: Make sure you have stopped deluged fully and everything regarding deluge just in case, before changing the core.conf of server, as sounds like still running and hence overrides your manual change. Seems only solution making sense really... And make sure change the correct core.conf i.e. of server.
User avatar
ambipro
Moderator
Moderator
Posts: 446
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: Can't open preferences after converting to thin client

Post by ambipro »

mhertz wrote: Sun May 21, 2023 7:15 pm Sorry don't know either, but something specifically wrong with core.conf of server yes, as you say string not int in a setting, as per error. I tracked the error lines, which are pretty generic but little before error mentions a line referring to cache status tab of preferences.

When checking with deluge-console, then it will by default check under local user server, if running, so if running server under e.g. deluge user, then easy way is to say e.g. 'sudo -u deluge deluge-console xxxxxxx', or use the -c flag to direct to profile dir of server, e.g. usually /var/lib/deluge/.config/deluge or whatever was.

I would as ambipro stated, try with all plugins off, and with new fresh config, e.g. can re-setup server with just deleting core.conf again, or whole profile dir, well back it up first probably.

Anyway I'll butt out again, and sorry no actual help to offer - most of the settings doesn't even offer string input support, e.g. they are defined as string values only for most part in GTK, when such value needed etc, so very stumped myself too.

Carry on, and good job in being super helpful as usual ambipro, all around :)

Edit: Missed a bunch, well a few, post I see while typing, sorry probably outdated now, haven't checked propperly just quickly skimmed through...

Edit2: Indeed, it's the string designation of proxy type triggering this, I just tested, with same error as you, when changing 0 to "" manually in core.conf. Good job spotting that quixly :) I'm sorry I have no idea why does that you explain. I'll return if can think of something though, but not sure honestly,

Edit3: Make sure you have stopped deluged fully and everything regarding deluge just in case, before changing the core.conf of server, as sounds like still running and hence overrides your manual change. Seems only solution making sense really... And make sure change the correct core.conf i.e. of server.
I'm not entirely sure this would work, but could he set the core.conf perms (chmod) so that his user deluge is running as doesn't have permission to write to it? I'm not sure deluge woud run properly if making it read-only? That would force it to stay set as an integer...if he wanted to change it, it would be a pain in the ass, but it may end up working?

Just a wild-ass idea. If nothing else to test...
quixly
New User
New User
Posts: 6
Joined: Sat May 20, 2023 10:17 pm

Re: Can't open preferences after converting to thin client

Post by quixly »

Thanks mhertz, you gave me an idea. First, while I was stopping deluged and the GTK app, I wasn't stopping deluge-web. Also, the systemd profile for deluged has it auto restart upon failure. I need to change that. I want it only manually started.

That being said, here's the commands I just ran in a controlled test:

$ sudo systemctl stop deluge-web
$ sudo systemctl stop deluged
$ pgrep deluge
$
$ sudo -u deluge grep type /var/lib/deluge/.config/deluge/core.conf
"type": "",
$ sudo -u deluge vi /var/lib/deluge/.config/deluge/core.conf
$ sudo -u deluge grep type /var/lib/deluge/.config/deluge/core.conf
"type": 0,
$ sudo systemctl start deluged
$ sudo -u deluge grep type /var/lib/deluge/.config/deluge/core.conf
"type": 0,
$ deluge &
$ sudo -u deluge grep type /var/lib/deluge/.config/deluge/core.conf
"type": 0,
# click preferences -- it comes up!
$ sudo systemctl start deluge-web
$ sudo -u deluge grep type /var/lib/deluge/.config/deluge/core.conf
"type": 0,
# GTK app prefs still works
# connect web browser to deluged localhost web port
$ sudo -u deluge grep type /var/lib/deluge/.config/deluge/core.conf
"type": 0,

After all of that, the preferences is currently coming up properly in the GTK app. I'm still not sure what was changing that value in the core.conf (though I suspect maybe deluge-web) but if it happens again, I'll update this thread with further test results in the hopes that I narrow down a bug that may need to be fixed.

On a related note, I was able to change some configuration items on deluged with "deluge-console config -s ..." but I haven't found the syntax to change the proxy type since it's in a nested JSON block. Do you or anyone know what the syntax would be?

This (and other variations) don't seem to work:

$ sudo -u deluge deluge-console "config -s proxy.type 0"

Thanks!
Post Reply