[SOLVED] Can't connect via ThinClient/WebUI

General support for problems installing or using Deluge
Post Reply
aremmaps
New User
New User
Posts: 4
Joined: Tue Aug 22, 2017 4:38 pm

[SOLVED] Can't connect via ThinClient/WebUI

Post by aremmaps »

I've created a torrent box using a Raspberry Pi (first series), I've started it on raspbian Jessie (based on debian Jessie) and it was running but irregularly and with various issues, so I've upgraded system to Rasbpian Stretch (based on the present debian stable release).

I've followed this article for configuration: http://dev.deluge-torrent.org/wiki/UserGuide/ThinClient
I've followed this article for services: http://dev.deluge-torrent.org/wiki/User ... ce/systemd
NOTE: I'm downloading stuff on an external disk mounted via fstab under /media/tordown:

Code: Select all

$ cat /etc/fstab
proc						/proc           proc    defaults          0       0

#PARTUUID=442b7a91-01 				/boot           vfat    defaults          0       2
UUID=109A-9113					/boot           vfat    defaults          0       2

#PARTUUID=442b7a91-02				/               ext4    defaults,noatime  0       1
UUID=673b8ab6-6426-474b-87d3-71bff0fcebc3	/               ext4    defaults,noatime  0       1

# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

#/dev/sda1: LABEL="TorDown" UUID="B27C0F097C0EC855" TYPE="ntfs" PARTUUID="4d0741b4-01"
PARTUUID=4d0741b4-01  /media/tordown  ntfs    defaults,nofail	0	2
#UUID=B27C0F097C0EC855				/media/tordown  ntfs    defaults,nofail	0	2
When I was on Jessie, services were running but ThinClient/WebYU weren't working and irregularly the two systemcd services were failing, I could connect from remote only after killing services (using 'killall deluged' and 'killall deluge-web') and restarting them as normal raspbian user (which is different from the deluge user suggested by the wiki). So I thought it was an issue with permissions accessing my USB disk, but I don't know how to solve this.

I've commented out User and Group line in deluged.service and deluge-web.service and WebUI appears.

I've then upgraded distro from Jessie to Stretch and these are the installed packages and their versions:

Code: Select all

$ dpkg-query -l 'deluge*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  deluge-common  1.3.13+git20 all          bittorrent client written in Pyth
ii  deluge-console 1.3.13+git20 all          bittorrent client written in Pyth
un  deluge-core    <none>       <none>       (no description available)
un  deluge-torrent <none>       <none>       (no description available)
un  deluge-torrent <none>       <none>       (no description available)
ii  deluge-web     1.3.13+git20 all          bittorrent client written in Pyth
un  deluge-webui   <none>       <none>       (no description available)
ii  deluged        1.3.13+git20 all          bittorrent client written in Pyth

Now nothing is working, but this time the two services are active and running and don't fail after few seconds.
If I kill deluge-web and restart it as user, it works but it has lost my configurations (download location, changed password, saved host, selected plugins, etc.), it doesn't save new configurations (like password, download locations and saved host) and it doesn't connect to host.

Host is 192.168.1.50:58846 and these are my services:

Code: Select all

$ cat /etc/systemd/system/deluged.service 
[Unit]
Description=Deluge Bittorrent Client Daemon
Documentation=man:deluged
After=network-online.target media-tordown.mount
#After=network-online.target
Requires=media-tordown.mount
BindsTo=media-tordown.mount
[Service]
Type=simple
#User=deluge
#Group=deluge
UMask=007
ExecStart=/usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning
#ExecStart=/usr/bin/deluged -l /var/log/deluge/daemon.log -L warning
Restart=on-failure
# Time to wait before forcefully stopped.
TimeoutStopSec=300
[Install]
WantedBy=multi-user.target media-tordown.mount
#WantedBy=multi-user.target

$ cat /etc/systemd/system/deluge-web.service 
[Unit]
Description=Deluge Bittorrent Client Web Interface
Documentation=man:deluge-web
After=network-online.target deluged.service tordown.mount
#After=network-online.target deluged.service
Requires=tordown.mount
BindsTo=tordown.mount
Wants=deluged.service
[Service]
Type=simple
#User=deluge
#Group=deluge
UMask=027
ExecStart=/usr/bin/deluge-web -l /var/log/deluge/web.log -L warning
Restart=on-failure
[Install]
WantedBy=multi-user.target tordown.mount
#WantedBy=multi-user.target
Last edited by aremmaps on Thu Aug 24, 2017 10:15 am, edited 1 time in total.
shamael
Compulsive Poster
Compulsive Poster
Posts: 667
Joined: Sat Oct 08, 2016 9:28 am

Re: Can't connect via ThinClient/WebUI

Post by shamael »

Deluge works with profiles, reason why you cannot see the configuration set (torrent, preferences, etc) when starting Deluge with another user.

The systemd.service setup uses the user Deluge to start the deamon, so the config is stored in the home drive of the user Deluge when the daemon is started (/var/lib/deluge/.config/deluge). Kill the process and start deluge by hand under the user XYZ wil result with a creation of a new profile in the home drive of this user (~/.config/deluge).

Permission: the user deluge has to have the right on the USB drive for all folder configured in your preferences. I m' not going to deep here, it depends of your setup but be sure the user Deluge is able to write to its destination. You can try as deluge user with something like
sudo -u deluge mkdir /media/tordown/test

Access: did you enabled the remote access in the config and created a user+password as described?

RPi: I tried my first setup with a RPI 1...to my opinion forget it. The device is not powerful enough to handle the traffic with a lot of performance issue and crash. I'm currently running an RPI3 with kodi/samba/Deluge without any performance issue (considering the device). I'm not telling you it's not working, just that it was not as expected for me.

the disk: if possible format it as EXT4. I tried the NTFS mount and the disk write performance took between 40 and 60% of a CPU on a RPI3...Again this is my experience, I'm just trying to avoid you all the issues I faced to.

Deluge installation: for jessie you should try the PPA installation (check the wiki). A PPA repo is maintained so you can get the last stable version of Deluge and libtorrent with a matter of apt-get install. However the definitive how to for Stretch is not yet done, somme issue with the PPA and Debian dependecies. A topic exists http://forum.deluge-torrent.org/viewtop ... 68#p227068
aremmaps
New User
New User
Posts: 4
Joined: Tue Aug 22, 2017 4:38 pm

Re: Can't connect via ThinClient/WebUI

Post by aremmaps »

Performance isn't a concern, it's working.

So far I've done this:
1) Stopped and disabled deluged and deluge-web systemd services.
2) Logged in as deluge user: 'su --shell /bin/bash --login deluge'.
3) Executed 'deluged' and 'killall deluged' to create config files.
4) Executed 'deluged'
5) Executed 'deluge-console' and then "config -s allow_remote True" and "config allow_remote".
6) Changed group ownership of mounted disk location to deluge (already was) with 'chgrp -R deluge $path'.
7) Changed permissions of mounted disk location with 'chmod -R 774 $path' (it wasn't).
8) Enabled and started deluged service.

It's still not working, 'systemctl status deluged' shows it's up and running, ps shows it's running under user deluge:

Code: Select all

ps aux | grep deluged
deluge    4482 91.7  7.1  16724 13188 ?        Rs   10:25   0:07 /usr/bin/python /usr/bin/deluged -d -c /home/deluge/.config/deluge -l /var/log/deluge/daemon.log -L warning
What did I do wrong?

PS: I know I'm using /home/deluge/config/deluge and not /var/lib/deluge as in the wiki, but I've changed systemd service accordingly with 'ExecStart=/usr/bin/deluged -d -c /home/deluge/.config/deluge -l /var/log/deluge/daemon.log -L warning'.

EDIT: If it can help, I've tried to connect via deluge-console from another computer:

Code: Select all

>>> connect 192.168.1.50:58846 delugepi delugepi
Failed to connect to 192.168.1.50:58846 with reason: Connection refused 
I can't find on raspberry any log with more details.

I'm testing port connectivity and connection is being refused:

Code: Select all

% LC_ALL=C nc -zv 192.168.1.50 58846                :(
PC192.168.1.50 [192.168.1.50] 58846: Connection refused
% LC_ALL=C nc -zv 192.168.1.50 8112                 :(
PC192.168.1.50 [192.168.1.50] 8112: Connection refused

shamael
Compulsive Poster
Compulsive Poster
Posts: 667
Joined: Sat Oct 08, 2016 9:28 am

Re: Can't connect via ThinClient/WebUI

Post by shamael »

'ExecStart=/usr/bin/deluged -d -c /home/deluge/.config/deluge -l /var/log/deluge/daemon.log -L warning

Is the deluge user created with a default home drive "/home/deluge"? (in /etc/passwd I mean)
If yes remove the bold part. If not I think only "-c /home/deluge" is necessary

Can you give it a try?
aremmaps
New User
New User
Posts: 4
Joined: Tue Aug 22, 2017 4:38 pm

Re: Can't connect via ThinClient/WebUI

Post by aremmaps »

Code: Select all

$ cat /etc/passwd | grep deluge
deluge:x:110:115:Deluge Service,,,:/home/deluge:/bin/false
Edited deluged.service accordingly but still not working, connection gets refused:

Code: Select all

$ cat /etc/systemd/system/deluged.service 
[Unit]
Description=Deluge Bittorrent Client Daemon
Documentation=man:deluged
After=network-online.target media-tordown.mount
#After=network-online.target
Requires=media-tordown.mount
BindsTo=media-tordown.mount
[Service]
Type=simple
User=deluge
#User=pi
Group=deluge
#Group=pi
UMask=007
ExecStart=/usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning
#ExecStart=/usr/bin/deluged -d -c /home/deluge/.config/deluge -l /var/log/deluge/daemon.log -L warning
#ExecStart=/usr/bin/deluged
Restart=on-failure
# Time to wait before forcefully stopped.
TimeoutStopSec=300
[Install]
WantedBy=multi-user.target media-tordown.mount
#WantedBy=multi-user.target
New working experiment:
1) Stop systemd deluged service.
2) Logged in as user deluge.
3) Run 'deluge -c .config/deluge'
4) Tried to connect from client to raspberry via deluge-console: working.

So it seems to be a problem restricted to systemd service.

EDIT: Maybe it's a write permission issue.
I've tried deluged.service with 2 different ExecStart lines:
NOT working: 'ExecStart=/usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning'
Working: 'ExecStart=/usr/bin/deluged -d'

Probably deluge user doesn't have write permissions on /var/log/deluge/daemon.log.

EDIT 2: after changing ownership of /var/log/deluge I can connect via deluge-console from a client.
This is the part in the wiki I skipped as mistake:

Code: Select all

sudo mkdir -p /var/log/deluge
sudo chown -R deluge:deluge /var/log/deluge
sudo chmod -R 750 /var/log/deluge
From Logging section in http://dev.deluge-torrent.org/wiki/User ... ce/systemd
shamael
Compulsive Poster
Compulsive Poster
Posts: 667
Joined: Sat Oct 08, 2016 9:28 am

Re: Can't connect via ThinClient/WebUI

Post by shamael »

is the user Deluge able to write in the log located in /var/log/deluge? Can you change the log level from warning to debug?

OR maybe set the service as simple as possible, without any log option or dependency to media-tordown.mount (no quote needed with the dash?) to track the root cause.
shamael
Compulsive Poster
Compulsive Poster
Posts: 667
Joined: Sat Oct 08, 2016 9:28 am

Re: [SOLVED] Can't connect via ThinClient/WebUI

Post by shamael »

Lol, I didn't refresh the topic prior answer :p.
Post Reply