You are not logged in.

#1 2024-02-05 15:27:40

gatekeeper6838
Member
Registered: 2024-02-05
Posts: 2

Redis unable to create socket in /run/redis

I have two ArchLinux systems, one has Redis working and the other won't start Redis. On the one where Redis fails to start, it complains about not having permissions to create the socket:

redis-server[4702]: 4702:M 05 Feb 2024 07:53:06.463 # Failed opening Unix socket: bind: Permission denied

Both systems appear to have the exact same unit file configuration - the stock one that comes with the package and defines a runtime directory of "redis", which should create /run/redis with the appropriate permissions (assuming I understand correctly):

[Unit]
Description=Advanced key-value store
After=network.target

[Service]
Type=notify
User=redis
Group=redis
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd
TimeoutStartSec=60
TimeoutStopSec=60
CapabilityBoundingSet=
PrivateTmp=true
PrivateDevices=true
ProtectSystem=full
ProtectHome=true
NoNewPrivileges=true
RuntimeDirectory=redis
RuntimeDirectoryMode=755
LimitNOFILE=10032

[Install]
WantedBy=multi-user.target

However, one system starts up redis successfully and is able to create the socket in /run/redis/ while the other fails to start due to the permissions issue. It's almost as if the executable is trying to create the socket before the redis directory gets created in /run/redis, or perhaps the directory does get created but has invalid permissions. If I configure redis to use a TCP port instead of a socket, it works and the directory is created in /run/redis. But as soon as I switch it back to socket, it fails. Any ideas as to what could be happening here? The failing system is a relatively new Arch install as of a few weeks ago.

Offline

#2 2024-02-06 15:26:54

gatekeeper6838
Member
Registered: 2024-02-05
Posts: 2

Re: Redis unable to create socket in /run/redis

I figured it out. Although the systemd unit file for Redis creates /run/redis/ with the appropriate permissions, /etc/redis/redis.conf has this line by default:

# unixsocket /run/redis.sock

I simply uncommented the line and forgot to add the redis directory. Setting it to the following worked:

unixsocket /run/redis/redis.sock

Offline

Board footer

Powered by FluxBB