deluge-web won't start via systemd

General support for problems installing or using Deluge
kyqulu
New User
New User
Posts: 5
Joined: Mon Apr 23, 2018 6:16 pm
OS or Distro: Ubuntu

deluge-web won't start via systemd

Postby kyqulu » Mon Apr 23, 2018 6:43 pm

Hi all,

I've probably missed something obvious (sorry), but I'm really struggling to get deluge-web to start via systemd on an Ubuntu 17.10 system. I've installed the dev version of deluged and deluge-web and followed https://dev.deluge-torrent.org/wiki/Use ... ce/systemd which works fine for the main deluged but not for -web.

My upstart file is:
phoenix@athos:/lib/systemd/system$ cat deluge-web.service
[Unit]
Description=Deluge Bittorrent Client Web Interface
Documentation=man:deluge-web
After=network-online.target deluged.service
Wants=deluged.service

[Service]
Type=simple
User=deluge
Group=deluge
UMask=027
# This 5 second delay is necessary on some systems
# to ensure deluged has been fully started
ExecStartPre=/bin/sleep 5
ExecStart=/usr/bin/deluge-web -l /var/log/deluge/web.log -L warning
Restart=on-failure

[Install]
WantedBy=multi-user.target

However when I start this, it just terminates with no output

phoenix@athos:/lib/systemd/system$ sudo systemctl enable deluge-web.service
Created symlink /etc/systemd/system/multi-user.target.wants/deluge-web.service → /lib/systemd/system/deluge-web.service.
phoenix@athos:/lib/systemd/system$ sudo systemctl start deluge-web.service
phoenix@athos:/lib/systemd/system$ sudo systemctl status deluge-web.service
● deluge-web.service - Deluge Bittorrent Client Web Interface
Loaded: loaded (/lib/systemd/system/deluge-web.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2018-04-23 19:34:24 BST; 3s ago
Docs: man:deluge-web
Process: 10775 ExecStart=/usr/bin/deluge-web -l /var/log/deluge/web.log -L warning (code=exited, status=0/SUCCESS)
Process: 10769 ExecStartPre=/bin/sleep 5 (code=exited, status=0/SUCCESS)
Main PID: 10775 (code=exited, status=0/SUCCESS)
CPU: 187ms

Apr 23 19:34:19 athos systemd[1]: Starting Deluge Bittorrent Client Web Interface...
Apr 23 19:34:24 athos systemd[1]: Started Deluge Bittorrent Client Web Interface.

There is nothing in the log file:
phoenix@athos:/lib/systemd/system$ sudo ls -l /var/log/deluge/
total 4
-rw-rw---- 1 deluge deluge 450 Apr 23 09:43 daemon.log
-rw-r----- 1 deluge deluge 0 Apr 23 19:34 web.log

The home folder /var/lib/deluge/.config etc. is owned by the deluge user and all looks OK.

If I su to the deluge user (I've temporarily given it a shell that isn't /bin/false) then it runs and works fine:
phoenix@athos:/lib/systemd/system$ sudo su - deluge
deluge@athos:~$ /usr/bin/deluge-web -l /var/log/deluge/web.log -L warning
deluge@athos:~$ ps aux | grep deluge-web
deluge 10838 1.6 0.2 155404 44508 ? S 19:36 0:00 deluge-web

and the web interface works fine. Any thoughts on what I've missed?

sinaptika
Member
Member
Posts: 41
Joined: Thu Apr 27, 2017 6:23 pm
OS or Distro: Linux/Alpine,Debian

Re: deluge-web won't start via systemd

Postby sinaptika » Tue Apr 24, 2018 9:16 am

Change the exec line in Service section to:

Code: Select all

ExecStart=/usr/bin/deluge-web

Then run:

Code: Select all

sudo systemctl daemon-reload
sudo systemctl start deluge-web.service
sudo systemctl status deluge-web.service


Since logging is now going to stdout, use

Code: Select all

journalctl -u deluge-web-service

What does it say?
Last edited by sinaptika on Fri Apr 27, 2018 6:59 pm, edited 2 times in total.

kyqulu
New User
New User
Posts: 5
Joined: Mon Apr 23, 2018 6:16 pm
OS or Distro: Ubuntu

Re: deluge-web won't start via systemd

Postby kyqulu » Tue Apr 24, 2018 10:22 am

Hi,

Thanks for the reply. That doesn't show anything:
phoenix@athos:~$ sudo vim /lib/systemd/system/deluge-web.service
[sudo] password for phoenix:
phoenix@athos:~$ sudo systemctl daemon-reload
phoenix@athos:~$ sudo systemctl start deluge-web.service
phoenix@athos:~$ sudo systemctl status deluge-web.service
● deluge-web.service - Deluge Bittorrent Client Web Interface
Loaded: loaded (/lib/systemd/system/deluge-web.service; enabled; vendor prese
Active: inactive (dead) since Tue 2018-04-24 11:22:08 BST; 1s ago
Docs: man:deluge-web
Process: 16666 ExecStart=/usr/bin/deluge-web (code=exited, status=0/SUCCESS)
Process: 16659 ExecStartPre=/bin/sleep 5 (code=exited, status=0/SUCCESS)
Main PID: 16666 (code=exited, status=0/SUCCESS)
CPU: 192ms

Apr 24 11:22:03 athos systemd[1]: Starting Deluge Bittorrent Client Web Interfac
Apr 24 11:22:08 athos systemd[1]: Started Deluge Bittorrent Client Web Interface
phoenix@athos:~$ journalctl -u deluge-web-service
-- Logs begin at Thu 2018-04-19 22:08:24 BST, end at Tue 2018-04-24 11:22:11 BST
-- No entries --

Cheers.

shamael
Super Seeder
Super Seeder
Posts: 401
Joined: Sat Oct 08, 2016 9:28 am
OS or Distro: osmc

Re: deluge-web won't start via systemd

Postby shamael » Tue Apr 24, 2018 12:40 pm

Try with debug level.
ExecStart=/usr/bin/deluge-web -l /var/log/deluge/web.log -L deluge

Is deluge.service running when you try?
Does the Deluge user have permission to write in /var/log/deluge?

kyqulu
New User
New User
Posts: 5
Joined: Mon Apr 23, 2018 6:16 pm
OS or Distro: Ubuntu

Re: deluge-web won't start via systemd

Postby kyqulu » Tue Apr 24, 2018 3:12 pm

Hi,
No. I wonder if you mean "-L debug" and not "-L deluge" - I tried both just in case and that does exactly the same thing (nothing).
phoenix@athos:/etc/netplan$ sudo systemctl daemon-reload
phoenix@athos:/etc/netplan$ sudo systemctl start deluge-web.service
phoenix@athos:/etc/netplan$ sudo systemctl status deluge-web.service
● deluge-web.service - Deluge Bittorrent Client Web Interface
Loaded: loaded (/lib/systemd/system/deluge-web.service; enabled; vendor prese
Active: activating (start-pre) since Tue 2018-04-24 16:07:44 BST; 2s ago
Docs: man:deluge-web
Process: 17858 ExecStart=/usr/bin/deluge-web -l /var/log/deluge/web.log -L del
Main PID: 17858 (code=exited, status=2); Control PID: 17875 (sleep)
Tasks: 1 (limit: 4915)
Memory: 188.0K
CPU: 5ms
CGroup: /system.slice/deluge-web.service
└─control
└─17875 /bin/sleep 5

Apr 24 16:07:44 athos systemd[1]: Starting Deluge Bittorrent Client Web Interfac
phoenix@athos:/etc/netplan$ journalctl -u deluge-web-service
-- Logs begin at Thu 2018-04-19 22:08:24 BST, end at Tue 2018-04-24 16:07:55 BST
-- No entries --


Yes, the deluge user can write to /var/log/deluge:
phoenix@athos:/etc/netplan$ ls -l /var/log/ | grep deluge
drwxr-x--- 2 deluge deluge 4096 Apr 24 16:07 deluge

phoenix@athos:/etc/netplan$ sudo ls -l /var/log/deluge/
total 44
-rw-rw---- 1 deluge deluge 38928 Apr 24 16:06 daemon.log

Yes, deluged is running:
phoenix@athos:/etc/netplan$ sudo systemctl status deluged.service
● deluged.service - Deluge Bittorrent Client Daemon
Loaded: loaded (/lib/systemd/system/deluged.service; enabled; vendor preset:
Active: active (running) since Tue 2018-04-24 13:28:55 BST; 2h 44min ago
Docs: man:deluged
Main PID: 17174 (deluged)
Tasks: 8 (limit: 4915)
Memory: 104.2M
CPU: 59.038s
CGroup: /system.slice/deluged.service
└─17174 /usr/bin/python /usr/bin/deluged -d -l /var/log/deluge/daemon

Apr 24 13:28:55 athos systemd[1]: Started Deluge Bittorrent Client Daemon.
phoenix@athos:~$ ps aux | grep deluge
deluge 17174 0.5 0.7 735492 121480 ? Ssl 13:28 0:59 /usr/bin/python /usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning



If I become 'deluge' user, then I can start it manually:
deluge@athos:~$ whoami
deluge
deluge@athos:~$ pwd
/var/lib/deluge
deluge@athos:~$ deluge-web
deluge@athos:~$ ps aux | grep deluge-web
deluge 18486 2.0 0.2 232484 45724 ? Sl 16:11 0:00 deluge-web
deluge 18489 0.0 0.0 14352 1072 pts/1 S+ 16:11 0:00 grep deluge-web
deluge@athos:~$ ls /var/log/deluge/ -l
total 44
-rw-rw---- 1 deluge deluge 38928 Apr 24 16:06 daemon.log
-rw-r----- 1 deluge deluge 0 Apr 24 16:10 web.log
deluge@athos:~$

and I can browse to port 8112 via a web browser and all works as expected.

kyqulu
New User
New User
Posts: 5
Joined: Mon Apr 23, 2018 6:16 pm
OS or Distro: Ubuntu

Re: deluge-web won't start via systemd

Postby kyqulu » Tue Apr 24, 2018 6:36 pm

Hi again,

I'm pushing my Linux knowledge here, but I've tried to strace deluge-web from within systemd and I'm rather confused about what's happened.

If I set

ExecStart=/usr/bin/strace -f /usr/bin/deluge-web -l /var/log/deluge/web.log -L debug

Then deluge-web starts!

If I set it to: ExecStart=/usr/bin/strace -o /dev/shm/strace.txt /usr/bin/deluge-web -l /var/log/deluge/web.log -L debug

Then it terminates instantly, however I do get a 10k line strace output.

The last few lines are:

Code: Select all

openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/xdg/BaseDirectory.pyc", O_RDONLY) = 5
fstat(5, {st_mode=S_IFREG|0644, st_size=6204, ...}) = 0
read(5, "\3\363\r\n\360\342\350Rc\0\0\0\0\0\0\0\0\4\0\0\0@\0\0\0s|\1\0\0d\0"..., 4096) = 4096
fstat(5, {st_mode=S_IFREG|0644, st_size=6204, ...}) = 0
read(5, " precedence over later ones.N(\5\0"..., 4096) = 2108
read(5, "", 4096)                       = 0
close(5)                                = 0
stat("/usr/lib/python2.7/dist-packages/xdg/os", 0x7fff010a8f10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/xdg/os.x86_64-linux-gnu.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/xdg/os.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/xdg/osmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/xdg/os.py", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/xdg/os.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib/python2.7/dist-packages/xdg/stat", 0x7fff010a8f10) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/xdg/stat.x86_64-linux-gnu.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/xdg/stat.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/xdg/statmodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/xdg/stat.py", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python2.7/dist-packages/xdg/stat.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
close(4)                                = 0
stat("/var/lib/deluge/.config/deluge", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
stat("/var/lib/deluge/.config/deluge/", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f41e4d97a10) = 20307
exit_group(0)                           = ?
+++ exited with 0 +++


but as I said, this is getting beyond my skills and I'm very confused why it runs when prefixed with strace -f !

sinaptika
Member
Member
Posts: 41
Joined: Thu Apr 27, 2017 6:23 pm
OS or Distro: Linux/Alpine,Debian

Re: deluge-web won't start via systemd

Postby sinaptika » Fri Apr 27, 2018 6:59 pm

Change the exec line in Service section to:

Code: Select all

ExecStart=/usr/bin/deluge-web -d


Anything?

kyqulu
New User
New User
Posts: 5
Joined: Mon Apr 23, 2018 6:16 pm
OS or Distro: Ubuntu

Re: deluge-web won't start via systemd

Postby kyqulu » Fri Apr 27, 2018 7:21 pm

Thanks, I've tried this and it works! I can also append "-l /var/log/deluge/web.log -L warning" still with the -d and all good.

Any idea why it works with -d, but not without?

sinaptika
Member
Member
Posts: 41
Joined: Thu Apr 27, 2017 6:23 pm
OS or Distro: Linux/Alpine,Debian

Re: deluge-web won't start via systemd

Postby sinaptika » Fri Apr 27, 2018 9:03 pm

Systemd Type=Simple and the change in deluge-web behavior from 1.3.15 to 2.0 (-f vs -d)
You wrote all the info needed btw, I was just slow to notice :(


Return to “Support”

Who is online

Users browsing this forum: No registered users and 8 guests