shadow1ng/fscan · error
service_operation_error: %s
Error message
service_operation_error: %s
What it means
Aggregating guard in enableAndStartServices: at least one 'systemctl enable' or 'systemctl start' invocation failed for the created service files; the joined per-service error strings (service name plus underlying error) are returned as a single error listing every failed operation.
Source
Thrown at plugins/local/systemdservice.go:302
var errors []string
for _, serviceName := range serviceFiles {
// 重新加载systemd配置
_ = exec.Command("systemctl", "daemon-reload").Run()
// 启用服务
if err := exec.Command("systemctl", "enable", serviceName).Run(); err != nil {
errors = append(errors, fmt.Sprintf("enable %s: %v", serviceName, err))
}
// 启动服务
if err := exec.Command("systemctl", "start", serviceName).Run(); err != nil {
errors = append(errors, fmt.Sprintf("start %s: %v", serviceName, err))
}
}
if len(errors) > 0 {
return fmt.Errorf(i18n.GetText("service_operation_error")+": %s", strings.Join(errors, "; "))
}
return nil
}
// createUserServices 创建用户级服务
func (p *SystemdServicePlugin) createUserServices(execPath string) ([]string, error) {
userDir := filepath.Join(os.Getenv("HOME"), ".config", "systemd", "user")
if userDir == "/.config/systemd/user" { // HOME为空的情况
userDir = "/tmp/.config/systemd/user"
}
if err := os.MkdirAll(userDir, 0755); err != nil {
return nil, err
}
userServices := []string{
"user-service.service",View on GitHub (pinned to 95cc12e753)
Solutions
- Read the per-service messages after "service_operation_error: " — each is "start <name>: <reason>" — and fix the specific unit
- Verify systemd is the running init (ps -p 1) and systemctl exists; do not use this plugin in non-systemd containers
- Validate the unit file: systemd-analyze verify <unit>; confirm ExecStart target exists and is executable (chmod +x)
- Run journalctl -xe for the failing service for the underlying start failure
Example fix
// ensure executable bit and correct path before enabling chmod +x /usr/local/bin/myservice systemd-analyze verify /etc/systemd/system/myservice.service systemctl --no-pager status myservice
Defensive patterns
Strategy: try-catch
Validate before calling
if _, err := exec.LookPath("systemctl"); err != nil {
return errors.New("systemctl not available; systemd required")
}
if fi, err := os.Stat("/run/systemd/system"); err != nil || !fi.IsDir() {
return errors.New("systemd is not the running init")
} Try / catch
if err := enableAndStartServices(...); err != nil {
for _, part := range strings.Split(strings.TrimPrefix(err.Error(), "service_operation_error: "), "; ") {
log.Printf("service op failed: %s", part)
}
} Prevention
- Confirm the host runs systemd (PID 1) before using this plugin
- Validate unit files with systemd-analyze verify
- Ensure the service executable exists and is executable
- Check journalctl for per-service start failures
When it happens
Trigger: systemctl start (or the preceding enable/reload) returns non-zero: unit file invalid, systemctl absent, systemd not running (e.g. container), or service crashes at start.
Common situations: Running inside a Docker container without systemd; systemctl not installed; malformed unit file (bad ExecStart path); executable not present or not executable at the copied path.
Related errors
AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06).
Data as JSON: /api/errors/80aa01616367e44c.
Report an issue: GitHub.