Redis installed to completion but with noisy warnings I haven’t seen before.
warning: user redis does not exist - using root
warning: group redis does not exist - using root
warning: user redis does not exist - using root
warning: group redis does not exist - using root
warning: user redis does not exist - using root
warning: group redis does not exist - using root
warning: user redis does not exist - using root
warning: group redis does not exist - using root
I removed and reinstalled a couple times. Both the source and binary RPMs were tried but results were the same.
-
redis-5.0.3-1.module_el8.0.0+6+ab019c03.src.rpm
(from AppStream repo) -
redis-5.0.3-1.module_el8.0.0+6+ab019c03.x86_64.rpm
(direct from mirror.centos.org)
Although the package installed with root ownership, systemd’s configuration was set to the redis user and group in the file
/etc/systemd/system/multi-user.target.wants/redis.service
and Redis will start as long as redis was changed to root and the daemon service was restarted.
But Redis needs to run as a non-root user which is usually redis in group redis created during installation. Instead of tedious permission changes, I decided it would be easier to fix this without Redis installed.
Remove the installation:
dnf remove redis
Create the group:
groupadd -r redis
Create the user and add it to the group:
useradd -r -g redis redis
Verify:
grep "redis" /etc/group
redis:x:981:
If there’s an error when attempting to create the new group, e.g.,
Cannot lock /etc/passwd; try again later
– remove any /etc/*.lock files that prevent new user and group creation.
rm /etc/passwd.lock
rm /etc/shadow.lock
rm /etc/group.lock
rm /etc/gshadow.lock
Reinstall the source RPM package from the CentOS AppStream repo.
dnf install redis
Or the binary RPM directly from the mirror site.
dnf install http://mirror.centos.org/centos/8/AppStream/x86_64/os/Packages/redis-5.0.3-1.module_el8.0.0+6+ab019c03.x86_64.rpm
There should be no warnings this time but there may be other ownership obstacles that prevent Redis from starting. In my case the redis.log file held onto the root user and group from previous installations. It needs to be redis:redis.
chown redis:redis /var/log/redis/redis.log
With appendonly changed from no to yes in /etc/redis.conf, Redis fails to start again. Turns out this file has root ownership also.
chown redis:redis /var/lib/redis/appendonly.aof
If connecting by Unix socket check that file also, although I didn’t have any issues with it.
ls -al /var/run/redis/redis.sock
Redis should should be good to go.