Opened 10 years ago

Closed 3 years ago

#2034 closed feature-request (Fixed)

Add systemd .service file

Reported by: mcx Owned by:
Priority: minor Milestone: 2.0.2
Component: Packaging Version: other (please specify)
Keywords: systemd unit service Cc:



I created deluged.service file[1] to support systemd[2].

It would be useful for all GNU/Linux distributions if you include it in deluge source packages.

[1] deluged.service attached

Best regards, Maciej Sitarz

Attachments (3)

deluged.service (176 bytes) - added by mcx 10 years ago.
Deluged systemd service file
deluged-web-ui.service (182 bytes) - added by mcx 10 years ago.
deluged-web-ui.socket (103 bytes) - added by mcx 10 years ago.

Download all attachments as: .zip

Change History (22)

Changed 10 years ago by mcx

Deluged systemd service file

comment:1 Changed 10 years ago by mcx

I also created a unit for deluged web interface daemon[1] and a .socket unit[2] for socket activation of the web UI.

[1] deluged-web-ui.service [2] deluged-web-ui.socket

Changed 10 years ago by mcx

Changed 10 years ago by mcx

comment:2 Changed 10 years ago by matimatik

Need socket passing support (either tcpd-like, or native systemd interface) in deluge-webui for this .socket to be usable. Maybe we need start new ticket about it...

comment:3 Changed 10 years ago by matimatik

Found this in Twisted documentation about integration with systemd.

comment:4 Changed 9 years ago by Cas

  • Resolution set to fixed
  • Status changed from new to closed

We don't really keep the service files in the codebase as they are either on the wiki or included by package maintainers.

I have created a systemd wiki page which probably needs fleshed out more.

I also think you should probably modify the script for deluged to also wait on the filesystem like the ubuntu upstart scripts.

comment:5 Changed 9 years ago by rahulsundaram

  • Resolution fixed deleted
  • Status changed from closed to reopened

I am the Fedora maintainer of Deluge and would request the systemd unit files be included in the codebase by default and conditionally installed only on distributions using systemd. This is easily achieved by using pkgconfig

Unlike sysv init scripts, systemd unit files are standardized across distros and Fedora (in the near future RHEL), (open)SUSE, Mageia, Mandriva, Arch Linux, NixOS etc use systemd by default and Debian installer has recently added support as well. Besides adding this support does not affect non-systemd distros in any way. Several upstream projects include systemd by default including Transmission etc. Thanks for your consideration.

comment:6 Changed 8 years ago by Cas

  • Milestone changed from Future to 2.0.0

comment:7 Changed 5 years ago by hobarrera

Personally, I'd much prefer that a user service file is provided (or maybe simply both, since one does not affect the other):

Description=A bitorrent client daemon

ExecStart=/usr/bin/deluged -d


This file should be installed into /usr/lib/systemd/user/deluged.service. The main difference is that this does not require root privileges to start the daemon, and it runs as a user of the service starting it (rather than a dedicated user).

I guess it may also allow multiple users to run their own instances of deluged (not sure if they could run at the same time) though.

comment:8 Changed 5 years ago by Cas

The reason for dedicated user is for security.

I have put service files into the codebase:

Though I will need to remember to include it in source tarball.

comment:9 Changed 5 years ago by hobarrera

The reason for dedicated user is for security.

I understand this, but that requires root privileges to manage (also, downloads directory permissions becomes a bit of a pain with multiple users).

A user systemd service runs as the user, and importantly, can be controlled (started/stopped) by that user.

Any reason to NOT include both systemd files (they go into different locations, so there's no conflict).

comment:10 Changed 5 years ago by Cas

Are you suggesting this for desktop users rather than server environment, which is what these service file we originally intended for.

I am trying to envisage the scenarios that you are trying to cater for and whether there is a better alternative to cover all of them.

For example I have been looking at systemd as user:

comment:11 Changed 5 years ago by hobarrera

Yup, the additional file I'm proposing is geared towards desktop users, rather than dedicated machines.

I don't think a *single* alternative can cover both scenarios; they're pretty different.

comment:12 Changed 4 years ago by Cas

  • Milestone changed from 2.0 to 2.0.0

Milestone renamed

comment:13 Changed 4 years ago by Cas

So looking at this again, I am thinking that removing the user and group and instead put them in a conf file /etc/systemd/system/deluged.d/user.conf. This would mean the service files can be installed in both system and user locations.

comment:14 Changed 4 years ago by hobarrera

That's not correct: non-root users can't edit the /etc/systemd/system/deluged.d/user.conf file.

The systemd user unit file allows non-root users to manage and run deluge as themselves, without requiring root access on the host.

comment:15 Changed 4 years ago by Cas

Without the user details in service files they can be installed to both system and user. There is no need for a non-root user to edit /etc/systemd/system/deluged.d/user.conf file.

Last edited 4 years ago by Cas (previous) (diff)

comment:16 Changed 3 years ago by hobarrera

Without the user details, the system version would run as root, rather than as a dedicated user. Running a torrent daemon as root sounds like an awful idea, especially security-wise.

comment:17 Changed 3 years ago by Cas

  • Milestone changed from 2.0.0 to 2.1.x

Ticket retargeted after milestone closed

comment:18 Changed 3 years ago by Cas

  • Milestone changed from 2.1.x to 2.0.2

comment:19 Changed 3 years ago by Cas

  • Resolution set to Fixed
  • Status changed from reopened to closed

Now in tarball: 212efc4f52dd9979511b871a560356c3e7b7ad6b

@hobarrera As long as package maintainers correctly install the service file with user.conf file and create deluge user there is no issue.

/etc/systemd/system/deluged.service /etc/systemd/system/deluged.service.d/user.conf

The use of deluge user in service file does rely on the actual deluge user being added to the system. I think it makes sense to remove it from the default service file and include details in user and packaging guides that using root is discouraged and detail how to setup with specific user.

Note: See TracTickets for help on using tickets.