[Solved] deluge-web: won't autoconnect to the daemon

General support for problems installing or using Deluge
5arge

[Solved] deluge-web: won't autoconnect to the daemon

Postby 5arge » Mon May 30, 2011 11:37 pm

Alright, I've looked everywhere I know to look (google, forums, FAQ, and troubleshooting), triple-checked my configs, and have nowhere else to turn.

I AM able to have the gtk-ui autoconnect, but every time I try to use a web-ui (on the LAN: https://localhost:21387) I have to select the daemon and click "connect" before it connects to the daemon. Once I've connected it manually with a web browser, I'm then able to connect using remote devices such as transdroid.

I've set "default_daemon": "127.0.0.1:21387" in ~/.config/deluge/web.conf, verified the port is correct for "daemon_port": 21387, in ~/.config/deluge/core.conf.

There's something interesting in the debug output (Numbered lines, and I've replaced a few things with "deleted" out of paranoia):

Code: Select all

     1   [INFO    ] 00:07:45 ui:101 Deluge ui 1.3.2
     2   [DEBUG   ] 00:07:45 ui:102 options: {'fork': True, 'profile': False, 'loglevel': 'debug', 'quiet': False, 'ssl': False, 'base': None, 'logfile': '/home/me/Desktop/deluge.log', 'config': None, 'port': None}
     3   [DEBUG   ] 00:07:45 ui:103 args: []
     4   [INFO    ] 00:07:45 ui:104 Starting ui..
     5   [DEBUG   ] 00:07:45 configmanager:111 Getting config 'web.conf'
     6   [DEBUG   ] 00:07:45 config:197 Setting 'sidebar_show_zero' to False of <type 'bool'>
     7   [DEBUG   ] 00:07:45 config:197 Setting 'show_session_speed' to False of <type 'bool'>
     8   [DEBUG   ] 00:07:45 config:197 Setting 'first_login' to True of <type 'bool'>
     9   [DEBUG   ] 00:07:45 config:197 Setting 'https' to False of <type 'bool'>
    10   [DEBUG   ] 00:07:45 config:197 Setting 'sessions' to {} of <type 'dict'>
    11   [DEBUG   ] 00:07:45 config:197 Setting 'enabled_plugins' to [] of <type 'list'>
    12   [DEBUG   ] 00:07:45 config:197 Setting 'pwd_sha1' to deleted of <type 'str'>
    13   [DEBUG   ] 00:07:45 config:197 Setting 'cert' to ssl/daemon.cert of <type 'str'>
    14   [DEBUG   ] 00:07:45 config:197 Setting 'pkey' to ssl/daemon.pkey of <type 'str'>
    15   [DEBUG   ] 00:07:45 config:197 Setting 'port' to 8112 of <type 'int'>
    16   [DEBUG   ] 00:07:45 config:197 Setting 'theme' to gray of <type 'str'>
    17   [DEBUG   ] 00:07:45 config:197 Setting 'session_timeout' to 3600 of <type 'int'>
    18   [DEBUG   ] 00:07:45 config:197 Setting 'show_sidebar' to True of <type 'bool'>
    19   [DEBUG   ] 00:07:45 config:197 Setting 'default_daemon' to  of <type 'str'>
    20   [DEBUG   ] 00:07:45 config:197 Setting 'sidebar_multiple_filters' to True of <type 'bool'>
    21   [DEBUG   ] 00:07:45 config:197 Setting 'pwd_salt' to deleted of <type 'str'>
    22   [DEBUG   ] 00:07:45 config:197 Setting 'base' to / of <type 'str'>
    23   [DEBUG   ] 00:07:45 config:391 Config /home/me/.config/deluge/web.conf version: 1.1 loaded: {'port': 38511, 'enabled_plugins': [], 'pwd_sha1': u'deleted', 'theme': u'gray', 'show_sidebar': True, 'sidebar_show_zero': False, 'pkey': u'ssl/deluge.key.pem', 'https': True, 'sessions': {u'deleted': {u'login': u'admin', u'expires': 1306795486.0, u'level': 10}}, 'base': u'/', 'pwd_salt': u'deleted', 'show_session_speed': False, 'first_login': False, 'cert': u'ssl/deluge.cert.pem', 'session_timeout': 3600, 'default_daemon': u'127.0.0.1:21387', 'sidebar_multiple_filters': True}
    24   [DEBUG   ] 00:07:45 server:253 Adding directory `/usr/lib/python2.7/site-packages/deluge/ui/web/css` with path ``
    25   [DEBUG   ] 00:07:45 server:253 Adding directory `/usr/lib/python2.7/site-packages/deluge/ui/web/icons` with path ``
    26   [DEBUG   ] 00:07:45 server:253 Adding directory `/usr/lib/python2.7/site-packages/deluge/ui/web/images` with path ``
    27   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.add_host
    28   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.add_torrents
    29   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.connect
    30   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.connected
    31   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.deregister_event_listener
    32   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.disconnect
    33   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.download_torrent_from_url
    34   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.get_config
    35   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.get_events
    36   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.get_host_status
    37   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.get_hosts
    38   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.get_plugin_info
    39   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.get_plugin_resources
    40   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.get_plugins
    41   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.get_torrent_files
    42   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.get_torrent_info
    43   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.get_torrent_status
    44   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.register_event_listener
    45   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.remove_host
    46   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.set_config
    47   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.start_daemon
    48   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.stop_daemon
    49   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.update_ui
    50   [DEBUG   ] 00:07:45 json_api:313 Registering method: web.upload_plugin
    51   [DEBUG   ] 00:07:45 configmanager:111 Getting config 'hostlist.conf.1.2'
    52   [DEBUG   ] 00:07:45 config:197 Setting 'hosts' to [('deleted', '127.0.0.1', 58846, '', '')] of <type 'list'>
    53   [DEBUG   ] 00:07:45 config:391 Config /home/me/.config/deluge/hostlist.conf.1.2 version: 1.1 loaded: {'hosts': [[u'deleted', u'localhost', 21387, '', '']]}
    54   [DEBUG   ] 00:07:45 coreconfig:43 CoreConfig init..
    55   [DEBUG   ] 00:07:45 sessionproxy:55 SessionProxy init..
    56   [DEBUG   ] 00:07:45 json_api:313 Registering method: auth.change_password
    57   [DEBUG   ] 00:07:45 json_api:313 Registering method: auth.check_session
    58   [DEBUG   ] 00:07:45 json_api:313 Registering method: auth.delete_session
    59   [DEBUG   ] 00:07:45 json_api:313 Registering method: auth.login
    60   [DEBUG   ] 00:07:45 configmanager:111 Getting config 'web.conf'
    61   [DEBUG   ] 00:07:45 pluginmanagerbase:65 Plugin manager init..
    62   [DEBUG   ] 00:07:45 configmanager:111 Getting config 'web.conf'
    63   [DEBUG   ] 00:07:45 pluginmanagerbase:116 Found plugin: Extractor 0.1
    64   [DEBUG   ] 00:07:45 pluginmanagerbase:116 Found plugin: Execute 1.2
    65   [DEBUG   ] 00:07:45 pluginmanagerbase:116 Found plugin: Blocklist 1.2
    66   [DEBUG   ] 00:07:45 pluginmanagerbase:116 Found plugin: AutoAdd 1.02
    67   [DEBUG   ] 00:07:45 pluginmanagerbase:116 Found plugin: Label 0.1
    68   [DEBUG   ] 00:07:45 pluginmanagerbase:116 Found plugin: Notifications 0.1
    69   [DEBUG   ] 00:07:45 pluginmanagerbase:116 Found plugin: WebUi 0.1
    70   [DEBUG   ] 00:07:45 pluginmanagerbase:116 Found plugin: Scheduler 0.2
    71   [INFO    ] 00:07:45 server:661 Starting server in PID 4503.
    72   [DEBUG   ] 00:07:45 server:589 Enabling SSL using:
    73   [DEBUG   ] 00:07:45 server:590 Pkey: ssl/deluge.key.pem
    74   [DEBUG   ] 00:07:45 server:591 Cert: ssl/deluge.cert.pem
    75   [INFO    ] 00:07:45 server:681 serving on 0.0.0.0:38511 view at https://127.0.0.1:38511
    76   [INFO    ] 00:07:45 client:221 Connecting to daemon at localhost:58846..
    77   [WARNING ] 00:07:45 client:224 Connection to daemon at localhost:58846 failed: Connection was refused by other side: 111: Connection refused.
    78   [DEBUG   ] 00:07:45 client:402 connect_fail: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionRefusedError'>: Connection was refused by other side: 111: Connection refused.
    79   ]
    80   [DEBUG   ] 00:07:45 client:541 on_connect_fail: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionRefusedError'>: Connection was refused by other side: 111: Connection refused.
    81   ]
    82   [INFO    ] 00:07:55 server:684 Shutting down webserver
    83   [DEBUG   ] 00:07:55 server:688 Saving configuration file
    84   [DEBUG   ] 00:07:55 server:704 Reactor not running

Here are the lines that I caught my eye, as well as what I think it's really doing
5-22 --> loads a default config
23 --> loads my user's config
52 --> sets the daemon(?) host to 127.0.0.1 (localhost) and the default daemon port
53 --> uses my user's config to set the host and daemon port
76 --> tries connecting to the default host and default daemon port
77 --> fails trying to do something i've told it not to do ;)

Any input will be appreciated as I'm at a total loss.

5arge

Re: [Solved] deluge-web: won't autoconnect to the daemon

Postby 5arge » Wed Jun 01, 2011 9:17 pm

Managed to work this one out. I by no means recommend doing this, but in my case, this was the only way I could get the web-ui to autoconnect.

In /usr/lib/python2.7/site-packages/deluge/ui/web/json_api.py (the path might be different on your distro -- I use Arch Linux), I found the following line:

Code: Select all

def connect(self, host="localhost", port=58846, username="", password=""):

and changed it to:

Code: Select all

 def connect(self, host="localhost", port=21387, username="", password=""):

21387 being the port that my local daemon runs on.

Try this at your own risk!

ktcheek

Re: [Solved] deluge-web: won't autoconnect to the daemon

Postby ktcheek » Mon Feb 06, 2012 9:24 am

It seems that the defect is that the default daemon's host-name/IP and port is completely ignored.
If you specify any value in the "default_daemon" in the ~/.config/deluge/web.conf file, the value will be ignored, and the web ui will attempt to connect to the default daemon.

For example, we have a deluged daemon running on 10.10.1.3:50000, and we specify the following in the web.conf file:

Code: Select all

"default_daemon": "10.10.1.3:50000",


The web ui will ignore that value and attempt to connect to localhost:58846.

I managed to get it to work, and use the configured host:port value by modifying the json_api.py file under /usr/lib/python2.7/dist-packages/deluge/ui/web
Around line 163, where it says

Code: Select all

   
            host = component.get("Web").get_host(default)
            self.connect()


Replace it with

Code: Select all

            defaultTuple = default.partition(":")
            host = defaultTuple[0]
            port = int(defaultTuple[2])
            self.connect(host, port, "", "")


After this change, it seems to work, and use the configured host/port value.

I followed the following instructions (http://dev.deluge-torrent.org/wiki/GitRepo) to get the source code and make a patch file.
Web-UI-AutoConnect-Fix.zip
Patch file for web UI
(837 Bytes) Downloaded 541 times


Where should I submit this fix to be reviewed/added?

Thanks.

P.S. I tested the fix on Ubuntu 11.10 Server Edition (x86) and it seems to work.

quakeguy

Re: [Solved] deluge-web: won't autoconnect to the daemon

Postby quakeguy » Sun Aug 12, 2012 5:28 am

Fix confirmed to work on Ubuntu 12.04LTS / Deluge 1.3.5 (from universe apt repo)

administrator@ug:~$ cat /etc/issue
Ubuntu 12.04 LTS \n \l

administrator@ug:~$ deluged --version
deluged: 1.3.5
libtorrent: 0.15.10.0

administrator@ug:~$ deluge-web --version
deluge-web: 1.3.5
libtorrent: 0.15.10.0

Cas
Top Bloke
Top Bloke
Posts: 3642
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: [Solved] deluge-web: won't autoconnect to the daemon

Postby Cas » Sun Aug 12, 2012 11:40 am


ssclanker
New User
New User
Posts: 4
Joined: Tue Oct 09, 2018 7:53 am

Re: [Solved] deluge-web: won't autoconnect to the daemon

Postby ssclanker » Thu Jan 09, 2020 6:20 am

Anyone else having this problem in 2019? I found this bug out after trying to run two deluge instances on the same server. It works almost flawlessly apart from this part. The previous reply says that it was fixed but I guess it wasn't for me?

Running Ubuntu Server 18.04 with default repositories and latest updates up to the time of this post.
"deluged --version" and "deluge-web --version" return:
deluged: 1.3.15
libtorrent: 1.1.5.0

EDIT:
I'm stupid, the solution to this is available in the FAQ under the title "How do I auto-connect to a specific daemon?". You just need to specify the ID according to the hostlist.conf file instead of using the ip address.

doublet30
New User
New User
Posts: 1
Joined: Sun May 03, 2020 7:13 pm

Re: [Solved] deluge-web: won't autoconnect to the daemon

Postby doublet30 » Sun May 03, 2020 7:26 pm

The problem still exists in 2020. But the problem isn't what the users think. Deluge works as intended by the developers, but it was not intended to put IP:port as default_daemon field nor was it intended for others to change the source for it to work. Altering the source code does work until you get an update from the repos. The correct way to set this up would be the following...
First, run

Code: Select all

sudo killall deluged
then run

Code: Select all

sudo killall deluge-web



then open up the following file...

/home/user1/.config/deluge/hostlists.conf.1.2


Code: Select all

{
  "file": 1,
  "format": 1
}{
  "hosts": [
    [
      "6fd1f0396395b85a9a16517f23f0f3bf38270999",
      "127.0.0.1",
      58846,
      "",
      ""
    ]
  ]
}


copy the salt ID for the server you wish to auto connect to. In this case, local host is the only option and the salt ID listed is
6fd1f0396395b85a9a16517f23f0f3bf38270999


Next, open up the following file...
/home/user1/.config/deluge/web.conf


and add the salt ID under default_daemon

Code: Select all

"default_daemon": "6fd1f0396395b85a9a16517f23f0f3bf38270999",


Then start your services back up

Code: Select all

deluged &
deluge-web &


Trying the web-ui or transmission client should now initiate autologin and updates will not break your autologin configuration because no source was modified.


Return to “Support”

Who is online

Users browsing this forum: No registered users and 13 guests