wavetermdev/waveterm · error

error running uname -sm: %w, stderr: %s

Error message

error running uname -sm: %w, stderr: %s

What it means

GetClientPlatform runs 'uname -sm' on the remote host via the provided genconn.ShellClient to detect its OS/architecture. This error is wrapped when the command itself fails to execute or returns a non-zero exit, with the captured stderr included for diagnosis. It means platform detection could not be performed, not that the output was malformed (see the 'unexpected output' error for that).

Source

Thrown at pkg/remote/connutil.go:66

	arch = strings.ToLower(strings.TrimSpace(arch))
	switch arch {
	case "x86_64", "amd64":
		arch = "x64"
	case "arm64", "aarch64":
		arch = "arm64"
	}
	return arch
}

// returns (os, arch, error)
// guaranteed to return a supported platform
func GetClientPlatform(ctx context.Context, shell genconn.ShellClient) (string, string, error) {
	blocklogger.Infof(ctx, "[conndebug] running `uname -sm` to detect client platform\n")
	stdout, stderr, err := genconn.RunSimpleCommand(ctx, shell, genconn.CommandSpec{
		Cmd: "uname -sm",
	})
	if err != nil {
		return "", "", fmt.Errorf("error running uname -sm: %w, stderr: %s", err, stderr)
	}
	// Parse and normalize output
	parts := strings.Fields(strings.ToLower(strings.TrimSpace(stdout)))
	if len(parts) != 2 {
		return "", "", fmt.Errorf("unexpected output from uname: %s", stdout)
	}
	os, arch := normalizeOs(parts[0]), normalizeArch(parts[1])
	if err := wavebase.ValidateWshSupportedArch(os, arch); err != nil {
		return "", "", err
	}
	return os, arch, nil
}

func GetClientPlatformFromOsArchStr(ctx context.Context, osArchStr string) (string, string, error) {
	parts := strings.Fields(strings.TrimSpace(osArchStr))
	if len(parts) != 2 {
		return "", "", fmt.Errorf("unexpected output from uname: %s", osArchStr)
	}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Inspect the stderr embedded in the message to identify the remote-side failure (command not found, permission denied, etc.).
  2. Verify the remote host is a POSIX system with 'uname' available in the default shell PATH.
  3. Re-check SSH connectivity and retry InstallWsh; transient network drops surface here.
  4. If the remote is non-POSIX, use GetClientPlatformFromOsArchStr with a manually supplied os/arch string instead.
Defensive patterns

Strategy: retry

Validate before calling

// verify connectivity before platform detection
stdout, stderr, err := genconn.RunSimpleCommand(ctx, shell, genconn.CommandSpec{Cmd: "echo ok"})
if err != nil || strings.TrimSpace(stdout) != "ok" {
    return fmt.Errorf("remote shell unavailable: %v %s", err, stderr)
}

Try / catch

os, arch, err := connutil.GetClientPlatform(ctx, shell)
if err != nil {
    if strings.Contains(err.Error(), "error running uname") {
        // retry once, then fall back to a manual os/arch
        os, arch, err = connutil.GetClientPlatformFromOsArchStr(ctx, knownOsArch)
    }
    if err != nil { return err }
}

Prevention

When it happens

Trigger: genconn.RunSimpleCommand returns an error while running 'uname -sm' — e.g. SSH connection dropped mid-command, remote shell cannot spawn, 'uname' not on PATH (minimal containers/non-POSIX systems), or the command timed out.

Common situations: Installing/updating wsh (InstallWsh) on remote hosts lacking standard Unix tools (Alpine variants without coreutils in PATH, Windows targets); flaky SSH connections; restricted shells (rbash) blocking command execution.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/7ecb0f05647fd883. Report an issue: GitHub.