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

Docker image on rasp pi can't use unrar, throws error when unpacking on version 1.0.3 #10777

Open
f0xMccloud opened this issue Jun 22, 2022 · 14 comments

Comments

@f0xMccloud
Copy link

Describe the bug
Hey everyone, I'm trying to pull latest (tried with latest and master) from dockerhub on raspberry pi 4 and I get this error:
Starting medusa as root Traceback (most recent call last): File "/app/medusa/start.py", line 6, in <module> from medusa.__main__ import main File "/app/medusa/medusa/__init__.py", line 24, in <module> initialize() File "/app/medusa/medusa/init/__init__.py", line 37, in initialize _configure_guessit() File "/app/medusa/medusa/init/__init__.py", line 202, in _configure_guessit from medusa.name_parser.guessit_parser import ( File "/app/medusa/medusa/name_parser/guessit_parser.py", line 12, in <module> from medusa.logger.adapters.style import BraceAdapter File "/app/medusa/medusa/logger/__init__.py", line 53, in <module> import subliminal File "/app/medusa/ext/subliminal/__init__.py", line 11, in <module> from .core import (AsyncProviderPool, ProviderPool, check_video, download_best_subtitles, download_subtitles, File "/app/medusa/ext/subliminal/core.py", line 13, in <module> from rarfile import BadRarFile, NotRarFile, RarCannotExec, RarFile, Error, is_rarfile File "/app/medusa/ext/rarfile.py", line 3039, in <module> _check_unrar_tool() File "/app/medusa/ext/rarfile.py", line 3019, in _check_unrar_tool custom_check([ORIG_UNRAR_TOOL], True) File "/app/medusa/ext/rarfile.py", line 2911, in custom_check p = custom_popen(cmd) File "/app/medusa/ext/rarfile.py", line 2898, in custom_popen p = Popen(cmd, bufsize=0, stdout=PIPE, stdin=PIPE, stderr=STDOUT, File "/usr/local/lib/python3.10/subprocess.py", line 966, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/local/lib/python3.10/subprocess.py", line 1842, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 8] Exec format error: 'unrar'

To Reproduce
Steps to reproduce the behavior:

  1. Run docker pull pymedusa/medusa:latest (or master)
  2. docker run -p 8081:8081 pymedusa/medusa:xxxxxx
  3. See error above

Expected behavior
Run docker container from pulled image

Medusa (please complete the following information):

  • OS: [raspberry-pi-os arm64 built on debian 11]
  • Branch: [e.g. master, latest]
  • Commit: [msater: 41483b5f5da9d5a968074ba4d9e710416b46ce67312e0106f77caca964fae849
    lastest: 7a6969f5815fa7122eee43bf169936a25f7e65a39fbb57621250a81c5a293e8d]
  • Python version: [3.7]

If I'm using (maybe) the wring branch or if I'm using the wrong image for rpi don't hesitate to let me know which image should be use. I also tried from source (I'll open another issue later) which gives me another error when I want to update from 1.0.2 to 1.0.3.

Have a good day thank in advance for your advice and you help.

@p0psicles
Copy link
Contributor

p0psicles commented Jun 23, 2022

We recently started using python 3.10 for docker. But because of that we had to start building unrar our selves. But apparently this isn't going well for the arm64 image

@p0psicles
Copy link
Contributor

I think you can best switch to Linux server image until I have a workaround.

@f0xMccloud
Copy link
Author

Thank for the quick response, I'll do that.
Good job for all you've already done !

have a nice day

@p0psicles p0psicles changed the title Exec format error when pull fresh docker image Docker image on rasp pi can't use unrar, throws error when unpacking Jun 23, 2022
@p0psicles p0psicles pinned this issue Jun 23, 2022
@p0psicles
Copy link
Contributor

p0psicles commented Jun 24, 2022

@f0xMccloud would it be possible for you to run some tests? Like doing a docker exec -it <container> /bin/sh
Might need to overwrite the entrypoint if it can't start the container at all. Which might be the case

And if you can login to it, run an unrar command. Or check if it's available at all?
It should be located in /usr/bin/unrar

@p0psicles
Copy link
Contributor

btw we have other users who don't have this issue, and where unrar is working fine. So maybe try pulling the same image again. Or try pulling the develop tag?

@f0xMccloud
Copy link
Author

f0xMccloud commented Jun 25, 2022

Well, I ran some tests and my problem happens on tag v1.0.3. When I was (and when I switch) to 1.0.2 everything runs fine and I just remember that I saw my error when I was trying to update to 1.0.3 from gui or pull from github repository.
Once I cleaned up image and container, I switched to 1.0.3 and then I can't build image (tried latest, master, develop)

It seems to expect amd64 instead of arm64, this message doesn't appears in 1.0.2.

Sending build context to Docker daemon  67.01MB
Step 1/18 : FROM jlesage/alpine-abuild:3.15 AS unrar
 ---> 92b3abbc59f9
Step 2/18 : WORKDIR /tmp
 ---> Using cache
 ---> 9cbea1fd091d
Step 3/18 : RUN     mkdir /tmp/aport &&     cd /tmp/aport &&     git init &&     git remote add origin https://github.com/alpinelinux/aports &&     git config core.sparsecheckout true &&     echo "non-free/unrar/*" >> .git/info/sparse-checkout &&     git pull origin 3.15-stable &&     PKG_SRC_DIR=/tmp/aport/non-free/unrar &&     PKG_DST_DIR=/tmp/unrar-pkg &&     mkdir "$PKG_DST_DIR" &&     /bin/start-build -r &&     rm /tmp/unrar-pkg/*-doc-* &&     mkdir /tmp/unrar-install &&     tar xf /tmp/unrar-pkg/unrar-*.apk -C /tmp/unrar-install
 ---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
 ---> Running in 184b4ad6b687
exec /bin/sh: exec format error
The command '/bin/sh -c mkdir /tmp/aport &&     cd /tmp/aport &&     git init &&     git remote add origin https://github.com/alpinelinux/aports &&     git config core.sparsecheckout true &&     echo "non-free/unrar/*" >> .git/info/sparse-checkout &&     git pull origin 3.15-stable &&     PKG_SRC_DIR=/tmp/aport/non-free/unrar &&     PKG_DST_DIR=/tmp/unrar-pkg &&     mkdir "$PKG_DST_DIR" &&     /bin/start-build -r &&     rm /tmp/unrar-pkg/*-doc-* &&     mkdir /tmp/unrar-install &&     tar xf /tmp/unrar-pkg/unrar-*.apk -C /tmp/unrar-install' returned a non-zero code: 1

I used Dockerfile from repository for info.

If you want me to run some complementary tests, don't hesitate I'll be glad to help.

@p0psicles
Copy link
Contributor

i'm using this docker image. I've asked if it's possible to build an arm version.
jlesage/docker-alpine-abuild#1

@p0psicles p0psicles changed the title Docker image on rasp pi can't use unrar, throws error when unpacking Docker image on rasp pi can't use unrar, throws error when unpacking on version 1.0.3 Jun 25, 2022
@f0xMccloud
Copy link
Author

Thank you

@mauro-dellachiesa
Copy link

As a workaround until this is fixed, I mounted my host's unrar file in docker-compose.yml and Medusa seems to work fine now:

version: '3'
services:
  medusa:
    image: pymedusa/medusa:master
    volumes:
      - "./data:/config"
      - "/mnt/medusa/series:/root_dirs"
      - "/mnt/medusa/transmission/complete:/tv_download_dir"
      - "/usr/bin/unrar:/usr/bin/unrar" # <--------------- ADDED THIS!!!
    ports:
      - 8081:8081
    restart: always

Hope it helps someone else too!

@gaetan-31
Copy link

Hi @mauro-dellachiesa in my rasbian it is not possible to install unrar.
How did you do it?

I'm test to rollback on 1.0.2 by using in docker-compose :

image: pymedusa/medusa:1.0.2

But this error appear :
not found: manifest unknown: manifest unknown

It's impossible to rollback ?

Thank you

@mauro-dellachiesa
Copy link

@gaetan-31 I do not recall manually installing unrar in my rapsbian, but it looks like I have the package unrar-free installed in my system.
This is what I get when listing my installed packages with dpkg-query -l:

ii  unar                                 1.10.1-2+b4                             armhf        Unarchiver for a variety of file formats
ii  unrar-free                           1:0.0.1+cvs20140707-4                   armhf        Unarchiver for .rar files
ii  unzip                                6.0-23+deb10u2                          armhf        De-archiver for .zip files

The output of uname -a is:
Linux raspberrypi 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux

Hope that helps!

@gaetan-31
Copy link

It's work after removing /usr/bin/unrar folder and reinstalling unrar-free.
I've didn't understand why this folder exists >_<

Thank a lot

@cpainchaud
Copy link
Contributor

Hi all,

I am still having the issue today... ?

@crxed9
Copy link

crxed9 commented Jan 1, 2024

Why is this always on top of the Issue list?

image

@medariox medariox unpinned this issue Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants