#shell_command permission errors

1 messages · Page 1 of 1 (latest)

simple wasp
#

Hi guys atm I am annoyed cuz I can't manage to run a simple bash script with automation.

This is my simple script:

#!/bin/bash

LOG_FILE="/config/scrcpy_log.txt"

echo "Starting ADB server..." >> $LOG_FILE
/usr/bin/adb start-server >> $LOG_FILE 2>&1

echo "Connecting to device..." >> $LOG_FILE
/usr/bin/adb connect 192.168.1.5:5555 >> $LOG_FILE 2>&1

echo "Starting scrcpy..." >> $LOG_FILE
/usr/local/bin/scrcpy --no-video >> $LOG_FILE 2>&1

I managed to get .sh running but I always get permission error when try use scrcpy and adb its says:

Starting ADB server...
/config/start_sound.sh: line 6: /usr/bin/adb: cannot execute: required file not found
Connecting to device...
/config/start_sound.sh: line 9: /usr/bin/adb: cannot execute: required file not found
Starting scrcpy...
/config/start_sound.sh: line 12: /usr/local/bin/scrcpy: cannot execute: required file not found
Starting ADB server...
/config/start_sound.sh: line 6: /usr/bin/adb: cannot execute: required file not found
Connecting to device...
/config/start_sound.sh: line 9: /usr/bin/adb: cannot execute: required file not found
Starting scrcpy...
/config/start_sound.sh: line 12: /usr/local/bin/scrcpy: cannot execute: required file not found

I nearly did everything tried in compose file set user as : 1000:1000 what is mine. I setted all groups like my user but nothing worked. Here is my docker-compose.yaml

services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /home/kewu/homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
      - /usr/bin/adb:/usr/bin/adb:ro
      - /usr/local/bin/scrcpy:/usr/local/bin/scrcpy:ro
    restart: unless-stopped
    privileged: true
    network_mode: host
    user: "1000:1000"

Thanks for helping me.

unique wave
#

My guess is that they're dynamically linked

simple wasp
#

Yea probably and how can I resolve this? :c

vast ferry
simple wasp
#

I try manage simple thing when my TV is on it start adb connection with strcpy to manage sound system trough wifi. Cuz I don't wanna use bluetooth AVRCP sucks on that box with RPI + PipeWire Wireplumber. scrcpy get sound from TV through ADB and sending to PipeWire where the sound effected and sent to 3.5 barrel jack

#

I am working with this since 3 days I tried firstly with bluetooth but yea AVRCP doesn't get any volume packet from box but from my phone it does. So I gave up and tried with adb where It was awesome and now I wanna make a script where automaticly start the session

vast ferry
#

so, have you had this stuff working outside of the HA container and you just want to move it inside so you can automate triggering it?

simple wasp
#

Exactly

vast ferry
#

how about running it on the host and then using an automation to trigger the script on the host via ssh?

simple wasp
#

so you says the bash script sitting on (rpi) host and HA container calling ssh what loopback to the host and runs the script?

vast ferry
#

what way your scripts and dependencies are outside of the home assistant container which may not have everything you need.

simple wasp
#

That mby can work I going to try this.

#

thanks

vast ferry
#

no worries, I hope you can get it working this way. its probably more stable and less likely to break during updates etc...

simple wasp
#

Its working thanks god. Thank you @vast ferry !