AdguardTeam/AdGuardHome · error

initializing service manager: %w

Error message

initializing service manager: %w

What it means

During a self-restart after a command-line update (cmdlineUpdate), AdGuard Home failed to construct the OS service manager (ossvc.NewManager) needed to perform the restart action.

Source

Thrown at internal/home/service.go:131

	s, err := service.New(p, svcConfig)
	if err != nil {
		return fmt.Errorf("initializing service: %w", err)
	}

	return s.Run()
}

// restartService restarts the service.  It returns error if the service is not
// running.  l must not be nil.
func restartService(ctx context.Context, baseLogger *slog.Logger) (err error) {
	svcMgr, err := ossvc.NewManager(ctx, &ossvc.ManagerConfig{
		Clock:              timeutil.SystemClock{},
		Logger:             baseLogger.With(slogutil.KeyPrefix, svcLogPrefix),
		CommandConstructor: executil.SystemCommandConstructor{},
	})
	if err != nil {
		return fmt.Errorf("initializing service manager: %w", err)
	}

	act := &ossvc.ActionRestart{
		ServiceName: serviceName,
	}

	err = svcMgr.Perform(ctx, act)
	if err != nil {
		return fmt.Errorf("restarting service: %w", err)
	}

	return nil
}

// handleServiceControlAction one of the possible control actions:
//
//   - install:  Installs a service/daemon.
//   - uninstall:  Uninstalls it.

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Check the wrapped cause; if unsupported platform, restart the process manually (or the container) after the update
  2. Run AdGuard Home as a proper system service so the manager can find it
  3. For containers, restart via orchestrator policy instead of the built-in updater
Defensive patterns

Strategy: fallback

Validate before calling

// Detect a usable service system before attempting updates:
if !service.Available() { /* manual restart path */ }

Try / catch

if err := restartService(...); err != nil {
    // plan a manual restart: log instruction and exit non-zero
}

Prevention

When it happens

Trigger: cmdlineUpdate calling restartService when NewManager cannot detect a usable service system (no systemd/svc support on this platform) or the manager config is rejected.

Common situations: Running an in-place CLI update inside a container without an init system, or on platforms where service control isn't compiled in/supported.

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/b4fa069cfb096bca. Report an issue: GitHub.