shadow1ng/fscan · error
systemdservice_create_none
Error message
systemdservice_create_none
What it means
Guard in createSystemdServices: none of the candidate systemd unit files could be written to the system directory (every os.WriteFile failed, e.g. missing privileges or read-only filesystem). Since no service was planted, the function reports total failure instead of returning an empty list.
Source
Thrown at plugins/local/systemdservice.go:276
Type=oneshot
User=root
ExecStart=%s
StandardOutput=null
StandardError=null
`, execPath),
},
}
var created []string
for _, service := range services {
servicePath := filepath.Join(systemDir, service.name)
if err := os.WriteFile(servicePath, []byte(service.content), 0644); err == nil {
created = append(created, service.name)
}
}
if len(created) == 0 {
return nil, fmt.Errorf("%s", i18n.GetText("systemdservice_create_none"))
}
return created, nil
}
// enableAndStartServices 启用并启动服务
func (p *SystemdServicePlugin) enableAndStartServices(serviceFiles []string) error {
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))
}
View on GitHub (pinned to 95cc12e753)
Solutions
- Run with write permission on the unit directory (root or writable ~/.config/systemd/user)
- Check disk space and mount status (df -h, mount | grep ro)
- Log per-file WriteFile errors during the loop so the actual cause is visible instead of a generic none-created error
Example fix
// before
if err := os.WriteFile(servicePath, []byte(service.content), 0644); err == nil {
created = append(created, service.name)
}
// after
if err := os.WriteFile(servicePath, []byte(service.content), 0644); err != nil {
return nil, fmt.Errorf("write %s: %w", servicePath, err)
}
created = append(created, service.name) Defensive patterns
Strategy: validation
Validate before calling
testPath := filepath.Join(unitDir, "writetest")
if err := os.WriteFile(testPath, []byte("x"), 0644); err != nil {
return fmt.Errorf("unit dir not writable: %w", err)
}
_ = os.Remove(testPath) Prevention
- Verify write access to the unit directory before writing units
- Log individual WriteFile errors instead of collapsing to a generic error
- Ensure adequate disk space and rw mounts
When it happens
Trigger: All unit file writes failed — service directory exists but is not writable, wrong path, or disk full.
Common situations: Non-root user writing to /etc/systemd/system; typo'd unit directory from a previous failed step; read-only root filesystem in containers.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- service_dir_create_failed
- unsupported_platform
- service_operation_error: %s
- failed to create TXT file: %w
- Unable to create persistence directory
AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06).
Data as JSON: /api/errors/cd697c24e8ee78af.
Report an issue: GitHub.