Skip to content

fix(install): rm symlink before writing hermes launcher to prevent venv corruption#24850

Closed
luyao618 wants to merge 1 commit into
NousResearch:mainfrom
luyao618:fix/install-symlink-overwrite
Closed

fix(install): rm symlink before writing hermes launcher to prevent venv corruption#24850
luyao618 wants to merge 1 commit into
NousResearch:mainfrom
luyao618:fix/install-symlink-overwrite

Conversation

@luyao618

Copy link
Copy Markdown
Contributor

Summary

When ~/.local/bin/hermes is a symlink pointing into the venv (state left by an earlier install), cat > $command_link_dir/hermes follows the symlink and overwrites the real Python entry-point with the bash launcher template. The launcher then execs itself in an infinite loop and hermes hangs forever.

Changes

  • Add rm -f "$command_link_dir/hermes" before the cat > redirect in scripts/install.sh so any existing file or symlink is removed first, ensuring the redirect always creates a fresh regular file.

How to test

  1. Create the problematic state: ln -sf ~/.hermes/hermes-agent/venv/bin/hermes ~/.local/bin/hermes
  2. Run scripts/install.sh
  3. Verify hermes --help works (no hang)
  4. Verify ~/.local/bin/hermes is a regular file, not a symlink
  5. Verify ~/.hermes/hermes-agent/venv/bin/hermes is still the Python console-script

Related

Fixes #24834

…nv corruption

When ~/.local/bin/hermes is a symlink pointing into the venv (left by a
previous install), `cat > $command_link_dir/hermes` follows the symlink
and overwrites the real Python entry-point with the bash launcher template.
The launcher then exec's itself in an infinite loop.

Add `rm -f` before the redirect so any existing file or symlink is removed
first, ensuring the redirect always creates a fresh regular file.

Fixes NousResearch#24834
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists labels May 13, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #20747 (and #21513, #22472, #24452). Same fix: rm -f before cat > heredoc in install.sh to prevent shell redirection from following pre-existing symlink into venv/bin/hermes. Multiple PRs already open for this issue.

@teknium1

Copy link
Copy Markdown
Contributor

Superseded by #25734, which merged @Tranquil-Flow's earlier #21513 with the same one-line rm -f fix. Three contributors independently converged on this — thanks, credited in the merged PR. Merge commit c75e1a0.

@teknium1 teknium1 closed this May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install.sh corrupts venv hermes entry-point when ~/.local/bin/hermes is a symlink

3 participants