Skip to content

fix: re-resolve pkgRoot after update to prevent stale systemd ExecStart path#28231

Open
2233admin wants to merge 2 commits intoopenclaw:mainfrom
2233admin:fix/update-systemd-path-mismatch
Open

fix: re-resolve pkgRoot after update to prevent stale systemd ExecStart path#28231
2233admin wants to merge 2 commits intoopenclaw:mainfrom
2233admin:fix/update-systemd-path-mismatch

Conversation

@2233admin
Copy link
Copy Markdown
Contributor

Summary

Fixes #28209device signature invalid after updating from 2026.2.24 to 2026.2.26.

Root Cause

In runPackageInstallUpdate(), pkgRoot is resolved before the update runs. With pnpm, the package root includes the version in the path (e.g. [email protected]/.../node_modules/openclaw). After update, this path no longer exists — it's now [email protected]/....

The stale pkgRoot is returned as result.root, which refreshGatewayServiceEnv() uses to find entry.js. Since the old path is gone, the systemd service file never gets updated, and the Gateway keeps running the old binary that can't validate the new device signature.

Fix

Call resolveGlobalPackageRoot() again after the update step completes, so result.root always points to the newly installed version.

Changes

  • src/cli/update-cli/update-command.ts: Re-resolve pkgRoot after update, use effectivePkgRoot (new root with fallback to old) for version reading, doctor step, and return value.

Testing

Reproduced and verified on:

  • Arch Linux (pnpm global install) — 2026.2.24 → 2026.2.26
  • CentOS (npm global install via nvm) — same upgrade path
  • Both showed device signature invalid before fix
  • 4-node cluster available for further testing

Impact

Minimal — adds one extra resolveGlobalPackageRoot() call (fast, no network) after the update step. No behavioral change when the path hasn't changed (npm on some systems).

…rt path

After a global pnpm/npm update, the package root directory changes
(e.g. [email protected]/... → [email protected]/...). The previous
code resolved pkgRoot before the update and never refreshed it,
causing:

1. refreshGatewayServiceEnv() to use the old entry.js path
2. systemd ExecStart to keep pointing at the old (possibly deleted) version
3. Gateway fails with 'device signature invalid' because old binary
   can't validate new device signatures

Fix: call resolveGlobalPackageRoot() again after the update step
completes, so result.root always points to the newly installed version.

Fixes openclaw#28209
@openclaw-barnacle openclaw-barnacle bot added cli CLI command changes size: XS labels Feb 27, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 27, 2026

Greptile Summary

Re-resolves the global package root after update to prevent stale systemd service paths. With pnpm, package directories include version numbers (e.g., [email protected]), so the pre-update path becomes invalid after updating to a new version. The fix adds a second call to resolveGlobalPackageRoot() after the update step completes, ensuring result.root points to the newly installed version's path. This allows refreshGatewayServiceEnv() to correctly locate entry.js and update the systemd service file.

  • Uses effectivePkgRoot = updatedPkgRoot ?? pkgRoot for graceful fallback if re-resolution fails
  • Applies the updated path to version reading, doctor step execution, and return value
  • Adds clear comments explaining the pnpm-specific path issue and the fix
  • Minimal performance impact (one fast, local resolution call with no network access)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix correctly addresses a well-documented root cause with a targeted, minimal change. The implementation includes proper fallback logic (updatedPkgRoot ?? pkgRoot ?? params.root), preserves existing behavior for non-pnpm installs, and has been verified on multiple systems (Arch Linux and CentOS). The additional resolveGlobalPackageRoot() call is fast and local with no network impact. Clear comments explain the issue and fix.
  • No files require special attention

Last reviewed commit: b87966f

@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Mar 4, 2026
@openclaw-barnacle openclaw-barnacle bot removed the stale Marked as stale due to inactivity label Mar 27, 2026
@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway 'device signature invalid' after update from 2026.2.24 to 2026.2.26

1 participant