Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exec Error on External Filter (ARM64) #1865

Closed
desi76 opened this issue Dec 8, 2024 · 5 comments
Closed

Exec Error on External Filter (ARM64) #1865

desi76 opened this issue Dec 8, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@desi76
Copy link

desi76 commented Dec 8, 2024

** Autobrr Version**
1.52.0

Describe the bug
I'm running autobrr on Docker, on Ubuntu Linux, on an ARM64 SBC, using a shell script in an external filter to calculate free space and fail the filter if free space < 100 GB. The external filter is failing with the logged error:

(Television) external filter check error error="error executing external command: fork/exec /config/freespace.sh: exec format error"= method=CheckFilter module=filter stack=[{"func":"(*service).RunExternalFilters","line":"564","source":"service.go"},{"func":"(*service).CheckFilter","line":"451","source":"service.go"},{"func":"(*service).processFilters","line":"205","source":"service.go"},{"func":"(*service).Process","line":"182","source":"service.go"},{"func":"goexit","line":"1223","source":"asm_arm64.s"}]

The script is set as executable and I've set CHOWN to assign the script with the container's PUID / PGID. I can run the shell script successfully when logged into autobrr's container.

To Reproduce
Run:
/config/freespace.sh as external filter.

Result (when executed manually, in container):
More than 100 GB of storage space is available. Free Space: 355.5G GB

Expected behavior
Expecting successful execution of shell script and filter.

Screenshots
Image

Desktop (please complete the following information):

  • OS: Linux SHADE 5.4.180 #1.5 SMP PREEMPT Tue Apr 25 16:40:09 CST 2023 aarch64 aarch64 aarch64 GNU/Linux. Ubuntu 22.04.5 LTS
  • Docker: 27.3.1, build ce12230

Additional context
Shell script:

set -e

reqSpace=10000000 # 100GB
SPACE=$(df "/Media" | awk 'END{print $4}')
if [ "$SPACE" -le $reqSpace ]
then
  SPACE=$(df -kh . | tail -n1 | awk '{print $4}')
  echo "Less than 100 GB of storage space is available."
  echo "Free Space: $SPACE GB"
  exit 1
fi

if [ "$SPACE" -gt $reqSpace ]
then
  SPACE=$(df -kh . | tail -n1 | awk '{print $4}')
  echo "More than 100 GB of storage space is available."
  echo "Free Space: $SPACE GB"
  exit 0
fi

Docker Compose:

autobrr:
container_name: autobrr
image: ghcr.io/autobrr/autobrr:latest
network_mode: bridge
restart: unless-stopped
# logging:
# driver: json-file
# options:
# max-file: ${DOCKERLOGGING_MAXFILE}
# max-size: ${DOCKERLOGGING_MAXSIZE}
# user: 1000:1000
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ=${TZ}
- AUTOBRR__LOG_PATH="/log"
- AUTOBRR__LOG_MAX_SIZE=64 # string/int without MB
- AUTOBRR__LOG_MAX_BACKUPS=7
- AUTOBRR__LOG_LEVEL=INFO
volumes:
- ${CONF}/autobrr/:/config
- ${LOGS}/autobrr/:/log
- ${MEDIA}:/Media
ports:
- 7474:7474

@desi76 desi76 added the bug Something isn't working label Dec 8, 2024
@zze0s
Copy link
Collaborator

zze0s commented Dec 8, 2024

Hi! Did you skip the header of the script here or is it missing? The container only has sh, no full bash so you need to have it as

#!/bin/sh

set -e

reqSpace=10000000 # 100GB
SPACE=$(df "/Media" | awk 'END{print $4}')
if [ "$SPACE" -le $reqSpace ]
then
  SPACE=$(df -kh . | tail -n1 | awk '{print $4}')
  echo "Less than 100 GB of storage space is available."
  echo "Free Space: $SPACE GB"
  exit 1
fi

if [ "$SPACE" -gt $reqSpace ]
then
  SPACE=$(df -kh . | tail -n1 | awk '{print $4}')
  echo "More than 100 GB of storage space is available."
  echo "Free Space: $SPACE GB"
  exit 0
fi

Also make sure it has executable permissions chmod x freespace.sh

@desi76
Copy link
Author

desi76 commented Dec 14, 2024

Hi! Did you skip the header of the script here or is it missing? The container only has sh, no full bash so you need to have it as

#!/bin/sh

set -e

reqSpace=10000000 # 100GB
SPACE=$(df "/Media" | awk 'END{print $4}')
if [ "$SPACE" -le $reqSpace ]
then
  SPACE=$(df -kh . | tail -n1 | awk '{print $4}')
  echo "Less than 100 GB of storage space is available."
  echo "Free Space: $SPACE GB"
  exit 1
fi

if [ "$SPACE" -gt $reqSpace ]
then
  SPACE=$(df -kh . | tail -n1 | awk '{print $4}')
  echo "More than 100 GB of storage space is available."
  echo "Free Space: $SPACE GB"
  exit 0
fi

Also make sure it has executable permissions chmod x freespace.sh

It looks like I missed the shell script header. I'll update it and advise.

@zze0s
Copy link
Collaborator

zze0s commented Dec 16, 2024

@desi76 How did it go?

@desi76
Copy link
Author

desi76 commented Dec 16, 2024

For unrelated reasons, my SBC suffered a catastrophic failure. I think Docker updated and now it won't start. I'll update you when I can.

@desi76
Copy link
Author

desi76 commented Dec 24, 2024

@desi76 How did it go?

@zze0s Including the shell script header resolved the error. Thank you.

@desi76 desi76 closed this as completed Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants