henrygd/beszel · warning

no sensors found (try running as admin with LHM=true)

Error message

no sensors found (try running as admin with LHM=true)

What it means

errNoSensors is returned by getTemps on Windows when no temperature sensor readings could be collected. On Windows, temperature data requires WMI or the bundled LibreHardwareMonitor (LHM) helper executable, both of which typically need administrator privileges. The agent returns this error when the sensor enumeration comes back empty, hinting at the LHM fallback.

Source

Thrown at agent/sensors_windows.go:52

	stdout               io.ReadCloser
	scanner              *bufio.Scanner
	isRunning            bool
	stoppedNoSensors     bool
	consecutiveNoSensors uint8
	execPath             string
	tempDir              string
}

//go:embed all:lhm/bin/Release/net48
var lhmFs embed.FS

var (
	beszelLhm     *lhmProcess
	beszelLhmOnce sync.Once
	useLHM        = os.Getenv("LHM") == "true"
)

var errNoSensors = errors.New("no sensors found (try running as admin with LHM=true)")

// newlhmProcess copies the embedded LHM executable to a temporary directory and starts it.
func newlhmProcess() (*lhmProcess, error) {
	destDir := filepath.Join(os.TempDir(), "beszel")
	execPath := filepath.Join(destDir, "beszel_lhm.exe")

	if err := os.MkdirAll(destDir, 0755); err != nil {
		return nil, fmt.Errorf("failed to create temp directory: %w", err)
	}

	// Only copy if executable doesn't exist
	if _, err := os.Stat(execPath); os.IsNotExist(err) {
		if err := copyEmbeddedDir(lhmFs, "lhm/bin/Release/net48", destDir); err != nil {
			return nil, fmt.Errorf("failed to copy embedded directory: %w", err)
		}
	}

	lhm := &lhmProcess{

View on GitHub (pinned to b38fb7dafa)

Solutions

  1. Re-run the agent process with administrator privileges
  2. Set environment variable LHM=true so the agent launches the embedded LibreHardwareMonitor helper
  3. Check that beszel_lhm.exe is created in the temp dir (antivirus may block it) and re-copy if missing
  4. Accept the limitation on VMs/hardware that exposes no sensors; hide the temperature metric for that system

Example fix

// before
./beszel-agent.exe
// after
LHM=true ./beszel-agent.exe  # run from an elevated shell
Defensive patterns

Strategy: fallback

Validate before calling

// before relying on temps on Windows
if runtime.GOOS == "windows" && os.Getenv("LHM") != "true" {
    log.Println("hint: set LHM=true and run elevated for temperature data")
}

Try / catch

temps, err := getTemps(ctx)
if errors.Is(err, errNoSensors) {
    log.Warn("temperature sensors unavailable; skipping")
    return nil // continue without temps
}

Prevention

When it happens

Trigger: getTemps is called on a Windows agent, neither WMI thermal zone queries nor the LHM helper return any sensors: LHM env var not set, LHM binary failed to start, or the process lacks admin rights so the kernel driver cannot read sensors.

Common situations: Running the beszel agent as a regular user on Windows; the LHM executable blocked by antivirus or missing from the temp directory; sensors genuinely absent in VMs (e.g. Hyper-V guests report no thermal data); forgetting to set LHM=true when WMI returns nothing.

Related errors


AI-assisted analysis of henrygd/beszel@b38fb7dafa (2026-08-31). Data as JSON: /api/errors/a19d89c99b0f7739. Report an issue: GitHub.