Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 541856 - =dev-db/redis-2.8.17-r1: broken init script
Summary: =dev-db/redis-2.8.17-r1: broken init script
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Johan Bergström
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-02 01:03 UTC by Marc Schiffbauer
Modified: 2015-03-12 12:09 UTC (History)
1 user (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 Marc Schiffbauer gentoo-dev 2015-03-02 01:03:59 UTC
The init script still has "--make-pidfile" in start-stop-daemon options which needs to be removed so that it all works properly

--- /etc/init.d/redis.orig      2015-03-02 02:02:08.932216945 +0100
+++ /etc/init.d/redis   2015-03-02 02:02:15.856144670 +0100
@@ -10,7 +10,7 @@

 command=/usr/sbin/redis-server
 pidfile=${REDIS_PID:-/run/redis/redis.pid}
-start_stop_daemon_args="--background --make-pidfile --pidfile ${pidfile}
+start_stop_daemon_args="--background --pidfile ${pidfile}
        --chdir \"${REDIS_DIR}\" --user ${REDIS_USER} --group ${REDIS_GROUP}"
 command_args="${REDIS_OPTS}"

If you want, I fill fix it in tree
Comment 1 Johan Bergström 2015-03-02 02:15:30 UTC
Just verified that redis does indeed create it. Looks good, feel free to commit ( to 2.8.19, right?). Thanks!
Comment 2 Marc Schiffbauer gentoo-dev 2015-03-07 03:22:36 UTC
Done. Please keep in mind that this also affects current stable ebuild. so what should we do about it? IMO it can be fixed, too. What do you think?
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2015-03-09 01:38:44 UTC
Mh, for me the runscript doesn't work (yes, I have the current version: # $Header: /var/cvsroot/gentoo-x86/dev-db/redis/files/redis.initd-4,v 1.3 2015/03/07 03:21:25 mschiff Exp $):

# pgrep redis
(nothing)

# /etc/init.d/redis status
 * status: stopped
# /etc/init.d/redis start
 * Caching service dependencies ... [ ok ]
 * Starting redis ...               [ ok ]
# /etc/init.d/redis status
 * status: crashed
# pgrep redis
9939
# ls -l /run/redis/
total 0
srwxrwx--- 1 redis redis 0 Mar  9 02:24 redis.sock
# grep -A 3 "pid file" /etc/conf.d/redis
# Redis pid file.
# (Be sure to change the main redis configuration file as well if you change
# this from the default.)
REDIS_PID="/run/redis/redis.pid"

# grep -B 1 -A 1 "pid file" /etc/redis.conf
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize no

# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
pidfile /run/redis/redis.pid



For me, you did exactly the wrong thing:

With the latest updated,

  daemonize no

seems to be the new default. But in this mode, redis won't write any pid file.
So we *need* "--make-pidfile" option for start-stop-daemon. I am suggesting


# diff -u /etc/init.d/redis.old /etc/init.d/redis
--- /etc/init.d/redis.old       2015-03-09 02:27:55.916271930 +0100
+++ /etc/init.d/redis   2015-03-09 02:36:30.083512506 +0100
@@ -6,11 +6,11 @@
 REDIS_OPTS=${REDIS_OPTS:-"${REDIS_CONF}"}
 REDIS_USER=${REDIS_USER:-redis}
 REDIS_GROUP=${REDIS_GROUP:-redis}
-REDIS_TIMEOUT=${REDIS_TIMEOUT:-30}

 command=/usr/sbin/redis-server
 pidfile=${REDIS_PID:-/run/redis/redis.pid}
-start_stop_daemon_args="--background --pidfile ${pidfile}
+retry=${REDIS_TIMEOUT:-"TERM/30/KILL/5"}
+start_stop_daemon_args="--make-pidfile --background --pidfile ${pidfile}
        --chdir \"${REDIS_DIR}\" --user ${REDIS_USER} --group ${REDIS_GROUP}"
 command_args="${REDIS_OPTS}"

@@ -22,12 +22,3 @@
 start_pre() {
        checkpath -d -m 0775 -o ${REDIS_USER}:${REDIS_GROUP} $(dirname ${REDIS_PID})
 }
-
-stop() {
-       ebegin "Stopping ${SVCNAME}"
-       start-stop-daemon --stop \
-               --exec ${command} \
-               --retry ${REDIS_TIMEOUT} \
-               --pidfile ${pidfile}
-       eend
-}
Comment 4 Marc Schiffbauer gentoo-dev 2015-03-10 00:38:18 UTC
If upstream defaults to "daemonize no" then I'd suggest reverting my change.
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2015-03-10 00:57:39 UTC
Just to clarify:

  daemonize no

is upstream's default.

Gentoo was patching the default config (last version with "daemonize yes": dev-db/redis-2.8.13).

To fix bug 529050, Gentoo added a new config patch which keeps upsteam's "daemonize no" (because systemd likes that).


Now the question is, why you (Marc) suggest to "fix" (=undo) the runscript. Mistake? I.e. didn't you run "etc-update" so you didn't noticed "daemonize" changed?

If there's no valid reason, please revert your changes.
Comment 6 Johan Bergström 2015-03-10 01:04:28 UTC
The reason I've stayed off of this is because I have no systemd installed. It's just hard to verify those environments working (and therefore deciding what the "sane" default should be). All I know is that previous to systemd, it was working as intended.

Sorry for not being a lot of help here :-/
Comment 7 Thomas Stein 2015-03-12 11:50:15 UTC
Hi.

I think the initscript is still broken. Just installed 2.8.19-r1. There is no pidfile created. In redis.conf the setting is: "deamonize no". That's fine but you have to create the pidfile with the initscript then i guess. But the option --make-pidfile is missing. 

cheers
t.
Comment 8 Marc Schiffbauer gentoo-dev 2015-03-12 12:09:21 UTC
Thanks to all for reporting back. I reverted the change. Should be OK now. Closing.