From 4c655a2e7bd396e21ae1a20012eea1e07da4f0cb Mon Sep 17 00:00:00 2001 From: zbigniew sobiecki Date: Fri, 2 Jan 2026 15:32:32 +0100 Subject: [PATCH] fix: redis startup fails due to nologin shell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The redis user has /usr/sbin/nologin as its default shell, which prevents `su redis -c` from working. This was causing Redis to fail to start in production with "This account is currently not available." Fix by using `su -s /bin/sh` to explicitly specify a shell for the redis user when starting the service. Also updated agent environment documentation to reflect the correct startup command. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/agents/prompts/templates/partials/environment.eta | 2 +- src/agents/utils/setup.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/agents/prompts/templates/partials/environment.eta b/src/agents/prompts/templates/partials/environment.eta index 4533bcc5..632526c2 100644 --- a/src/agents/prompts/templates/partials/environment.eta +++ b/src/agents/prompts/templates/partials/environment.eta @@ -17,7 +17,7 @@ - `redis-cli KEYS "*"` - List all keys (use sparingly) - `redis-cli FLUSHALL` - Clear all data (use with caution) - `redis-cli INFO` - Get server statistics - - **Start**: `su redis -c 'redis-server /etc/redis/redis.conf --daemonize yes'` + - **Start**: `su -s /bin/sh redis -c 'redis-server /etc/redis/redis.conf --daemonize yes'` - **Stop**: `redis-cli SHUTDOWN` - **Monitor**: `redis-cli MONITOR` - Watch all commands in real-time - **Data persistence**: AOF enabled (data survives restarts) diff --git a/src/agents/utils/setup.ts b/src/agents/utils/setup.ts index 1331c7eb..85f1b412 100644 --- a/src/agents/utils/setup.ts +++ b/src/agents/utils/setup.ts @@ -137,10 +137,10 @@ export async function startRedis(): Promise { try { // Start Redis in background using redis-server - // We use su to run as redis user, and redirect stderr to capture startup errors + // We use su -s /bin/sh to run as redis user (redis user has /usr/sbin/nologin shell by default) const startResult = await execCommand( 'su', - ['redis', '-c', `redis-server ${REDIS_CONF} --daemonize yes 2>&1`], + ['-s', '/bin/sh', 'redis', '-c', `redis-server ${REDIS_CONF} --daemonize yes 2>&1`], '/', ); logger.debug('redis-server start output', {