hermes - 💡(How to fix) Fix hermes status reports sudo disabled when passwordless sudo works [2 comments, 2 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#18110Fetched 2026-05-01 05:53:46
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×3commented ×2

Error Message

import subprocess

sudo_password = os.getenv("SUDO_PASSWORD", "") passwordless_sudo = False

if not sudo_password: try: result = subprocess.run( ["sudo", "-n", "true"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=2, ) passwordless_sudo = result.returncode == 0 except Exception: passwordless_sudo = False

sudo_enabled = bool(sudo_password) or passwordless_sudo

Code Example

Terminal Backend
  Backend:      local
  Sudo:         ✗ disabled

---

admin ALL=(ALL) NOPASSWD:ALL

---

sudo -n true
   echo $?

---

sudo apt update

---

hermes status

---

Sudo:enabled (passwordless)

---

sudo_password = os.getenv("SUDO_PASSWORD", "")
print(f"  Sudo:         {check_mark(bool(sudo_password))} {'enabled' if sudo_password else 'disabled'}")

---

import subprocess

sudo_password = os.getenv("SUDO_PASSWORD", "")
passwordless_sudo = False

if not sudo_password:
    try:
        result = subprocess.run(
            ["sudo", "-n", "true"],
            stdout=subprocess.DEVNULL,
            stderr=subprocess.DEVNULL,
            timeout=2,
        )
        passwordless_sudo = result.returncode == 0
    except Exception:
        passwordless_sudo = False

sudo_enabled = bool(sudo_password) or passwordless_sudo
RAW_BUFFERClick to expand / collapse

Bug Description

hermes status reports sudo as disabled when passwordless sudo is configured and working.

Current output:

Terminal Backend
  Backend:      local
  Sudo:         ✗ disabled

However, sudo commands work correctly without a password.

Steps to Reproduce

  1. Configure passwordless sudo for the user running Hermes, for example via sudoers:

    admin ALL=(ALL) NOPASSWD:ALL
  2. Verify sudo works without a password:

    sudo -n true
    echo $?

    This returns 0.

  3. Run a sudo command through Hermes terminal tool, for example:

    sudo apt update

    It succeeds.

  4. Run:

    hermes status

Expected Behavior

hermes status should report sudo as enabled when either:

  • SUDO_PASSWORD is configured, or
  • sudo -n true succeeds for the current user.

For example:

Sudo: ✓ enabled (passwordless)

Actual Behavior

hermes status only checks whether SUDO_PASSWORD exists:

sudo_password = os.getenv("SUDO_PASSWORD", "")
print(f"  Sudo:         {check_mark(bool(sudo_password))} {'enabled' if sudo_password else 'disabled'}")

So passwordless sudo is reported as disabled even though sudo commands work.

Environment

  • OS: Ubuntu noble
  • Terminal backend: local
  • Hermes project path: /home/admin/.hermes/hermes-agent
  • Login method: SSH key
  • Sudo mode: passwordless sudo / NOPASSWD, no SUDO_PASSWORD

Proposed Fix

Update hermes_cli/status.py to also detect passwordless sudo:

import subprocess

sudo_password = os.getenv("SUDO_PASSWORD", "")
passwordless_sudo = False

if not sudo_password:
    try:
        result = subprocess.run(
            ["sudo", "-n", "true"],
            stdout=subprocess.DEVNULL,
            stderr=subprocess.DEVNULL,
            timeout=2,
        )
        passwordless_sudo = result.returncode == 0
    except Exception:
        passwordless_sudo = False

sudo_enabled = bool(sudo_password) or passwordless_sudo

Then display whether sudo is enabled via SUDO_PASSWORD or passwordless sudo.

extent analysis

TL;DR

Update hermes_cli/status.py to detect passwordless sudo by checking the result of sudo -n true when SUDO_PASSWORD is not set.

Guidance

  • The issue arises from hermes status only checking for the presence of SUDO_PASSWORD to determine sudo status.
  • To fix this, modify the hermes_cli/status.py file to also check for passwordless sudo by running sudo -n true and checking its return code.
  • If sudo -n true succeeds (return code 0), it indicates passwordless sudo is configured and working.
  • Update the display logic to show whether sudo is enabled via SUDO_PASSWORD or passwordless sudo.

Example

import subprocess
import os

sudo_password = os.getenv("SUDO_PASSWORD", "")
passwordless_sudo = False

if not sudo_password:
    try:
        result = subprocess.run(
            ["sudo", "-n", "true"],
            stdout=subprocess.DEVNULL,
            stderr=subprocess.DEVNULL,
            timeout=2,
        )
        passwordless_sudo = result.returncode == 0
    except Exception:
        passwordless_sudo = False

sudo_enabled = bool(sudo_password) or passwordless_sudo
print(f"  Sudo:         {'✓ enabled (passwordless)' if passwordless_sudo else '✗ disabled'}")

Notes

This solution assumes that the sudo command is available and properly configured on the system. If sudo is not installed or not configured correctly, this solution may not work as expected.

Recommendation

Apply the proposed fix by updating hermes_cli/status.py to detect passwordless sudo, as this will correctly report the sudo status when passwordless sudo is configured.

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

hermes - 💡(How to fix) Fix hermes status reports sudo disabled when passwordless sudo works [2 comments, 2 participants]