hermes - ✅(Solved) Fix [Bug]: systemd gateway service does not propagate LD_LIBRARY_PATH, breaking CUDA-dependent tools like faster-whisper/ctranslate2 [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#14613Fetched 2026-04-24 06:15:59
View on GitHub
Comments
0
Participants
1
Timeline
7
Reactions
0
Participants
Timeline (top)
labeled ×5cross-referenced ×2

Root Cause

This is the same root cause as #6729 (HERMES_HOME not honored), just for a different environment variable.

Fix Action

Workaround

Create a systemd drop-in override manually:

mkdir -p ~/.config/systemd/user/hermes-gateway.service.d
cat > ~/.config/systemd/user/hermes-gateway.service.d/cuda.conf << 'EOF'
[Service]
Environment="LD_LIBRARY_PATH=/opt/cuda/lib64"
EOF
systemctl --user daemon-reload
systemctl --user restart hermes-gateway

However, this is not discoverable for most users and should be handled natively.

PR fix notes

PR #14684: fix(gateway): propagate LD_LIBRARY_PATH into generated systemd unit

Description (problem / solution / changelog)

What does this PR do?

generate_systemd_unit() in hermes_cli/gateway.py already carries PATH, VIRTUAL_ENV, and HERMES_HOME into the systemd Environment= block at install time, but silently drops LD_LIBRARY_PATH. Tools that rely on dynamic library resolution at runtime — most notably faster-whisper / ctranslate2 for local CUDA-backed STT — fail to find libcublas.so under systemd even though they work correctly in an interactive terminal.

Parity fix: capture LD_LIBRARY_PATH from the install-time environment and emit an Environment= line in both the user-service (system=False) and system-service (system=True) templates when the variable is set. When unset, the generated unit is unchanged — no behavior change for users without CUDA or a custom LD_LIBRARY_PATH.

Related Issue

Fixes #14613

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor
  • 🎯 New skill

Changes Made

  • hermes_cli/gateway.py: capture LD_LIBRARY_PATH from os.environ and emit a conditional Environment= line in both systemd unit templates (+4 lines)
  • tests/hermes_cli/test_gateway_service.py: 3 new tests in TestGeneratedSystemdUnits — set/unset for user service and set for system service (+21 lines)

How to Test

pytest tests/hermes_cli/test_gateway_service.py::TestGeneratedSystemdUnits -v

All 6 tests pass (3 existing + 3 new).

To verify end-to-end on a CUDA machine:

  1. Ensure LD_LIBRARY_PATH includes your CUDA lib dir (e.g. export LD_LIBRARY_PATH=/opt/cuda/lib64)
  2. Run hermes gateway install
  3. Check ~/.config/systemd/user/hermes-gateway.serviceEnvironment="LD_LIBRARY_PATH=/opt/cuda/lib64" should appear
  4. Start the gateway and confirm faster-whisper / ctranslate2 loads without libcublas.so errors

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've run pytest tests/hermes_cli/test_gateway_service.py -v and pre-existing failures are unrelated (dotenv not installed in local env)
  • I've added tests for my changes
  • I've tested on my platform: macOS

Documentation & Housekeeping

  • I've updated relevant documentation — or N/A
  • I've updated cli-config.yaml.example — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md — or N/A
  • I've considered cross-platform impact — Linux/CUDA specific, no Windows/macOS impact
  • I've updated tool descriptions/schemas — or N/A

Changed files

  • hermes_cli/gateway.py (modified, +4/-2)
  • tests/hermes_cli/test_gateway_service.py (modified, +21/-0)

PR #14862: fix(gateway): preserve LD_LIBRARY_PATH in generated systemd units

Description (problem / solution / changelog)

Summary

  • carry LD_LIBRARY_PATH into generated systemd user units when it is present in the install shell
  • do the same for generated system units so CUDA-dependent tools keep their dynamic library path
  • add regression coverage for both unit types

Testing

  • python3 -m pytest -o addopts= tests/hermes_cli/test_gateway_service.py -k GeneratedSystemdUnits or LD_LIBRARY_PATH

Closes #14613

Changed files

  • hermes_cli/gateway.py (modified, +6/-2)
  • tests/hermes_cli/test_gateway_service.py (modified, +14/-0)

Code Example

mkdir -p ~/.config/systemd/user/hermes-gateway.service.d
cat > ~/.config/systemd/user/hermes-gateway.service.d/cuda.conf << 'EOF'
[Service]
Environment="LD_LIBRARY_PATH=/opt/cuda/lib64"
EOF
systemctl --user daemon-reload
systemctl --user restart hermes-gateway
RAW_BUFFERClick to expand / collapse

Bug Description

When installing the gateway as a systemd user service, generate_systemd_unit() in hermes_cli/gateway.py captures PATH, VIRTUAL_ENV, and HERMES_HOME from the invoking shell, but it silently drops LD_LIBRARY_PATH. This breaks any tool that relies on dynamic library resolution at runtime — most notably faster-whisper / ctranslate2 for local STT, which fails to find libcublas.so under systemd even though it works perfectly in an interactive terminal.

This is the same root cause as #6729 (HERMES_HOME not honored), just for a different environment variable.

Steps to Reproduce

  1. Install CUDA (e.g. /opt/cuda on Arch, /usr/local/cuda on Debian/Ubuntu) and ensure LD_LIBRARY_PATH points to its lib64 directory in your shell environment.
  2. Verify local STT works in a terminal: hermes gateway run (interactive) loads the faster-whisper model successfully.
  3. Install the systemd service: hermes gateway install
  4. Start the service: hermes gateway start
  5. Try voice transcription via WhatsApp/Telegram/Discord.
  6. Observe libcublas.so.12: cannot open shared object file in journalctl --user -u hermes-gateway.

Expected Behavior

The generated hermes-gateway.service should either:

  • (a) carry over LD_LIBRARY_PATH from the shell that runs hermes gateway install, or
  • (b) provide a config/env mechanism to inject extra Environment= lines into the generated unit.

Actual Behavior

LD_LIBRARY_PATH is missing from the systemd unit. The service runs with a stripped-down environment, causing ctranslate2 to fail library resolution and fall back to CPU or crash.

Affected Component

Setup / Installation — hermes_cli/gateway.py (generate_systemd_unit())

Operating System

Arch Linux (also affects any distro with CUDA outside /usr/lib)

Hermes Version

0.10.0

Workaround

Create a systemd drop-in override manually:

mkdir -p ~/.config/systemd/user/hermes-gateway.service.d
cat > ~/.config/systemd/user/hermes-gateway.service.d/cuda.conf << 'EOF'
[Service]
Environment="LD_LIBRARY_PATH=/opt/cuda/lib64"
EOF
systemctl --user daemon-reload
systemctl --user restart hermes-gateway

However, this is not discoverable for most users and should be handled natively.

Proposed Fix

In generate_systemd_unit(), check for LD_LIBRARY_PATH in os.environ and emit an additional Environment= line if present, mirroring how PATH is already handled. Alternatively, generalize the fix from PR #14450 to capture any relevant env vars that are set at install time.

extent analysis

TL;DR

Modify the generate_systemd_unit() function in hermes_cli/gateway.py to capture and include LD_LIBRARY_PATH in the generated systemd unit.

Guidance

  • Verify that LD_LIBRARY_PATH is set in the shell environment before running hermes gateway install.
  • Check the hermes-gateway.service file generated by hermes gateway install to confirm that LD_LIBRARY_PATH is missing.
  • Apply the proposed workaround by creating a systemd drop-in override manually to test if including LD_LIBRARY_PATH resolves the issue.
  • Consider generalizing the fix to capture any relevant environment variables set at install time, as suggested in the proposed fix.

Example

# In generate_systemd_unit()
if 'LD_LIBRARY_PATH' in os.environ:
    systemd_unit += 'Environment=LD_LIBRARY_PATH={}\n'.format(os.environ['LD_LIBRARY_PATH'])

Notes

This fix assumes that the LD_LIBRARY_PATH environment variable is set correctly in the shell environment before running hermes gateway install. The proposed fix may need to be adapted to handle cases where LD_LIBRARY_PATH is not set or is set to an empty value.

Recommendation

Apply the workaround by creating a systemd drop-in override manually, as this provides a temporary solution until the proposed fix can be implemented and verified.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING