Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 828507 - net-p2p/deluge /var/lib/deluge missing after emerge
Summary: net-p2p/deluge /var/lib/deluge missing after emerge
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Paolo Pedroni
URL: https://wiki.gentoo.org/wiki/Deluge
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2021-12-07 11:59 UTC by Peter Sasi
Modified: 2023-04-05 12:00 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Sasi 2021-12-07 11:59:44 UTC
Neither the deluge package itself, nor the dependencies it brings with itself create the /var/lib/deluge directory for storing its config and resume files.
It also needs to be owned by deluge:deluge that _are_ created by the acct-group/deluge and acct-user/deluge dependencies.
This /etc/init.d/deluged start fails.
This is also extremly hard to debug as the stdout and stderr of /etc/init.d/deluge and the start-stop-daemon are not getting logged into /var/log/messages. Isn't that supposed to be the log for OpenRC?

Reproducible: Always

Steps to Reproduce:
1. emerge --ask net-p2p/deluge
2. /etc/init.d/deluged start

Actual Results:  
not output but the process identified by /run/deluged
no deluged process in pstree or ps axuw output.

Expected Results:  
deluged daemon started.

Fix:
mkdir /var/log/deluge
chown deluge.deluge /var/log/deluge

Optionally replace s-s-d invocation in /etc/init.d/deluged with:
        start-stop-daemon --verbose --progress \
        --stdout /var/lib/deluge/start-out.log \
        --stderr /var/lib/deluge/start-err.log \
        --start --user "${DELUGED_USER%:*}" \
        --name deluged --pidfile /run/deluged.pid --background --make-pidfile \
        ${DELUGED_UMASK:+--umask ${DELUGED_UMASK}} \
        --exec /usr/bin/deluged -e HOME="${DELUGED_USER_HOME}" -- --do-not-daemonize ${DELUGED_OPTS}
Comment 1 Peter Sasi 2021-12-08 03:34:25 UTC
Let me know if I can actually help to fix the documentation instead of just submitting bugs!
Comment 2 Paolo Pedroni 2021-12-14 16:08:08 UTC
At the moment the PC on which I use deluge is not working, so I can't help fix this bug. I hope I can be back to it ASAP
Comment 3 Pacho Ramos gentoo-dev 2022-10-28 22:12:25 UTC
In Fedora it seems they create it at install time:
https://src.fedoraproject.org/rpms/deluge/blob/rawhide/f/deluge.spec#_115
Comment 4 Kolhell 2023-03-20 01:15:34 UTC
I would like to comment that this is still an issue for starting both deluged and deluge-web via openrc (cannot comment on systemd).

The way I see it there are two relatively simple solutions:

1) Set user 'deluge' homedir to /var/lib/deluge by adding

    ACCT_USER_HOME=/var/lib/deluge

    to package 'acct-user/deluge'

Just checking against my own Gentoo packages for example, this is used by polkit and mongodb.

2) If for some reason we are against the 'deluge' user having a homedir, we can add the following

    keepdir /var/lib/deluge
    use prefix || fowners deluge:deluge /var/lib/deluge

    to package 'net-p2p/deluge'

For example this solution is used by packages ntp and openldap.

I personally think #1 should be preferred, as the deluge user effectively treats /var/lib/deluge as a homedir.



Further:

The reason this is difficult to root out is because by default deluged (when started with openrc; I cannot speak to systemd) logs to /var/lib/deluge/.config/deluge/deluged.log, and deluge-web (again, when started with openrc) logs to /var/lib/deluge/deluge-web.log, neither of which can happen when /var/lib/deluge has not been created and permissions set.

It may be worth consideration to set the log defaults to /var/log (from /var/lib) to conform to Gentoo standards, but this is a separate issue.
Comment 5 Larry the Git Cow gentoo-dev 2023-04-05 12:00:57 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9b3461d8ab83d867c3a562d5dc16663f1edb55da

commit 9b3461d8ab83d867c3a562d5dc16663f1edb55da
Author:     kolhell <kolspambox@gmail.com>
AuthorDate: 2023-03-20 18:59:01 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2023-04-05 11:54:38 +0000

    acct-user/deluge: add /var/lib/deluge as ACCT_USER_HOME
    
    Sets homedir for the 'deluge' user to '/var/lib/deluge'
    which is the default working directory for both deluged and
    deluge-web when started with openrc. This change makes the openrc
    scripts work out-of-the-box after emerging deluge.
    
    Previously users were required to manually create and set
    permissions for this directory and/or edit configs for deluged and
    deluge-web for them to be startable via openrc. Since the deluge
    user also writes logs to this directory by default, this solution
    is not always apparent to users.
    
    Closes: https://bugs.gentoo.org/828507
    Signed-off-by: kolhell <kolspambox@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/30272
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 acct-user/deluge/deluge-0-r1.ebuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)