sabnzbd user can't create anything into /var/lib. The ebuild didn't create /var/lib/sabnzbd too. This is a problem because sabnzbd can't download anything. It only logs errors (folder can't be created by sabnzbd). This patch works: diff -u /usr/{,local}portage/net-nntp/sabnzbd/sabnzbd-0.7.11.ebuild --- /usr/portage/net-nntp/sabnzbd/sabnzbd-0.7.11.ebuild 2013-02-18 18:01:25.000000000 +0100 +++ /usr/local/portage/net-nntp/sabnzbd/sabnzbd-0.7.11.ebuild 2013-03-02 15:38:27.748000000 +0100 @@ -93,6 +93,7 @@ diropts -o ${PN} -g ${PN} dodir /etc/${PN} dodir /var/log/${PN} + dodir "${HOMEDIR}" insinto "/etc/${PN}" insopts -m 0600 -o ${PN} -g ${PN} Daemon can't stop SABnzbd: Due to CRLF caracter in $api_key (SABnzbd writes it with ASCII caracters) and bad use of $hostname. Patch: diff -u /usr/{,local}/portage/net-nntp/sabnzbd/files/sabnzbd.initd --- /usr//portage/net-nntp/sabnzbd/files/sabnzbd.initd 2013-02-22 03:01:24.000000000 +0100 +++ /usr/local/portage/net-nntp/sabnzbd/files/sabnzbd.initd 2013-03-02 16:32:19.124000000 +0100 @@ -35,7 +35,7 @@ } stop() { - local api_key=$(awk '/^api_key =/{print $3}' ${SABNZBD_CONFIGFILE}) + local api_key=$(awk '/^api_key =/{print substr($3, 0, 32)}' ${SABNZBD_CONFIGFILE}) local hostname=${SABNZBD_SERVER} ebegin "Stopping SABnzbd" @@ -44,7 +44,7 @@ hostname="localhost" fi /usr/bin/wget -q --delete-after \ - "http://${SABNZBD_SERVER}:${SABNZBD_PORT}/sabnzbd/api?mode=shutdown&apikey=${api_key}" + "http://${hostname}:${SABNZBD_PORT}/sabnzbd/api?mode=shutdown&apikey=${api_key}" eend $? } Reproducible: Always Steps to Reproduce: /var/lib/sabnzbd: 1. emerge --unmerge sabnzbd; rm -r /etc/sabnzbd /var/lib/sabnzbd /var/log/sabnzbd (if you have already installed sabnzbd) 2. emerge sabnzbd 3. /etc/init.d/sabnzbd start 4. open a browser http://localhost:8080/ 5. fill the forms (sabnzbd restart by himself at the end) 6. see the warnings (top left of the windows). Daemon can't stop: 1. emerge sabnzbd 2. open a browser http://localhost:8080/ 3. /etc/init.d/sabnzbd start 4. fill the forms, activate SSL access (for users, not the SSL parameter of newsgroup server) 5. netstat -tunpl | grep python (there is two listening server, 8080 and 9090) 6. /etc/init.d/sabnzbd stop 7. netstat -tunpl | grep python (server is still running) Actual Results: Can't really use SABnzbd (can't donwload nothing). Daemon can't be stopped safely Expected Results: Ebuild created /var/lib/sabnzbd Daemon should be stopped by /etc/init.d/sabnzbd stop
1. The home directory is created by enewuser, did you manually delete it? 2. You are correct that stop() has some bugs. - I fixed the use of ${hostname} in the wget line. - I updated stop() to wait for a bit to allow sabnzbd to fully exit and to resort to start-stop-daemon if this doesn't work. 3. I am, however, unable to reproduce your bug with the api_key. Are you sure that the CRLF character is getting in there? Bash should be squashing it. If those changes do not fix things, please reopen. 08 Mar 2013; Justin Bronder <jsbronder@gentoo.org> files/sabnzbd.initd: Fix init.d stop(), re #459992
1. You're right. I forgot enewuser. I activated the SSL connection. > I try the new initd with SABNZBD_PORT=8080: Start is fine. But stop failed: fixe ~ # /etc/init.d/sabnzbd stop sabnzbd | * Stopping SABnzbd ... sabnzbd | * start-stop-daemon: no matching processes found [ ok ] => SABnzbd is still here: fixe ~ # ps aux | grep sabnzbd sabnzbd 13204 1.1 1.5 1361536 31292 ? Sl 15:02 0:03 /usr/bin/python2.7 SABnzbd.py --config-file /etc/sabnzbd/sabnzbd.ini --daemon --pid /var/run/sabnzbd > With SABNZBD_PORT=9090: Start succeed but you can't use HTTPS. There is a warning: “SABnzbd can't use the same port for HTTP/HTTPS/” SABnzbd gets mixed up with SSL and PID file: fixe ~ # /etc/init.d/sabnzbd start sabnzbd | * Starting SABnzbd ... [ ok ] fixe ~ # netstat -tunpl | grep python tcp 0 0 0.0.0.0:9090 0.0.0.0:* LISTEN 14289/python2.7 tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 14289/python2.7 fixe ~ # ls /run/sabnzbd/ sabnzbd-9090.pid fixe ~ # cat /etc/conf.d/sabnzbd SABNZBD_SERVER=0.0.0.0 SABNZBD_PORT=8080 SABNZBD_CONFIGFILE=/etc/sabnzbd/sabnzbd.ini SABNZBD_USER=sabnzbd SABNZBD_GROUP=sabnzbd # 0 - error/warnings, 1 - info, 2 - debug SABNZBD_LOGGING=1 => SABNZBD_PORT=8080 but PID file is 9090. -------------------------------------------------- fixe ~ # /etc/init.d/sabnzbd start sabnzbd | * Caching service dependencies ... [ ok ] sabnzbd | * Starting SABnzbd ... [ ok ] fixe ~ # netstat -tunpl | grep python tcp 0 0 0.0.0.0:9090 0.0.0.0:* LISTEN 14625/python2.7 fixe ~ # ls /run/sabnzbd/ sabnzbd-9090.pid fixe ~ # cat /etc/conf.d/sabnzbd SABNZBD_SERVER=0.0.0.0 SABNZBD_PORT=9090 SABNZBD_CONFIGFILE=/etc/sabnzbd/sabnzbd.ini SABNZBD_USER=sabnzbd SABNZBD_GROUP=sabnzbd # 0 - error/warnings, 1 - info, 2 - debug SABNZBD_LOGGING=1 => No HTTPS Patch: fixe ~ # diff -ru /usr/portage/net-nntp/sabnzbd/ /usr/local/portage/net-nntp/sabnzbd/ diff -ru /usr/portage/net-nntp/sabnzbd/files/sabnzbd.confd /usr/local/portage/net-nntp/sabnzbd/files/sabnzbd.confd --- /usr/portage/net-nntp/sabnzbd/files/sabnzbd.confd 2013-01-03 21:02:32.000000000 +0100 +++ /usr/local/portage/net-nntp/sabnzbd/files/sabnzbd.confd 2013-03-09 15:47:15.404000000 +0100 @@ -4,5 +4,8 @@ SABNZBD_USER=sabnzbd SABNZBD_GROUP=sabnzbd +# Only set this if you use SSL access +SABNZBD_SSL_PORT= + # 0 - error/warnings, 1 - info, 2 - debug SABNZBD_LOGGING=1 diff -ru /usr/portage/net-nntp/sabnzbd/files/sabnzbd.initd /usr/local/portage/net-nntp/sabnzbd/files/sabnzbd.initd --- /usr/portage/net-nntp/sabnzbd/files/sabnzbd.initd 2013-03-08 04:01:24.000000000 +0100 +++ /usr/local/portage/net-nntp/sabnzbd/files/sabnzbd.initd 2013-03-09 15:49:58.508000000 +0100 @@ -5,7 +5,7 @@ # pid file name is hard-coded in sabnzbd, this must match RUNDIR=/var/run/sabnzbd -PIDFILE=${RUNDIR}/sabnzbd-${SABNZBD_PORT}.pid +PIDFILE=${RUNDIR}/sabnzbd-`[ -n ${SABNZBD_SSL_PORT} ] && echo ${SABNZBD_SSL_PORT} || echo ${SABNZBD_PORT}`.pid depend() { need net **************************************************************** API key, the problem is still here. sabnzbd.log says: 2013-03-09 16:01:07,328::WARNING::[interface:189] Cl<E9> API incorrecte, utilisez la cl<E9> API de la configuration g<E9>n<E9>rale dans votre application tierce : 127.0.0.1>Wget/1.14 (linux-gnu) (English: Incorrect API key…) I add “echo 'api_key='$api_key'END'”: fixe ~ # /etc/init.d/sabnzbd stop ENDnzbd |api_key=b5c[…]7a1 sabnzbd | * Stopping SABnzbd ... [ ok ] => There is a CR. SABnzbd still works. With the patch: - local api_key=$(awk '/^api_key =/{print $3}' ${SABNZBD_CONFIGFILE}) + local api_key=$(awk '/^api_key =/{print substr($3, 0, 32)}' fixe ~ # /etc/init.d/sabnzbd stop sabnzbd |api_key=b5c[…]7a1END sabnzbd | * Stopping SABnzbd ... [ ok ] => No CR. SABnzbd is stopped by wget.
Have you seen my last comment Justin?
(In reply to comment #2) > 1. You're right. I forgot enewuser. > > I activated the SSL connection. > > > I try the new initd with SABNZBD_PORT=8080: > Start is fine. > > But stop failed: > fixe ~ # /etc/init.d/sabnzbd stop > sabnzbd | * Stopping SABnzbd ... > sabnzbd | * start-stop-daemon: no matching processes found > [ ok ] > > => SABnzbd is still here: > fixe ~ # ps aux | grep sabnzbd > sabnzbd 13204 1.1 1.5 1361536 31292 ? Sl 15:02 0:03 > /usr/bin/python2.7 SABnzbd.py --config-file /etc/sabnzbd/sabnzbd.ini > --daemon --pid /var/run/sabnzbd This wasn't started from the initd script as there is no --server or --logging > > > With SABNZBD_PORT=9090: > Start succeed but you can't use HTTPS. > There is a warning: “SABnzbd can't use the same port for HTTP/HTTPS/” So, from the default install, I set SABNZBD_PORT to 9090 and start/stop works fine. Are you also configuring something from within the web interface? > > > SABnzbd gets mixed up with SSL and PID file: > fixe ~ # /etc/init.d/sabnzbd start > sabnzbd | * Starting SABnzbd ... > [ ok ] > fixe ~ # netstat -tunpl | grep python > tcp 0 0 0.0.0.0:9090 0.0.0.0:* LISTEN > 14289/python2.7 > tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN > 14289/python2.7 > fixe ~ # ls /run/sabnzbd/ > sabnzbd-9090.pid > fixe ~ # cat /etc/conf.d/sabnzbd > SABNZBD_SERVER=0.0.0.0 > SABNZBD_PORT=8080 > SABNZBD_CONFIGFILE=/etc/sabnzbd/sabnzbd.ini > SABNZBD_USER=sabnzbd > SABNZBD_GROUP=sabnzbd > > # 0 - error/warnings, 1 - info, 2 - debug > SABNZBD_LOGGING=1 > > => SABNZBD_PORT=8080 but PID file is 9090. Same here, unable to reproduce. Again, some setting from within the web interface? > > -------------------------------------------------- > fixe ~ # /etc/init.d/sabnzbd start > sabnzbd | * Caching service dependencies ... > [ ok ] > sabnzbd | * Starting SABnzbd ... > [ ok ] > fixe ~ # netstat -tunpl | grep python > tcp 0 0 0.0.0.0:9090 0.0.0.0:* LISTEN > 14625/python2.7 > fixe ~ # ls /run/sabnzbd/ > sabnzbd-9090.pid > fixe ~ # cat /etc/conf.d/sabnzbd > SABNZBD_SERVER=0.0.0.0 > SABNZBD_PORT=9090 > SABNZBD_CONFIGFILE=/etc/sabnzbd/sabnzbd.ini > SABNZBD_USER=sabnzbd > SABNZBD_GROUP=sabnzbd > > # 0 - error/warnings, 1 - info, 2 - debug > SABNZBD_LOGGING=1 > > => No HTTPS > > Patch: > fixe ~ # diff -ru /usr/portage/net-nntp/sabnzbd/ > /usr/local/portage/net-nntp/sabnzbd/ > diff -ru /usr/portage/net-nntp/sabnzbd/files/sabnzbd.confd > /usr/local/portage/net-nntp/sabnzbd/files/sabnzbd.confd > --- /usr/portage/net-nntp/sabnzbd/files/sabnzbd.confd 2013-01-03 > 21:02:32.000000000 +0100 > +++ /usr/local/portage/net-nntp/sabnzbd/files/sabnzbd.confd 2013-03-09 > 15:47:15.404000000 +0100 > @@ -4,5 +4,8 @@ > SABNZBD_USER=sabnzbd > SABNZBD_GROUP=sabnzbd > > +# Only set this if you use SSL access > +SABNZBD_SSL_PORT= > + > # 0 - error/warnings, 1 - info, 2 - debug > SABNZBD_LOGGING=1 > diff -ru /usr/portage/net-nntp/sabnzbd/files/sabnzbd.initd > /usr/local/portage/net-nntp/sabnzbd/files/sabnzbd.initd > --- /usr/portage/net-nntp/sabnzbd/files/sabnzbd.initd 2013-03-08 > 04:01:24.000000000 +0100 > +++ /usr/local/portage/net-nntp/sabnzbd/files/sabnzbd.initd 2013-03-09 > 15:49:58.508000000 +0100 > @@ -5,7 +5,7 @@ > > # pid file name is hard-coded in sabnzbd, this must match > RUNDIR=/var/run/sabnzbd > -PIDFILE=${RUNDIR}/sabnzbd-${SABNZBD_PORT}.pid > +PIDFILE=${RUNDIR}/sabnzbd-`[ -n ${SABNZBD_SSL_PORT} ] && echo > ${SABNZBD_SSL_PORT} || echo ${SABNZBD_PORT}`.pid > > depend() { > need net > > > > **************************************************************** > API key, the problem is still here. > sabnzbd.log says: > 2013-03-09 16:01:07,328::WARNING::[interface:189] Cl<E9> API incorrecte, > utilisez la cl<E9> API de la configuration g<E9>n<E9>rale dans votre > application tierce : 127.0.0.1>Wget/1.14 (linux-gnu) > (English: Incorrect API key…) > > > I add “echo 'api_key='$api_key'END'”: > fixe ~ # /etc/init.d/sabnzbd stop > ENDnzbd |api_key=b5c[…]7a1 > sabnzbd | * Stopping SABnzbd ... > [ ok ] > > => There is a CR. SABnzbd still works. > > With the patch: > - local api_key=$(awk '/^api_key =/{print $3}' ${SABNZBD_CONFIGFILE}) > + local api_key=$(awk '/^api_key =/{print substr($3, 0, 32)}' This is fragile if the length of the key ever increases. Can you try recreating your config file? I'm still unable to reproduce this from the default install. > > fixe ~ # /etc/init.d/sabnzbd stop > sabnzbd |api_key=b5c[…]7a1END > sabnzbd | * Stopping SABnzbd ... > [ ok ] > => No CR. SABnzbd is stopped by wget.
(In reply to comment #4) > (In reply to comment #2) > > 1. You're right. I forgot enewuser. > > > > I activated the SSL connection. > > > > > I try the new initd with SABNZBD_PORT=8080: > > Start is fine. > > > > But stop failed: > > fixe ~ # /etc/init.d/sabnzbd stop > > sabnzbd | * Stopping SABnzbd ... > > sabnzbd | * start-stop-daemon: no matching processes found > > [ ok ] > > > > => SABnzbd is still here: > > fixe ~ # ps aux | grep sabnzbd > > sabnzbd 13204 1.1 1.5 1361536 31292 ? Sl 15:02 0:03 > > /usr/bin/python2.7 SABnzbd.py --config-file /etc/sabnzbd/sabnzbd.ini > > --daemon --pid /var/run/sabnzbd > > This wasn't started from the initd script as there is no --server or > --logging I have just start my computer and haven't touched SABnzbd: fixe ~ # ps aux | grep sabnz sabnzbd 1556 0.2 1.0 1361524 20756 ? Sl 22:23 0:03 /usr/bin/python2.7 SABnzbd.py --server 0.0.0.0:8080 --config-file /etc/sabnzbd/sabnzbd.ini --logging 1 --daemon --pid /var/run/sabnzbd root 3046 0.0 0.0 8824 996 pts/0 S+ 22:42 0:00 grep --colour=auto sabnz fixe ~ # diff /etc/init.d/sabnzbd /usr/portage/net-nntp/sabnzbd/files/sabnzbd.initd 8c8 < PIDFILE=${RUNDIR}/sabnzbd-`[ -n ${SABNZBD_SSL_PORT} ] && echo ${SABNZBD_SSL_PORT} || echo ${SABNZBD_PORT}`.pid --- > PIDFILE=${RUNDIR}/sabnzbd-${SABNZBD_PORT}.pid 38c38 < local api_key=$(awk '/^api_key =/{print substr($3, 0, 32)}' ${SABNZBD_CONFIGFILE}) --- > local api_key=$(awk '/^api_key =/{print $3}' ${SABNZBD_CONFIGFILE}) (Portage is up to date). I have tried a restart from the web interface: sabnzbd 3624 12.4 1.5 1361524 31096 ? Sl 22:55 0:01 /usr/bin/python2.7 SABnzbd.py --config-file /etc/sabnzbd/sabnzbd.ini --daemon --pid /var/run/sabnzbd => So the problem seems to happen when you restart from the web interface first. For exemple, at the first wizard. > > > > > With SABNZBD_PORT=9090: > > Start succeed but you can't use HTTPS. > > There is a warning: “SABnzbd can't use the same port for HTTP/HTTPS/” > > So, from the default install, I set SABNZBD_PORT to 9090 and start/stop > works fine. Are you also configuring something from within the web > interface? Nothing. I used /usr/portage/net-nntp/sabnzbd/files/sabnzbd.ini and wizard. I have never edited the sabnzb.ini by hand. I just try another test: fixe ~ # ps aux | grep sabnz <= SABnzbd stopped root 3834 0.0 0.0 8820 924 pts/0 S+ 23:01 0:00 grep --colour=auto sabnz fixe ~ # nano -w /etc/conf.d/sabnzbd <= Remove “SSL_PORT” and set “_PORT” to 9090 fixe ~ # /etc/init.d/sabnzbd start sabnzbd | * Caching service dependencies ... [ ok ] sabnzbd | * Starting SABnzbd ... => SABnzbd is happy but: https://localhost:9090 <= Fail http://localhost:9090/ <= work http://localhost:8080 <= fail fixe ~ # grep port /etc/sabnzbd/sabnzbd.ini port = 9090 https_port = 9090 port = 443 => SABnzbd changes my settings. fixe ~ # nano -w /etc/conf.d/sabnzbd <= set “_PORT” to 8080 fixe ~ # ps aux | grep sabnz sabnzbd 4117 0.3 1.0 1271364 21252 ? Sl 23:05 0:00 /usr/bin/python2.7 SABnzbd.py --server 0.0.0.0:9090 --config-file /etc/sabnzbd/sabnzbd.ini --logging 1 --daemon --pid /var/run/sabnzbd root 4238 0.0 0.0 8820 924 pts/0 S+ 23:09 0:00 grep --colour=auto sabnz fixe ~ # kill 4117 fixe ~ # ps aux | grep sabnz root 4254 0.0 0.0 8820 924 pts/0 S+ 23:10 0:00 grep --colour=auto sabnz fixe ~ # /etc/init.d/sabnzbd zap sabnzbd | * Manually resetting sabnzbd to stopped state fixe ~ # /etc/init.d/sabnzbd start sabnzbd | * Caching service dependencies ... [ ok ] sabnzbd | * Starting SABnzbd ... [ ok ] => SABnzb is happy fixe ~ # grep port /etc/sabnzbd/sabnzbd.ini port = 8080 https_port = 9090 port = 443 => SABnzbd changes my settings. SABnzbd works without SSL (off course). > So, from the default install, I set SABNZBD_PORT to 9090 and start/stop > works fine. => Ok, but did you activate SSL connection? HTTP works on 9090 for me too… Except that it should be HTTPS. > > > > SABnzbd gets mixed up with SSL and PID file: > > fixe ~ # /etc/init.d/sabnzbd start > > sabnzbd | * Starting SABnzbd ... > > [ ok ] > > fixe ~ # netstat -tunpl | grep python > > tcp 0 0 0.0.0.0:9090 0.0.0.0:* LISTEN > > […] > > > > With the patch: > > - local api_key=$(awk '/^api_key =/{print $3}' ${SABNZBD_CONFIGFILE}) > > + local api_key=$(awk '/^api_key =/{print substr($3, 0, 32)}' > > This is fragile if the length of the key ever increases. Can you try > recreating your config file? I'm still unable to reproduce this from the > default install. I am agree with you. As I said, I have neved edited this file by hand. There is probably other people with the same problem. What is you charset? I use an UTF-8 one: fr_FR.UTF-8. Something like this is better: fixe ~ # test=`awk '/^api_key =/{print $3}' /etc/sabnzbd/sabnzbd.ini` fixe ~ # echo aa"$test"bb bbb5c[…]a1 => fixe ~ # test=`awk '/^api_key =/{print $3}' /etc/sabnzbd/sabnzbd.ini | tr --delete [:cntrl:]` fixe ~ # echo aa"$test"bb aab5[…]a1bb
Version bump 0.7.12: https://forums.sabnzbd.org/viewforum.php?f=8 Did you see comment 5?
Please do not group separate issues into the same bug.
Alright, I think I was finally able to reproduce some of your issues. Mainly related to /etc/conf.d/sabnzbd not being up to date with the actual config. I started parsing the actual config instead which should help. Let me know how 0.7.13-r2 works for you?
The new parsing seems to solve my issues. Thanks for your work!