frappe / frappe/pilot

Bench initialization fails when redis-server is missing and passwordless sudo is unavailable

Open
#408 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
101
Forks
61
Avg merge
2d 12h
Merged PRs (30d)
41

Description

# Bench initialization fails when redis-server is missing and passwordless sudo is unavailable

## Summary

`pilot` bench initialization fails at **Install system packages** when `redis-server` is not installed and the current user does not have passwordless sudo.

Instead of being able to proceed through the setup flow, initialization aborts with:

```text
Error: Required: redis-server. No passwordless sudo available; install manually with your system package manager, then re-run this command.
```

## Reproduction

Run bench initialization on a host where:

* `redis-server` is not already installed
* the Pilot/Frappe user does not have passwordless sudo

Observed output:

```text
STEP init,1787491093.383 Initialize bench
[1/12] Validate bench.toml...
[2/12] Ensure admin password...
[3/12] Ensure database credentials...
[4/12] Install system packages...

Error: Required: redis-server. No passwordless sudo available; install manually with your system package manager, then re-run this command.
STEP-FAILED init,1787491093.428
```

Relevant traceback:

```text
File "/home/av/pilot/pilot/core/bench/initializer.py", line 157, in _install_system_packages
RedisManager(self.bench.config.redis, self.bench).install()

File "/home/av/pilot/pilot/managers/redis.py", line 52, in install
package_manager.install(package)

File "/home/av/pilot/pilot/managers/packages.py", line 33, in install
raise BenchError(...)

pilot.exceptions.BenchError: Required: redis-server. No passwordless sudo available; install manually with your system package manager, then re-run this command.
```

## Expected behavior

Pilot should handle this case more gracefully. Possible approaches:

1. Detect missing privilege requirements during a preflight check and provide the exact installation command for the detected operating system.
2. Support interactive sudo where appropriate instead of requiring passwordless sudo.
3. Allow system package installation to be explicitly skipped when dependencies are provisioned separately by an administrator.
4. Clearly document required system packages and the expected sudo/privilege model before initialization starts.

## Why this matters

Requiring passwordless sudo may be inappropriate on production or security-conscious hosts.

A deployment account may legitimately:

* have sudo access that requires authentication,
* have only restricted sudo permissions, or
* rely on an administrator to install OS-level dependencies.

The current behavior causes the entire initialization workflow to terminate even though the missing dependency can otherwise be installed normally.

## Environment

Pilot path in this occurrence:

```text
/home/av/pilot/
```

Failure occurs during:

```text
BenchInitializer._install_system_packages()
→ RedisManager.install()
→ package_manager.install()
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with pilot/core/bench/initializer.py at _install_system_packages(), then trace RedisManager.install() in pilot/managers/redis.py and package_manager.install() in pilot/managers/packages.py. Reproduce initialization without redis-server and without passwordless sudo. Done means the setup flow handles this privilege case according to a clearly defined behavior instead of aborting unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, redis
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.