File not found Error in command line sensor after Upgrade or Crash

Hello,

i have a HomeAsstistant installation in Docker on a Synology. After the last Upgrade or an crash, i do ot know any more, i get the following error in logs:

/bin/sh: /config/vclient: not found                                                                                                                                                                                                                                                                                                                                         
2022-07-19 10:39:25 ERROR (SyncWorker_0) [homeassistant.components.command_line] Command failed: /config/vclient -h 192.168.111.36 -p 3002 -c getWWEinmal                                                                                                                                                                                                                   
2022-07-19 10:39:25 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: list object has no element 1 (value: None, template: {{ ( value.split(':')[1] | int ) == 2 }})                                                                                                                                                                                 
/bin/sh: /config/vclient: not found 

vclient is a program to connect to a Vissmann Heater. If I run the program from a Container Bash Shell I get the following error:

bash-5.1# /bin/sh /config/vclient -h 192.168.111.36 -p 3002 -c getBetriebsart                                                                                                                                                                                                                                                                                               
/config/vclient: line 1: syntax error: unexpected "("

i do not know what went wrong because bevor the crash or the update everything was woring.

the sensor config is:

sensor Heizung_Betriebsart:
  - platform: command_line
    name: "Heizung Betriebsart"
    unique_id: heizungbetriebsart
    command: "/config/vclient -h 192.168.111.36 -p 3002 -c getBetriebsart"
    #command: "/config/Test.sh"
    value_template: "{{ value.split(':')[1] }}"

perhaps anyone could help?

thanks!

Dominik

Does vclient exist in /config/?

Hello Tinkerer,

Yes.

bash-5.1# pwd                                                                                                                                                                                                                                                                                                                                                               
/config                                                                                                                                                                                                                                                                                                                                                                     
bash-5.1# ls -al                                                                                                                                                                                                                                                                                                                                                            
total 1006572                                                                                                                                                                                                                                                                                                                                                               
drwxr-xr-x    9 1026     users         4096 Jul 19 10:14 .                                                                                                                                                                                                                                                                                                                  
drwxr-xr-x   83 root     root          4096 Jul 19 09:22 ..                                                                                                                                                                                                                                                                                                                 
-rwxr-xr-x    1 root     root             8 Jul 17 06:56 .HA_VERSION                                                                                                                                                                                                                                                                                                        
drwxr-xr-x    2 root     root          4096 Nov  6  2021 .cloud                                                                                                                                                                                                                                                                                                             
drwxr-xr-x    2 root     root          4096 Jul 19 11:20 .storage                                                                                                                                                                                                                                                                                                           
drwxrwxrwx    2 root     users         4096 Jul 19 10:14 @eaDir                                                                                                                                                                                                                                                                                                             
-rwxr-xr-x    1 1026     users          207 Jul 19 09:17 Test.sh                                                                                                                                                                                                                                                                                                            
-rwxr-xr-x    1 root     root             2 Nov  6  2021 automations.yaml                                                                                                                                                                                                                                                                                                   
drwxr-xr-x    4 root     root          4096 Nov  6  2021 blueprints                                                                                                                                                                                                                                                                                                         
-rwxr-xr-x    1 root     root         10300 Jul 19 09:57 configuration.yaml                                                                                                                                                                                                                                                                                                 
drwxr-xr-x    2 root     root          4096 Nov  6  2021 deps                                                                                                                                                                                                                                                                                                               
-rwxr-xr-x    1 root     root             0 Nov  6  2021 groups.yaml                                                                                                                                                                                                                                                                                                        
-rwxr-xr-x    1 root     root        287833 Jul 19 11:28 home-assistant.log                                                                                                                                                                                                                                                                                                 
-rwxr-xr-x    1 root     root         42968 Jul 19 10:04 home-assistant.log.1                                                                                                                                                                                                                                                                                               
-rwxr-xr-x    1 root     root             0 Jul 19 10:04 home-assistant.log.fault                                                                                                                                                                                                                                                                                           
-rwxr-xr-x    1 root     root     1025597440 Jul 19 11:28 home-assistant_v2.db                                                                                                                                                                                                                                                                                              
-rwxr-xr-x    1 root     root         32768 Jul 19 11:28 home-assistant_v2.db-shm                                                                                                                                                                                                                                                                                           
-rwxr-xr-x    1 root     root       4618552 Jul 19 11:28 home-assistant_v2.db-wal                                                                                                                                                                                                                                                                                           
-rwxr-xr-x    1 root     root             0 Nov  6  2021 scenes.yaml                                                                                                                                                                                                                                                                                                        
-rwxr-xr-x    1 root     root             0 Nov  6  2021 scripts.yaml                                                                                                                                                                                                                                                                                                       
-rwxr-xr-x    1 root     root           161 Nov  6  2021 secrets.yaml                                                                                                                                                                                                                                                                                                       
drwxr-xr-x    3 1026     users         4096 Nov  7  2021 ssl                                                                                                                                                                                                                                                                                                                
drwxr-xr-x    2 root     root          4096 Nov  6  2021 tts                                                                                                                                                                                                                                                                                                                
-rwxrwxrwx    1 1026     users        47936 Feb 26 12:30 vclient                                                                                                                                                                                                                                                                                                            
bash-5.1#                           

Ah, and I see you applied the chmod 777 approach… which is a really dumb one that nobody should ever use.

/config/vclient: line 1: syntax error: unexpected "("

suggests maybe the file is corrupt, try replacing it

it was an act of desperation. I have replaced the vclient with a new on, but without any changes. Then I have reverted HA to 2022.6.7 and the sensor is functioning. So the source of the problem is the update to 2022 7.5. But I can’t see any hint to the posible cause in the release log.

Can you point to the code if it is on the net, or share it if you wrote it?

Hello nickrout,

if you mean the vclient code? It is here Releases · openv/vcontrold · GitHub . I use the vcontrold_0.98.10-176_amd64.zip Version.

I also tryed the Home Assistant 2022.8.0.dev20220720 Version, but the error persists.

dominik

It is not a shell script so it is never going to run from /bin/sh

Try just running /config/vclient

If I run it on HA 2022 7.5

bash-5.1# /config/vclient                                                                                                                                                                        
bash: /config/vclient: No such file or directory 

and on HA 2022 6.5

bash-5.1#  /config/vclient                                                                                                                                                                       
usage:                                                                                                                                                                                           
    vclient [-h <ip:port>] [-c <command1,command2,..>] [-f <commandfile>]                                                                                                                        
            [-s <csv file>] [-t <template file>] [-o <output file>]                                                                                                                              
            [-x <exec file>] [-k] [-m] [-v]                                                                                                                                                      
                                                                                                                                                                                                 
or:                                                                                                                                                                                              
    vclient [--host <ip>] [--port <port>] [--command <command1,command2,..>]                                                                                                                     
            [--commandfile <command file>] [--csvfile <csv file>]                                                                                                                                
            [--template <template file>] [--output <output file>]                                                                                                                                
            [--execute <exec file>] [--cacti] [--munin] [--verbose]                                                                                                                              
            [command3 [command4] ...]                                                                                                                                                            
                                                                                                                                                                                                 
    -h|--host         <IPv4>:<Port> or <IPv6> of vcontrold                                                                                                                                       
    -p|--port         <port> of vcontrold when using IPv6                                                                                                                                        
    -c|--command      List of commands to be executed, sparated by commas                                                                                                                        
    -f|--commandfile  Optional command file, one command per line                                                                                                                                
    -s|--csvfile      Format output in CSV for further processing                                                                                                                                
    -t|--template     Template, variables are substituted with acquired values                                                                                                                   
    -o|--output       Write to given file instead of STDOUT                                                                                                                                      
    -x|--execute      The converted template (cf. -t) is written to the given                                                                                                                    
                      file and executed subsequently                                                                                                                                             
    -m|--munin        Output a Munin data logger compatible format (units and                                                                                                                    
                      error details are discarded)                                                                                                                                               
    -k|--cacti        Output a Cacti data logger compatible format (units and                                                                                                                    
                      error details are discarded)                                                                                                                                               
    -v|--verbose      Be verbose (for testing purposes)                                                                                                                                          
    -V|--Version      Print version and exit                                                                                                                                                     
    -4|--inet4        IPv4 is preferred                                                                                                                                                          
    -6|--inet6        IPv6 is preferred                                                                                                                                                          
                      (if none of the two above is set, the system default will                                                                                                                  
                      be used)                                                                                                                                                                   
    --help            Display this help message

so something has changed from HA 6.5 to 7.5.

I just tried it and get same results.

Other stuff (eg a script) runs from /config

Yes, scripts like

#!/bin/sh
# This is a comment!
echo "Hello World"

run in both HA 6.5 and 7.5

Dominik

I tried to copy some other executables into /config. Compiled stuff. None of them would work.

It is as though /config is mounted with the noexec flag, which prevents execution of binaries. scripts with a shebang (eg #!/bin/bash) will still work in a noexec mount because it is actually executed by /bin/bash.

Then of course there is docker on top of that to consider.

I know this thread is old, but I would like to propose a possible solution to anyone interested.
I encountered the same problem with a compiled executable after the upgrade to 2022.7.7. The binary (aurora) is mounted from the host system in a directory /host/bin in the container.

The error after the upgrade is:

/bin/sh: /host/bin/aurora: not found

After some digging around, I found out using the file command that the executable was dynamically linked, requiring the loader ld-linux-aarch64.so.1 to load the shared libraries.
Inside the docker image homeassistant/raspberrypi4-64-homeassistant:2022.6.7 there is the required library, which is a symlink to the musl C version.

$ ls -al /lib/
lrwxrwxrwx    1 root     root            27 May 24  2022 ld-linux-aarch64.so.1 -> /lib/libc.musl-aarch64.so.1
-rwxr-xr-x    1 root     root        633328 May  9  2021 *ld-linux-aarch64.so.1*

The library ld-linux-aarch64.so.1 however is missing in the image homeassistant/raspberrypi4-64-homeassistant:2022.7.7, causing the misleading error.
Since I had access to the source code of this application, to solve this issue I recompiled the executable using static linking, eliminating the need for the shared library.

TLDR: There was an update in the upstream Docker image that removed a C library required to run the binary program.