Ethernal war with Deluged

General support for problems installing or using Deluge
trueotacon
Member
Member
Posts: 15
Joined: Tue Jan 26, 2021 7:23 pm

Ethernal war with Deluged

Post by trueotacon »

Hi guys, I hope that at least here I will get some help. I think that I'm using Deluge from my first linux installation on Ubuntu. Great program cause I need a server / client setup. On debian distribution all seemes to be ok but I have an old and never-won war with deluged and Arch Linux, and now Manjaro. I can't make it work. This is the third year that I try to make work deluged daemon and deluge-console on arch but I can't figure out what is the problem. On the Arch forum there are no one that can help and neither on Manjaro.

Now I have a new download machine, manajro installed and ssh connection to it. The wiki of Arch is terrible for deluge. I have deluge installed from pacman (I had tried from aur but nothing had changed). The daemon seems to work without error but I can't connecto to it with deluge-console. I get a strange error of python

Code: Select all

deluge-console
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3.9/site-packages/deluge/ui/client.py", line 436, in __on_login_fail
    login_deferred.errback(result)
  File "/usr/lib/python3.9/site-packages/twisted/internet/defer.py", line 501, in errback
    self._startRunCallbacks(fail)
  File "/usr/lib/python3.9/site-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib/python3.9/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3.9/site-packages/deluge/ui/client.py", line 408, in __on_connect_fail
    self.daemon_info_deferred.errback(reason)
  File "/usr/lib/python3.9/site-packages/twisted/internet/defer.py", line 501, in errback
    self._startRunCallbacks(fail)
  File "/usr/lib/python3.9/site-packages/twisted/internet/defer.py", line 561, in _startRunCallbacks
    raise AlreadyCalledError
twisted.internet.defer.AlreadyCalledError:
I have updated all python package with pip but it wasn't necessary. I had my services running

Code: Select all

● deluged.service - Deluge Bittorrent Client Daemon
     Loaded: loaded (/usr/lib/systemd/system/deluged.service; enabled; vendor preset: disabled)
    Drop-In: /usr/lib/systemd/system/deluged.service.d
             └─user.conf
     Active: active (running) since Mon 2021-01-25 11:02:02 CET; 5s ago
       Docs: man:deluged
   Main PID: 1806 (deluged)
      Tasks: 3 (limit: 19126)
     Memory: 35.2M
     CGroup: /system.slice/deluged.service
             └─1806 /usr/bin/python /usr/bin/deluged -d
Can someone help me please? Deluge on arch based distro is my only problem from years!
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Ethernal war with Deluged

Post by mhertz »

I have used deluged with deluge-console on arch since atleast 2013, so should work there ;)

I'm not on manjaro, so don't know anything about what's different there, but official arch extra repos deluge package and deps works fine, so no pypi pip updates needed.

Googling one of the distinctive error-lines, gave a post on arch forum by graysky(previously/originally making deluge-split meta package in aur, to support e.g ditch gtk deps etc, before being incorporated in official repo, but besides the point I guess and just giving credit where due ;) ), with same error about deluge-console, and he later replied back that his issue fixed itself by just clearing out the deluge profile under '.config/deluge' of user defined to run deluge(default '/srv/deluge/.config/deluge').

Hope helps, as otherwise never seen this myself.
trueotacon
Member
Member
Posts: 15
Joined: Tue Jan 26, 2021 7:23 pm

Re: Ethernal war with Deluged

Post by trueotacon »

Yeah, found it during my researches but it dosn't help. I had deleted both the config folder in /srv/deluge as the one in the user folder .config/deluge/.
To be frank I don't know if the daemon is using the deluge user's config or the standard user one. I think the deluge but I'm not sure. By the way, the same exact error I get in my arch machine. Same folders and same error, bot with the pacman or aur version. And on manjaro I have a clean installation, no firewalls, no iptables rules, nothing.

curiously, if I kill pkill deluged daemon or use systemctl stop deluged, and start it with "deluged" command and not with "systemctl start deluged" I can connect to the server with deluge-console. The problem is that as soon as I logoff from my remote machine, deluged stops to work of course cause is lanched as application and not sservices.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Ethernal war with Deluged

Post by mhertz »

I just tried reproduce, which I succeded, and your issue is that you're having user/pass config issues from running deluged and deluge-console each from seperate user accounts, and hence separate deluge-profiles, so need little extra configuration than straight out of the box.

To quickly run deluge-console interactively(ncurses vs cli) in this situation, then either of these works:

Code: Select all

sudo -u deluge deluge-console

Code: Select all

sudo deluge-console -c /srv/deluge/.config/deluge
For running non-interactively then another additionally also works:

Code: Select all

deluge-console 'connect localhost user pass; [command]'
...and where user/pass is from '/srv/deluge/.config/deluge/auth', either the default localclient line's user/pass or a manually added user/pass e.g. 'test:test:10'. If just running the connect command, with credentials, then ncurses interactive mode doesn't start.

Anyway, sorry for dragging this out, just wanted to be somewhat complete in my responce.

That localclient line was actually meant to auto-login on localhost, but doesn't when different users. I believe in older days it worked when having same localclient line in both auth files of the 2 different user accounts deluge profile folders, so e.g. just copying the auth file from '/srv/deluge/.config/deluge/auth' to '~/.config/deluge/auth', but didn't now I just checked. Always restart deluge and daemons when changing auth or other configs btw, as loaded copy in memory used instead of file on disk.

Deluge-console is little buggy at places e.g. connection-manager when trying add new host etc.

Quick solution to your problem, if wanting to run interactively, which I think you do, because was there this twisted errror specifically occured for me, then in '~/.config/deluge/hostlist.conf' you edit the password on line 11 to match the password of localclient in '/srv/deluge/.config/deluge/auth', or change user/pass there(in local hostlist.conf) to match manually added user/pass in '/srv/deluge/.config/deluge/auth' if done such before.

Hope helps lessening that ethernal war you have going on with deluged :D
trueotacon
Member
Member
Posts: 15
Joined: Tue Jan 26, 2021 7:23 pm

Re: Ethernal war with Deluged

Post by trueotacon »

So, the fist thing is thanks. Something is working, I can't understand all the mechanics but if I do "sudo -u deluge deluge-console" I can connect. But, I had modified the file hostlist.conf in my user to match the password in /srv/deluge. Now I can connecto to deluge-console simply by write it as comand BUT I can't edit the settings. Every time I change the download folder as example anche and exit the application, the settings will be reset to default. So I had manauly edit the files in /srv/deluge BUT as soon as I restart the daemon the settings change to default values....
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Ethernal war with Deluged

Post by mhertz »

You're welcome. Yeah, running 'deluge-console' alone is enough, when having edited hostlist.conf, sorry if being confusing on my wording.

Deluge saves settings on quitting, and if editing core.conf or whatever for settings, then you need stop deluged first, then edit settings and first afterwards start deluged. Sorry said that little wrong before too, I believe(as just said restart after editing or alike) .

There is a bug seemingly about changing settings directly from deluge-console, I never noticed as always edit core.conf directly. I checked also with deluge-console run from deluge user, to be sure, but didn't work either for retaining direct setting changes for some reason.
Last edited by mhertz on Wed Jan 27, 2021 11:03 pm, edited 1 time in total.
trueotacon
Member
Member
Posts: 15
Joined: Tue Jan 26, 2021 7:23 pm

Re: Ethernal war with Deluged

Post by trueotacon »

I had tried to edi the settings manauly after I had stop the service anc THEN restarting the daemon but it seemes as soon as I start the daemon, all the settings went restet to default state
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Ethernal war with Deluged

Post by mhertz »

I just tested again, and works here i.e 'sudo systemctl stop deluged' > 'sudo vim /srv/deluge/.config/deluge/core.conf' > 'sudo systemctl start deluged' > 'deluge-console', which reflects e.g. correct changed download_location here, as I tested with, or whatever else changed.

Edit: Interestingly, it works when changing settings from deluge-console non-interactively, which also I do already from my script I forgot for setting the retrieved VPN forwarded port and that sticks i've noticed when checking core.conf later manually.

Code: Select all

deluge-console 'connect localhost localclient xxxxxxxxxxxx; config -s download_location /home/martin/Downloads'
As said a few posts back, then you don't need use localclient and that long password, and can just if wanted add a new user/pass combo on new line at '/srv/deluge/.config/deluge/auth' e.g. 'foo:bar:10', and then change '~/.config/deluge/hostlist.conf' to reflect 'foo' instead of 'localcient' and 'bar' instead of the long random password, and use that user/pass combo instead on non-interactive deluge-console command-lines like above. Also, good idea to make some deluge-console shell-functions/aliases to ease your work going forward imho.

Anyway, I also checked debug-logs of both deluged and deluge-console, from when changing settings from deluge-console interactively, but no error or otherwise relevant stuff obtained, just calls the preferences sub-class and no further output displayed unfortunetly. I'll make a ticket regardless on deluge-bugtracker, tomorrow or one of these days, but as said, you should be able to do it(change settings) in other ways like above two examples.
trueotacon
Member
Member
Posts: 15
Joined: Tue Jan 26, 2021 7:23 pm

Re: Ethernal war with Deluged

Post by trueotacon »

I can change auth in /srv/deluge and replace it with foo:bar:10 but as soon as I start the daemon the file will be modified, and a localclient:xxxxx:10 wil be writen inside. And every change in settings that I made from inside deluge-console launched with

Code: Select all

sudo -u deluge deluge-console
will be lost. The folder /srv/deluge is owned by deluge and have write permission but it seems that deluge-console can't write it. Maybe I should try to use my username to connect to the daemon and my config folder in home/.config/deluge instead of deluge user.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Ethernal war with Deluged

Post by mhertz »

Yes, as said deluge-console has a bug seemingly, so can only define settings through its 'config -s' option and not from its TUI. It doesn't matter how you start it or from which user or if systemd or not. Also, it's the daemon itself that writes to core.conf or auth or whatever, so not a permission issue, but I did test locally too, without systemd in my own user for all components and same there, so won't help.

Auth file shouldn't be able to reset when starting deluged, if changed when deluged not running, though if no localclient line exist, then it will be generated automatically underneath your added stuff, as is needed by certain things not important here, and your user/pass still should work.

When changing the file, can you thereafter just before starting deluged through systemctl, check that deluged isn't running first, with e.g 'ps aux | grep deluge' - nothing should show from that command if deluged isn't running. BTW, also close web-daemon if that's started, before changing files. As said, tested here multiple times successfully.

If wanting to run through own user so all settings is in homedir, though keep in mind that standard way is safer, but anyway, then best way when using systemd is following, which "sticks" also after later deluge updates:

Make dir: '/etc/systemd/system/deluged.service.d', and place following file in it, though change 'user' to your regular user-account name, and name the file 'xdeluge.conf'(name needs to start with higher char than 'u' in alphabet, to override 'user.conf') and then run just in-case 'sudo systemctl daemon-reload'.

Code: Select all

 
[Service]
User=user
Last edited by mhertz on Thu Jan 28, 2021 1:25 pm, edited 4 times in total.
Post Reply