so after installing redis onto my ubuntu 20.04 server. Whenever I reboot. A stop job appears for Advanced key-value store. I believe this is part of redis but I don't know why it keeps appearing and taking so long. How do I stop it
2 Answers
I had this issue too and the fix was pretty simple.
You need to edit the redis service file defined by the command systemctl show -P FragmentPath redis.service
:
$ systemctl show -P FragmentPath redis.service
/lib/systemd/system/redis-server.service
Look for the line that contains TimeoutStopSec
and set it to the maximum value in seconds you want. I normally set it to 5 seconds.
After configuring the file, the line should look something like this
TimeoutStopSec=5s
Now that's it, you may want to run the command systemctl daemon-reload
just to complement this.
You can then try rebooting or shutting down to confirm the change worked.
Bonus
If you want to set the maximum timeout for the entire system, you do so in the /etc/systemd/system.conf
file.
Look for the line DefaultTimeoutStopSec
and set it just as you did previously.

- 2,291
check your /etc/redis/redis.log file for the reason why it cant restart.
For me, i had the following error:
1963:signal-handler (1670871763) Received SIGTERM scheduling shutdown...
1963:M 12 Dec 2022 14:02:43.145 # User requested shutdown...
1963:M 12 Dec 2022 14:02:43.145 * Saving the final RDB snapshot before
exiting.
1963:M 12 Dec 2022 14:02:43.145 # Failed opening the temp RDB file temp-
1963.rdb (in server root dir /var/log) for saving: Read-only file system
1963:M 12 Dec 2022 14:02:43.145 # Error trying to save the DB, can't exit.
1963:M 12 Dec 2022 14:02:43.145 # Errors trying to shut down the server.
Check the logs for more information.
To fix it i just ran the following to fix the problem.
sudo chown redis /var/log/redis/redis.log && sudo chmod u+x /var/log/redis/redis.log
/lib/systemd/system/
- I'm pretty sure any.service
file inside/etc/systemd/system/
is a symlink that points to/lib/systemd/system/
. And another thing: It's generally best to modify unit files by using drop-in configs. This means you should create the directory/etc/systemd/system/redis.service.d
, and create a config file here (calledredis.conf
). And inside this file you would add the lineTimeoutStopSec=5s
. This means your custom config will survive if the unit file gets updated. – Artur Meinild Apr 21 '22 at 11:06redis.service
links toredis-server.service
in/lib/systemd/system/
. With/lib/
instead of/etc/
, folder should be/lib/systemd/system/redis-server.service.d/
– skipbo Aug 02 '22 at 19:39