valkey: Failed opening Unix socket: bind: Permission denied
Package Information
- Package name: valkey
- Package version: 7.2.5-r1
- Alpine version: 3.20.0
- Alpine architecture: x86_64
Summary
I migrated an Alpine Edge, now 3.20, LXC container from Redis to Valkey, without using valkey-compat package, and got:
valkey: Failed opening Unix socket: bind: Permission denied
Enabling everyone to write to the directory with chmod a+w /run
and restarting the service allowed valkey to start. But that is not a secure solution.
When I set unixsocket /run/valkey/valkey.sock
in /etc/valkey/valkey.conf
valkey starts just fine out of the box.
On the first start with that setting I saw a message that the directory /run/valkey
is created and its permission corrected.
I guess that without that directory to be created valkey tries to create /run/valkey.sock
as valkey
user, which fails as /run
permissions only permits root to create and delete entries.
Steps to reproduce
Start valkey with default option unixsocket /run/valkey.sock
in /etc/valkey/valkey.conf
.