Page 1 of 1

Can't connect deluge-console when deluged run as a service

Posted: Fri Dec 06, 2019 10:13 am
by Garu94
I run deluged as a service:

Code: Select all

[Unit]
Description=Deluge Bittorrent Client Daemon
Documentation=man:deluged
After=network-online.target

[Service]
Type=simple
UMask=007

ExecStart=/usr/bin/deluged -d

Restart=on-failure

# Time to wait before forcefully stopped.
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target
To make it run at boot. Though, even if the status of the service is active:

Code: Select all

pi@raspberrypi:/ $ sudo systemctl status deluged
● deluged.service - Deluge Bittorrent Client Daemon
   Loaded: loaded (/etc/systemd/system/deluged.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/deluged.service.d
           └─user.conf
   Active: active (exited) since Fri 2019-12-06 07:22:55 GMT; 2h 42min ago
     Docs: man:deluged
   Memory: 0B
   CGroup: /system.slice/deluged.service

Dec 06 07:22:54 raspberrypi systemd[1]: Starting LSB: Start or stop the Deluge BitTorrent daemon....
Dec 06 07:22:55 raspberrypi deluged[451]: Starting Deluge BitTorrent Daemon: deluged Not starting Deluge BitTorrent Daemon deluged, disabled in /etc/default/deluged.
Dec 06 07:22:55 raspberrypi systemd[1]: Started LSB: Start or stop the Deluge BitTorrent daemon..
When I run deluge-console, I get this:

Code: Select all

Failed to connect to 127.0.0.1:58846 with reason: Connection refused     
While when I run it from command line, running 'deluged' and then 'deluge-console', everything works fine.
What am I doing wrong?

EDIT:
Also, when I try to restart the service, this i what happens:

Code: Select all

pi@raspberrypi:/ $ systemctl restart deluged.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'deluged.service'.
Authenticating as: root
Password: 
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Failed to restart deluged.service: Access denied
See system logs and 'systemctl status deluged.service' for details.
And systemctl status prints the same as before

Re: Can't connect deluge-console when deluged run as a service

Posted: Thu Dec 12, 2019 9:50 am
by shamael
There is no user/group defined in the service so root should be the default. The user pi has not the necessary permission to execute the commands.
If root is the user you want to use execute first "sudo bash" and it should work
It may be advisable to create a dedicated user (see the wiki) but not necessary

Re: Can't connect deluge-console when deluged run as a service

Posted: Fri Dec 13, 2019 10:50 am
by Garu94
Hi, I changed this adding
User=pi
Group=pi
but still get the same error when running deluge-console at startup.

Re: Can't connect deluge-console when deluged run as a service

Posted: Mon Dec 16, 2019 10:16 am
by shamael
considering the daemon has been restarted with systemctl, may you now try
sudo bash
sudo -u pi deluge-console