Okay, here’s a draft you can use to post on the Home Assistant Community forums:
Subject: Persistent “command not found” error with snmpset via shell_command despite working in container
Hi everyone,
I’m encountering a very frustrating issue with running snmpset via shell_command in Home Assistant and hoping someone can shed some light on it.
Here’s the situation:
I'm trying to control a device (Attomat MATIS) using SNMP SET commands.
I've confirmed that snmpset is installed and works perfectly when I run it directly within the Home Assistant Core container (using sudo). I can successfully set the OID value.
which snmpset inside the container returns /usr/bin/snmpset.
ls -l /usr/bin/snmpset shows the file exists and has execute permissions.
I've tried using the absolute path /usr/bin/snmpset in my shell_command configuration.
I've also tried creating a simple shell script (/config/set_attomat.sh) containing the snmpset command and ensuring it exists with execute permissions inside the container. I then tried calling this script from shell_command.
The Problem:
In both scenarios (calling snmpset directly and calling the shell script), I consistently get the following error in the “Phản hồi” section of Developer Tools → Services when calling the shell_command:
stderr: “/bin/sh: /usr/bin/snmpset: not found”
OR
stderr: “/bin/sh: /config/set_attomat.sh: not found”
The returncode is always 127.
I’ve also confirmed that basic shell_command like ls / works without any issues.
My Home Assistant setup: (Please let me know if you need more details)
Installation method: [e.g., Home Assistant OS, Supervised, Container, Core (venv)]
Home Assistant version: [e.g., 2024.XX.X]
Node-RED add-on version (if relevant): [e.g., X.X.X]
node-red-contrib-home-assistant-websocket version (if relevant): [e.g., X.X.X]
I’ve been troubleshooting this for a while and am completely stuck. It seems like shell_command is unable to locate the snmpset executable or the shell script, even though they are present and executable within the container.
Has anyone encountered a similar issue or have any ideas what might be preventing shell_command from finding these files? Any help would be greatly appreciated!
Thanks in advance.
Feel free to add any other relevant details about your setup or what you’ve tried. Good luck! I hope the community can help you resolve this.