Centos – Redis fails only at startup

centoscentos7openvasredis

Redis fails to start every time I start our CentOS 7/openvas server. After the server boots up I can manually start redis without any issues using systemctl start redis.service.

Below are the relevant parts from journalctl

Jan 29 06:29:28 openvas01 systemd[1]: Reached target Network is Online.
Jan 29 06:29:28 openvas01 systemd[1]: Starting Network is Online.
Jan 29 06:29:28 openvas01 systemd[1]: Started Azure Linux Agent.
Jan 29 06:29:28 openvas01 systemd[853]: Failed at step RUNTIME_DIRECTORY spawning /usr/bin/redis-server: File exists
Jan 29 06:29:28 openvas01 systemd[1]: Starting Azure Linux Agent...
Jan 29 06:29:28 openvas01 systemd[1]: Started DNS caching server..
Jan 29 06:29:28 openvas01 systemd[1]: Starting DNS caching server....
Jan 29 06:29:28 openvas01 systemd[1]: redis.service: main process exited, code=exited, status=233/RUNTIME_DIRECTORY
Jan 29 06:29:28 openvas01 systemd[860]: Failed at step RUNTIME_DIRECTORY spawning /usr/libexec/redis-shutdown: File exists
Jan 29 06:29:28 openvas01 systemd[1]: redis.service: control process exited, code=exited status=233
Jan 29 06:29:28 openvas01 systemd[1]: Failed to start Redis persistent key-value database.
Jan 29 06:29:28 openvas01 systemd[1]: Unit redis.service entered failed state.
Jan 29 06:29:28 openvas01 systemd[1]: redis.service failed.

I can't tell which file it is complaining about existing already. The /var/log/redis/redis.log doesn't mention anything about this startup issue so I am thinking that this is related to systemd.

I searched online and didn't find any obvious solutions. The service is not set to start as a daemon and I have supervised systemd in the redis config file.

Any ideas?

Best Answer

After some more troubleshooting, I figured out that the /var/run/redis directory was being created by some other process and not the redis systemd service. Further troubleshooting revealed that our server admin had unexpectedly created /etc/tmpfiles.d/redis.conf that was creating the /var/run/redis directory before the service. Deleting this file, which only had this directory in it, addressed the problem.