Wind River Support Network

HomeDefectsLIN1021-4531
Fixed

LIN1021-4531 : [redis] service redis-server restart does not work

Created: Oct 16, 2022    Updated: Jun 27, 2023
Resolved Date: May 5, 2023
Found In Version: 10.21.20.14
Fix Version: 10.21.20.18
Severity: Standard
Applicable for: Wind River Linux LTS 21
Component/s: Userspace

Description

root@intel-x86-64:/opt/wr-test# service redis-server restart
Stopping redis-server...
Starting redis-server...
root@intel-x86-64:/opt/wr-test# ps -aux | grep redis-server
root 5493 0.0 0.0 3252 876 ttyS0 S+ 12:38 0:00 grep redis-server

Workaround

Add a delay between service stop and start in /etc/init.d/redis-server for restart case.

$ cat /etc/init.d/redis-server
#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          redis-server
# Required-Start:    $network
# Required-Stop:     $network
# Default-Start:     S 2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Redis, a key-value store
# Description:       Redis is an open source, advanced key-value store.
#                    http://redis.io
### END INIT INFO

test -f /usr/bin/redis-server || exit 0

ARGS="/etc/redis/redis.conf"

case "$1" in
    start)
        echo "Starting redis-server..."
        start-stop-daemon --start --quiet --exec /usr/bin/redis-server -- $ARGS
        ;;
    stop)
        echo "Stopping redis-server..."
        start-stop-daemon --stop --quiet --exec /usr/bin/redis-server
        ;;
    restart)
        echo "Stopping redis-server..."
        start-stop-daemon --stop --quiet --exec /usr/bin/redis-server
       * sleep 5*
        echo "Starting redis-server..."
        start-stop-daemon --start --quiet --exec /usr/bin/redis-server -- $ARGS
        ;;
    *)
        echo "Usage: /etc/init.d/redis-server {start|stop|restart}"
        exit 1
        ;;
esac

exit 0

Steps to Reproduce

1) setup.sh
--machine intel-x86-64 --dl-layers  --layers meta-filesystems meta-security-compliance meta-virtualization --dl-layers
2). ./environment-setup-x86_64-wrlinuxsdk-linux

3). ./oe-init-build-env 

4)  enable sysvinit
    sed -i '/DISTRO_FEATURES_append = " systemd"/s//#/g' conf/local.conf    sed -i '/VIRTUAL-RUNTIME_init_manager = "systemd"/s//#/g' conf/local.conf
    sed -i '/DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"/s/^/#/g' conf/local.conf
    sed -i '/KERNEL_FEATURES_append = " cfg\/systemd.scc"/s/^/#/g' conf/local.conf
    sed -i '/VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"/s/^/#/g' conf/local.conf
 
    sed -i '/#DISTRO_FEATURES_append = " sysvinit"/s/^#//' conf/local.conf
    sed -i '/#DISTRO_FEATURES_BACKFILL_CONSIDERED += "systemd"/s/^#//' conf/local.conf
    sed -i '/#VIRTUAL-RUNTIME_init_manager = "sysvinit"/s/#//' conf/local.conf    sed -i '/#VIRTUAL-RUNTIME_initscripts = "initscripts"/s/#//' conf/local.conf
 
5) echo 'IMAGE_INSTALL_append = " redis" >> conf/local.conf

6) bitbake wrlinux-image-small
7) boot the target, run command as problem description.
Live chat
Online