FS#28847 - [deluge] Recent revamp scripts is very strangely

Attached to Project: Arch Linux
Opened by Andrew (gman) - Saturday, 10 March 2012, 08:21 GMT
Last edited by Jan Alexander Steffens (heftig) - Monday, 27 August 2012, 09:46 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan Alexander Steffens (heftig)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 7
Private No

Details

Description:

Recent revamp scripts is very strangely. kill executed two times on head /etc/rc.d/deluged and in case stop. It provided unwanted message from kill. And why deleted DELUGE_USER?

Additional info:
* package version(s)
1.3.4-1

Sorry for my poor English.

Best regards,

Andrey
This task depends upon

Closed by  Jan Alexander Steffens (heftig)
Monday, 27 August 2012, 09:46 GMT
Reason for closing:  None
Additional comments about closing:  invalid
Comment by Niclas (niclasc) - Saturday, 10 March 2012, 21:51 GMT
I have also notised that the option DELUGE_USER dosent work anymore.
Is it a bug or is it by design?
Comment by Andrew (gman) - Sunday, 11 March 2012, 05:22 GMT
DELUGE_USER was removed from /etc/rc.d/deluged and now deluge user hardcoded in /etc/rc.d/deluged as 'deluge'. Why, I do not know.
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 10:35 GMT
So is it then possible do replace the user "deluge" with my user in /etc/rc.d/deluged and it will work as it used to do in older versions?
Will deluged then run as my user?
Comment by Andrew (gman) - Sunday, 11 March 2012, 11:59 GMT
Yes.
I temporarily replaced "deluge" with $DELUGE_USER in following string
[[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluged $OPTIONS >/dev/null" deluge
and add DELUGE_USER to /etc/conf.d/deluged as in older version.
But /etc/rc.d/deluged will replaced with update. I want maintainer to clarify this issue.
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 12:03 GMT
Can you explain more? Where do I put your string?
Comment by Andrew (gman) - Sunday, 11 March 2012, 12:09 GMT
In /etc/conf.d/deluged

OPTIONS=""
WEB_OPTIONS=""
DELUGE_USER="user"

In /etc/rc.d/deluged

http://pastebin.com/WFe2w48k
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 12:27 GMT
Nope, does not work. Deluged is now running as root and Deluge-web still runs as user deluge

Hmm, you had changed from DELUGED_USER to DELUGE_USER

Changed to DELUGE_USER in /etc/conf.d/deluged but still is does not work
I get:
IOError: [Errno 13] Permission denied: '/run/deluge/deluged.pid'
when starting deluged
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 12:40 GMT
OK, I also had to change in /etc/rc.d/deluge-web for it to run as my user.

But I still cant start deluged. I get:

sudo /etc/rc.d/deluged start
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
:: Starting Deluge Daemon [DONE]
[niclas@nas ~]$ Traceback (most recent call last):
File "/usr/bin/deluged", line 9, in <module>
load_entry_point('deluge==1.3.4', 'console_scripts', 'deluged')()
File "/usr/lib/python2.7/site-packages/deluge/main.py", line 202, in start_daemon
write_pidfile()
File "/usr/lib/python2.7/site-packages/deluge/main.py", line 189, in write_pidfile
open(options.pidfile, "wb").write("%s\n" % os.getpid())
IOError: [Errno 13] Permission denied: '/run/deluge/deluged.pid'
Comment by Andrew (gman) - Sunday, 11 March 2012, 12:41 GMT
Try to remove /run/deluge/deluged.pid.
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 12:51 GMT
Yes I have DELUGE_USER in /etc/conf.d/deluged

deluge-web starts fine but deluged does not
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 12:53 GMT
If I start the daemon from the web-gui then it starts just fine
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 12:59 GMT
And after a reboot deluge-web refuses to start. And I'm going crazy.
Why does it have to be so damn hard??
Comment by Andrew (gman) - Sunday, 11 March 2012, 13:03 GMT
Wait, try
# /etc/rc.d/deluged restart
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 13:06 GMT
When I do # /etc/rc.d/deluged restart

Deluged restarts just fine but deluge-web refuses to start

sudo /etc/rc.d/deluge-web start
Password:
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
:: Starting Deluge WebUI [DONE]

Soo it looks like it starts but it doesnt
Comment by Andrew (gman) - Sunday, 11 March 2012, 13:17 GMT
Edit /etc/rc.d/deluge-web and replace "deluge" with $DELUGE_USER on two strings
patch
--- /etc/rc.d/deluge-web.orig 2012-03-11 09:02:32.000000000 +0400
+++ /etc/rc.d/deluge-web 2012-03-11 17:16:41.578350158 +0400
@@ -13,12 +13,12 @@
case "$1" in
start)
stat_busy "Starting Deluge WebUI"
- [[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluge-web $WEB_OPTIONS >/dev/null" deluge
+ [[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluge-web $WEB_OPTIONS >/dev/null" $DELUGE_USER
if [ $? -gt 0 ]; then
stat_fail
else
sleep 1
- echo $(pgrep -u deluge deluge-web) > $PIDFILE
+ echo $(pgrep -u $DELUGE_USER deluge-web) > $PIDFILE
add_daemon deluge-web
stat_done
fi
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 13:29 GMT
I did a pacman -R deluge and also removed al files for deluge I could find and then installed deluge again

After that I did all the changes to deluge, deluge-web and /etc/conf.d/deluged

Now I can start deluge but I still cant start deluge.web

I get this:
sudo /etc/rc.d/deluge-web start
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
:: Starting Deluge WebUI [BUSY] [ERROR ] 14:27:53 client:395 RPCError Message Received!
--------------------------------------------------------------------------------
RPCRequest: daemon.login(localclient, 97269d9ed01694a9502105186cc027cf89ce8414)
--------------------------------------------------------------------------------
File "/usr/lib/python2.7/site-packages/deluge/core/rpcserver.py", line 259, in dispatch
ret = component.get("AuthManager").authorize(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/deluge/core/authmanager.py", line 93, in authorize
raise BadLoginError("Password does not match")

BadLoginError: Password does not match
--------------------------------------------------------------------------------
[DONE]
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 13:38 GMT
OK, after a restart deluge-web starts just fine
But deluged wont start from cli. But it starts just fine from the web-gui

And once I got deluged running I cant stop it with "sudo /etc/rc.d/deluged stop"

This is what happens:
udo /etc/rc.d/deluged stop
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
:: Stopping Deluge Daemon [FAIL]
Comment by Andrew (gman) - Sunday, 11 March 2012, 13:42 GMT
Paste your /etc/rc.d/deluged
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 13:44 GMT

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/deluged

PIDFILE=/run/deluge/deluged.pid
OPTIONS="-P $PIDFILE $OPTIONS"

[[ -f $PIDFILE ]] && PID=$(<$PIDFILE)
kill -0 $PID || PID=

case "$1" in
start)
stat_busy "Starting Deluge Daemon"
[[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluged $OPTIONS >/dev/null" $DELUGE_USER
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon deluged
stat_done
fi
;;
stop)
stat_busy "Stopping Deluge Daemon"
[[ ! -z $PID ]] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon deluged
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0
Comment by Andrew (gman) - Sunday, 11 March 2012, 13:51 GMT
I don't have solve for this. I always start/stop deluged via /etc/rc.d/deluged.
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 13:55 GMT
If I start deluged as normal user then it starts. But how do I start deluged as a normal user at boot? I cant use /etc/rc.conf
Comment by Andrew (gman) - Sunday, 11 March 2012, 13:59 GMT Comment by Niclas (niclasc) - Sunday, 11 March 2012, 15:00 GMT
How do I do to start as my user (not root) when using /etc/rc.conf
Comment by Niclas (niclasc) - Sunday, 11 March 2012, 15:20 GMT
OK, this it driving med crazy. Now I cant start deluged as a normal user or with sudo. But it starts just fine from the web-gui.

Whats the big change that has been done from v1.3.3 to v1.3.4

I never had any of these problem with v1.3.3
Comment by Andrew (gman) - Sunday, 11 March 2012, 15:21 GMT
/etc/rc.d/deluged start with root and use sudo to start deluged with your user.
Comment by Andrew (gman) - Sunday, 11 March 2012, 15:22 GMT Comment by Niclas (niclasc) - Sunday, 11 March 2012, 15:25 GMT
I downgraded to v1.3.3 and looked at the /etc/rc.d/deluged script. And its a bit different from the one in v1.3.4
So I upgraded to 1.3.4 but used the same scripts(deluged and deluge-web) as in 1.3.3

And now it works :-):-):-):-):-):-):-):-)

This bit is not in the 1.3.4 deluged script:
echo $(pgrep -u $DELUGE_USER deluged) > /var/run/deluged.pid

Is is a bug that its missing?
Comment by Andrew (gman) - Sunday, 11 March 2012, 15:28 GMT
In new script -P option of /usr/bin/deluged used to write PID-file. It working for me.
Comment by Pablo M (pablom) - Thursday, 15 March 2012, 03:16 GMT
The script works if you do the following two things:

1) Replace in /etc/rc.d/deluged the line that says

[[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluged $OPTIONS >/dev/null" deluge

with this line:

[[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluged $OPTIONS >/dev/null" $DELUGE_USER


and set that parameter in /etc/conf.d/deluge just as in deluge's previous version.


2) chown -R DELUGEUSERNAME /var/run/deluge

DELUGEUSERNAME being the value in $DELUGE_USER

This should have been put as a notification maybe in the upgrade.
Comment by stephen (colbert) - Sunday, 25 March 2012, 08:57 GMT
Just want to thank Pablo above for the solution, I can confirm I followed his exact steps and my Deluge v1.3.4 is working! Thanks so much! :)
Comment by Mr.Magne (Mr.Magne) - Monday, 09 April 2012, 12:07 GMT
IMHO it's a bug in the packaging, but this bug has now been open for one month and yet we don't have any comment by the maintainer...
Comment by stephen (colbert) - Monday, 09 April 2012, 22:34 GMT
Would like to update that on reboot, the /var/run/deluge directory is always re-owned by deluge:deluge, so I have wound up putting the following in my /etc/rc.local:

chown -R myuser /var/run/deluge &
rc.d restart deluged

It works now on every reboot.
Comment by Andrew (gman) - Tuesday, 10 April 2012, 04:11 GMT
Owner and permission available in file /usr/lib/tmpfiles.d/deluge.conf
Comment by stephen (colbert) - Thursday, 12 April 2012, 20:09 GMT
Andrew, I changed that "deluge" user and group in that file to my own, and on restart Deluge is back to the same dysfunctional behaviour, and now I have no /var/run/deluge :(
Comment by Andrew (gman) - Thursday, 12 April 2012, 20:18 GMT
1. Permission set after reboot system.

2. ls -ld /var/run
lrwxrwxrwx 1 root root /var/run -> /run
Comment by stephen (colbert) - Thursday, 12 April 2012, 20:20 GMT
> ls -ld /var/run
lrwxrwxrwx 1 root root 4 Dec 19 21:44 /var/run -> /run


That's what I have
Comment by Andrew (gman) - Thursday, 12 April 2012, 20:22 GMT
ls -ld /var/run/deluge/ ?
Comment by stephen (colbert) - Thursday, 12 April 2012, 20:23 GMT
> ls -ld /var/run/deluge
ls: cannot access /var/run/deluge: No such file or directory
Comment by Andrew (gman) - Thursday, 12 April 2012, 20:27 GMT
Why??? You deleted this directory?
Comment by stephen (colbert) - Friday, 13 April 2012, 01:26 GMT
I set the /usr/lib/tmpfiles.d/deluge.conf back to "deluge" for user and group, and it works fine again.
Comment by Andrew (gman) - Friday, 13 April 2012, 02:01 GMT
I don't understand why this causes problems
my /usr/lib/tmpfiles.d/deluge.conf

d /run/deluge 0755 owner group -
Comment by Yochai Gal (yochaigal) - Monday, 16 April 2012, 16:37 GMT
To fix this issue:

chown -R (myusername) /var/run/deluge

change /etc/rc.d/deluged & /etc/rc.d/deluge-web to use DELUGE_USER option found in /etc/conf.d/deluge instead of user deluge:

[[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluged $OPTIONS >/dev/null" $DELUGE_USER

[[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluge-web $WEB_OPTIONS >/dev/null" $DELUGE_USER

Add this to /etc/rc.local:

chown -R (myusername) /var/run/deluge &
rc.d restart deluged


Comment by stephen (colbert) - Monday, 16 April 2012, 22:24 GMT
Thanks Yochai Gal! Followed that and this time, on several reboots, Deluge is indeed running properly :)
Comment by Yochai Gal (yochaigal) - Monday, 16 April 2012, 22:27 GMT
I had some issues using magnet links after this; couldn't fix.
Ended up switching to Transmission till deluge gets stable again (user since pre 1.0!).
Comment by Niclas (niclasc) - Tuesday, 17 April 2012, 16:45 GMT
Now I upgraded to 1.3.5 and it stopped working.

Why????

This is crazy with all the problems every time there is an upgrade. Dont you guys test it at all??
Comment by Niclas (niclasc) - Tuesday, 17 April 2012, 16:48 GMT
Now i downgraded the deluged and deluge-web scripts to those from v1.3.3 and then it works :-)

Why hasn't this been fixed?
Comment by Niclas (niclasc) - Tuesday, 17 April 2012, 16:56 GMT
And another thing:
My deluge is ignoring speedlimit that I have set. If I set a speedlimit it always downloads at full speed :-(

It stopped working a couple of days ago. Didnt happen with a deluge upgrade, but some other package broke this function.

Anyone else having this problem?
Comment by Andrew (gman) - Tuesday, 17 April 2012, 18:37 GMT
I think your question is related to the bug https://bugs.archlinux.org/task/29414
Comment by Pablo M (pablom) - Tuesday, 01 May 2012, 22:48 GMT
Andrew, please follow the bugs guidelines. https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines#Summary

E.g.: Edit the bug's summary!
Comment by Andrew (gman) - Wednesday, 02 May 2012, 04:02 GMT
I can not edit the bug report.

Loading...