Page 1 of 1

Deluge is offline on boot

Posted: Thu Dec 04, 2014 1:07 am
by nishiyama
Hello support,

I am running Deluge on Raspbian and when I reboot deluge never starts up properly. From the web client the server shows up as offline.

If I ssh to the server an run the console I get a the bad password message:

Code: Select all

[ERROR   ] 20:05:35 client:375 RPCError Message Received!
--------------------------------------------------------------------------------
RPCRequest: daemon.login(localclient, fe8b666497e59f802fc26ecc5032734e5e884c76)
--------------------------------------------------------------------------------
  File "/usr/lib/python2.5/site-packages/deluge-1.2.0_rc5-py2.5.egg/deluge/core/rpcserver.py", line 245, in dispatch
    ret = component.get("AuthManager").authorize(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/deluge-1.2.0_rc5-py2.5.egg/deluge/core/authmanager.py", line 93, in authorize
    raise BadLoginError("Password does not match")
Only when I kill the process then restart it, it does show up as online

Code: Select all

sudo pkill deluged

deluged
Any idea what I need to change on my end to get it to start up on boot properly?

Re: Deluge is offline on boot

Posted: Thu Dec 04, 2014 11:29 am
by Cas
The console error is due to this: http://dev.deluge-torrent.org/wiki/User ... alUIClient

How exactly are you starting deluged on boot?

Re: Deluge is offline on boot

Posted: Thu Dec 04, 2014 5:11 pm
by nishiyama
EDIT: I log in remotely as pi

I did it following this guide:
http://www.howtogeek.com/142044/how-to- ... rrent-box/

Specifically, first it downloads a small script:

Code: Select all

sudo wget -O /etc/default/deluge-daemon http://cdn3.howtogeek.com/wp-content/uploads/gg/up/sshot5151a8c86fb85.txt
Where I changed the deluged user user:

Code: Select all

DELUGED_USER="pi" # !!!CHANGE THIS!!!!
to

Code: Select all

DELUGED_USER="nishiyama"
I then saved it out, set the permissions and added it to update defaults

Code: Select all

sudo chmod 755 /etc/default/deluge-daemon
sudo update-rc.d deluge-daemon defaults
I then added init.d to Raspbian with another downloaded script

Code: Select all

sudo wget -O /etc/init.d/deluge-daemon http://cdn3.howtogeek.com/wp-content/uploads/gg/up/sshot5151aa042ad11.txt

sudo chmod 755 /etc/init.d/deluge-daemon
sudo update-rc.d deluge-daemon defaults
The script that was downloaded contains the following:

Code: Select all

#!/bin/sh
### BEGIN INIT INFO
# Provides:          deluge-daemon
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Should-Start:      $network
# Should-Stop:       $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Daemonized version of deluge and webui.
# Description:       Starts the deluge daemon with the user specified in
#                    /etc/default/deluge-daemon.
### END INIT INFO

# Author: Adolfo R. Brandes 

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Deluge Daemon"
NAME1="deluged"
DAEMON1=/usr/bin/deluged
DAEMON1_ARGS="-d"             # Consult `man deluged` for more options
DAEMON2=/usr/bin/deluge-web
DAEMON2_ARGS=""               # Consult `man deluge-web` for more options
PIDFILE1=/var/run/$NAME1.pid
PIDFILE2=/var/run/$NAME2.pid
UMASK=022                     # Change this to 0 if running deluged as its own user
PKGNAME=deluge-daemon
SCRIPTNAME=/etc/init.d/$PKGNAME

# Exit if the package is not installed
[ -x "$DAEMON1" -a -x "$DAEMON2" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$PKGNAME ] && . /etc/default/$PKGNAME

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

if [ -z "$RUN_AT_STARTUP" -o "$RUN_AT_STARTUP" != "YES" ]
then
   log_warning_msg "Not starting $PKGNAME, edit /etc/default/$PKGNAME to start it."
   exit 0
fi

if [ -z "$DELUGED_USER" ]
then
    log_warning_msg "Not starting $PKGNAME, DELUGED_USER not set in /etc/default/$PKGNAME."
    exit 0
fi

#
# Function that starts the daemon/service
#
do_start()
{
   # Return
   #   0 if daemon has been started
   #   1 if daemon was already running
   #   2 if daemon could not be started
   start-stop-daemon --start --background --quiet --pidfile $PIDFILE1 --exec $DAEMON1 \
      --chuid $DELUGED_USER --user $DELUGED_USER --umask $UMASK --test > /dev/null
   RETVAL1="$?"
   start-stop-daemon --start --background --quiet --pidfile $PIDFILE2 --exec $DAEMON2 \
      --chuid $DELUGED_USER --user $DELUGED_USER --umask $UMASK --test > /dev/null
   RETVAL2="$?"
   [ "$RETVAL1" = "0" -a "$RETVAL2" = "0" ] || return 1

   start-stop-daemon --start --background --quiet --pidfile $PIDFILE1 --make-pidfile --exec $DAEMON1 \
      --chuid $DELUGED_USER --user $DELUGED_USER --umask $UMASK -- $DAEMON1_ARGS
   RETVAL1="$?"
        sleep 2
   start-stop-daemon --start --background --quiet --pidfile $PIDFILE2 --make-pidfile --exec $DAEMON2 \
      --chuid $DELUGED_USER --user $DELUGED_USER --umask $UMASK -- $DAEMON2_ARGS
   RETVAL2="$?"
   [ "$RETVAL1" = "0" -a "$RETVAL2" = "0" ] || return 2
}

#
# Function that stops the daemon/service
#
do_stop()
{
   # Return
   #   0 if daemon has been stopped
   #   1 if daemon was already stopped
   #   2 if daemon could not be stopped
   #   other if a failure occurred

   start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $DELUGED_USER --pidfile $PIDFILE2
   RETVAL2="$?"
   start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $DELUGED_USER --pidfile $PIDFILE1
   RETVAL1="$?"
   [ "$RETVAL1" = "2" -o "$RETVAL2" = "2" ] && return 2

   rm -f $PIDFILE1 $PIDFILE2

   [ "$RETVAL1" = "0" -a "$RETVAL2" = "0" ] && return 0 || return 1
}

case "$1" in
  start)
   [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME1"
   do_start
   case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
   esac
   ;;
  stop)
   [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME1"
   do_stop
   case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
   esac
   ;;
  restart|force-reload)
   log_daemon_msg "Restarting $DESC" "$NAME1"
   do_stop
   case "$?" in
     0|1)
      do_start
      case "$?" in
         0) log_end_msg 0 ;;
         1) log_end_msg 1 ;; # Old process is still running
         *) log_end_msg 1 ;; # Failed to start
      esac
      ;;
     *)
        # Failed to stop
      log_end_msg 1
      ;;
   esac
   ;;
  *)
   echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
   exit 3
   ;;
esac

:

Re: Deluge is offline on boot

Posted: Thu Dec 04, 2014 8:09 pm
by Cas
Starting deluged with just `deluged` is not the same as starting your init service so I would verify that service actually works. You need to check your init logs but if it's still an issue at just boot up it could be something like your mount point/network is not up before deluged starts. It's not really a Deluge issue, more Debian init related so can only offer limited help.

Also using random internet guides is not great, should always attempt to use official guides first: http://dev.deluge-torrent.org/wiki/User ... buntuInitd