tailscale/tailscale · error

failed tailscale update using apk: %w

Error message

failed tailscale update using apk: %w

What it means

The final step of updateAlpineLike executes 'apk upgrade tailscale' with cmd.Stdout/cmd.Stderr wired to the Updater's streams; a non-zero exit returns this error. All prior steps (index refresh, version discovery, user confirmation via up.confirm) already succeeded, so only the upgrade itself failed.

Source

Thrown at clientupdate/clientupdate.go:735

	if err != nil {
		return fmt.Errorf("failed checking apk for latest tailscale version: %w, output:\n%s", err, out)
	}
	ver, err := parseAlpinePackageVersion(out)
	if err != nil {
		return fmt.Errorf(`failed to parse latest version from "apk info tailscale": %w`, err)
	}
	if !up.confirm(ver) {
		if err := checkOutdatedAlpineRepo(up.Logf, apkDirPaths, ver, up.Track); err != nil {
			up.Logf("failed to check whether Alpine release is outdated: %v", err)
		}
		return nil
	}

	cmd := exec.Command("apk", "upgrade", "tailscale")
	cmd.Stdout = up.Stdout
	cmd.Stderr = up.Stderr
	if err := cmd.Run(); err != nil {
		return fmt.Errorf("failed tailscale update using apk: %w", err)
	}
	return nil
}

func parseAlpinePackageVersion(out []byte) (string, error) {
	s := bufio.NewScanner(bytes.NewReader(out))
	var maxVer string
	for s.Scan() {
		// The line should look like this:
		// tailscale-1.44.2-r0 description:
		line := strings.TrimSpace(s.Text())
		if !strings.HasPrefix(line, "tailscale-") {
			continue
		}
		parts := strings.SplitN(line, "-", 3)
		if len(parts) < 3 {
			return "", fmt.Errorf("malformed info line: %q", line)
		}

View on GitHub (pinned to cfe32b8be6)

Solutions

  1. Run 'sudo apk upgrade tailscale' manually - its output shows the exact dependency, space, or signature error
  2. Free disk space ('df -h /') and clear apk caches if full
  3. Run 'apk fix' if the database is corrupted, then retry
  4. Resolve dependency conflicts reported by apk before retrying 'tailscale update'
Defensive patterns

Strategy: try-catch

Validate before calling

// Cheap pre-flight: space and lock availability before upgrading.
var stat syscall.Statfs_t
if err := syscall.Statfs("/", &stat); err == nil && stat.Bavail*uint64(stat.Bsize) < 100<<20 {
    return errors.New("less than 100MB free on /; apk upgrade will likely fail")
}

Try / catch

if err := up.Update(); err != nil {
    if strings.Contains(err.Error(), "failed tailscale update using apk") {
        // discovery succeeded; only the upgrade failed. Safe to re-run after
        // fixing disk space / dependencies - confirm() will not double-apply.
    }
}

Prevention

When it happens

Trigger: exec.Command("apk", "upgrade", "tailscale").Run() fails - unsatisfiable dependencies, no space left on disk, apk database locked by a concurrent run, or a package signature check failing.

Common situations: Disk full on / or /var; a partially upgraded system with conflicting dependency versions; another apk process running concurrently; broken mirrors mid-upgrade.

Related errors


AI-assisted analysis of tailscale/tailscale@cfe32b8be6 (2026-08-15). Data as JSON: /api/errors/79848896d52f6608. Report an issue: GitHub.