mdhiggins / radarr-sma

MIT License
25 stars 13 forks source link

Build fails with apt-get not found #34

Closed ridizy closed 2 years ago

ridizy commented 2 years ago

Docker compose file contains:

    build:
      context: https://github.com/mdhiggins/radarr-sma.git#build
      args:
        - radarr_tag=nightly
        - ffmpeg_tag=snapshot-vaapi

Get the following error on docker-compose build

Step 11/17 : RUN   apt-get update &&   apt-get install -y     git     wget     python3     python3-pip     ${extra_packages} &&   mkdir ${SMA_PATH} &&   git clone https://github.com/mdhiggins/sickbeard_mp4_automator.git ${SMA_PATH} &&   python3 -m pip install --user --upgrade pip &&   python3 -m pip install --user virtualenv &&   python3 -m virtualenv ${SMA_PATH}/venv &&   ${SMA_PATH}/venv/bin/pip install -r ${SMA_PATH}/setup/requirements.txt &&   chgrp users /usr/local/bin/ffmpeg &&   chgrp users /usr/local/bin/ffprobe &&   chmod g+x /usr/local/bin/ffmpeg &&   chmod g+x /usr/local/bin/ffprobe &&   apt-get purge --auto-remove -y &&   apt-get clean &&   rm -rf     /tmp/*     /var/lib/apt/lists/*     /var/tmp/*
 ---> Running in 42f3bb45e964
/bin/sh: apt-get: not found

LinuxServer.io rebased the nightly tag to Alpine: https://info.linuxserver.io/issues/2022-02-03-radarr/

Can this be accounted for in your dockerfile?

mdhiggins commented 2 years ago

I will probably need to make a separate build container for alpine, I did already update the nightly tag for alpine but the dockerfile can't handle the conditionals

I'll see if I can come up with something

ridizy commented 2 years ago

Thank you. Looks like they are rebasing a few containers to Alpine: https://info.linuxserver.io/affected/notifications/

Not sure if this will eventually apply to other tags as well, or if it's just being done for space efficiency with the nightly builds.

mdhiggins commented 2 years ago

Just pushed an update, I already had accounted for most of this in the 90-sma-config file when I made the sma-mod so since the build dockerfile can be alpine or ubuntu I just removed most of the packages from that and will let 90-sma-config do the work

Only thing I wasn't sure of is if alpine has an equivalent package to libva-drm2 as I couldn't find one (libva2 -> libva and i965-va-driver -> libva-intel-driver)

Let me know if that works

ridizy commented 2 years ago

Thanks again. Build works now. Will have to wait for the next grab to see how the tag/conversion goes.

mdhiggins commented 2 years ago

Double check your docker logs when starting the container for the first time for any errors (from 90-sma-config) since I moved most of the container setup to occur on the first launch and they might be hiding in there and not immediately apparent

ridizy commented 2 years ago

Here's what I found...

ERROR: unable to select packages:
[90-sma-config] Installing additional hardware acceleration packages
chown: changing ownership of '/usr/local/sma/config/autoProcess.ini.bak': Operation not permitted
<<--above error repeated for every file in the directory-->>
Traceback (most recent call last):
  File "/usr/local/sma/update.py", line 8, in <module>
    from resources.readsettings import ReadSettings
ModuleNotFoundError: No module named 'resources'

I think I've always had the chown errors but it's worked fine. Not sure about the other errors

mdhiggins commented 2 years ago

Looks like it isn't doing the initial git pull, script won't work

Made a tweak, try the latest update (the permissions error looks like you have a .bak file that it cannot access, you could probably fix the ownership on that .bak or move it out of your mounted directory to make that go away)

433e2b5aaf3bcb465c11c8577689d6a0baecdf7d

ridizy commented 2 years ago

Now getting this:

ERROR: unable to select packages:
[90-sma-config] Installing additional hardware acceleration packages
[90-sma-config] Pulling SMA from github master
./90-sma-config: line 55: git: command not found
<<-- my perms errors -->>
Traceback (most recent call last):
  File "/usr/local/sma/update.py", line 8, in <module>
    from resources.readsettings import ReadSettings
ModuleNotFoundError: No module named 'resources'
mdhiggins commented 2 years ago

Alright I spun up a test container and think I have everything sorted now, try one more time

The from resources.readsettings import ReadSettings error comes from the main part of the script not being pulled from github (update.py comes from the docker container) so hopefully that's fixed now

ridizy commented 2 years ago

Looking pretty good now...

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 30-config: executing... 
[cont-init.d] 30-config: exited 0.
[cont-init.d] 50-gid-video: executing... 
groupadd: 'videozb2Z7vzD' is not a valid group name
groupmod: group 'videozb2Z7vzD' does not exist
usermod: group 'videozb2Z7vzD' does not exist
groupadd: 'videoiYiboXEP' is not a valid group name
groupmod: group 'videoiYiboXEP' does not exist
usermod: group 'videoiYiboXEP' does not exist
[cont-init.d] 50-gid-video: exited 0.
[cont-init.d] 90-custom-folders: executing... 
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 90-sma-config: executing... 
[90-sma-config] Init SMA from github master
[90-sma-config] Creating python virtual environment and installing requirements
[cont-init.d] 90-sma-config: exited 0.
[cont-init.d] 99-custom-files: executing... 
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[Info] Bootstrap: Starting Radarr - /app/radarr/bin/Radarr - Version 4.0.5.5923 
mdhiggins commented 2 years ago

Sweet, alright the build container should be universal now alpine or ubuntu, thanks for the tests

Closing this out reopen if you have any issues

ridizy commented 2 years ago

[don't have rights to reopen]

The conversion is failing. Here is the log file...

2022-02-16 14:24:24 - RadarrPostProcess - INFO - Radarr extra script post processing started.
2022-02-16 14:24:24 - resources.readsettings - INFO - /usr/local/sma/venv/bin/python3
2022-02-16 14:24:24 - resources.readsettings - INFO - Loading config file /usr/local/sma/config/
autoProcess.ini.
2022-02-16 14:24:24 - resources.mediaprocessor - ERROR - isValidSource unexpectedly threw an exc
eption, returning None.
Traceback (most recent call last):
  File "/usr/local/sma/resources/mediaprocessor.py", line 318, in isValidSource
    info = self.converter.probe(inputfile)
  File "/usr/local/sma/converter/__init__.py", line 336, in probe
    return self.ffmpeg.probe(fname, posters_as_video)
  File "/usr/local/sma/converter/ffmpeg.py", line 587, in probe
    stdout_data = self._get_stdout([
  File "/usr/local/sma/converter/ffmpeg.py", line 537, in _get_stdout
    p = self._spawn(cmds)
  File "/usr/local/sma/converter/ffmpeg.py", line 530, in _spawn
    return Popen(cmds, shell=False, stdin=PIPE, stdout=PIPE, stderr=PIPE,
  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/ffprobe'
2022-02-16 14:24:24 - resources.mediaprocessor - INFO - File /videos/Movies/SomeFile (2022)/SomeFile
 (2022).mkv is not valid
2022-02-16 14:24:24 - RadarrPostProcess - INFO - Processing returned False.
2022-02-16 14:24:24 - RadarrPostProcess - ERROR - Error processing file.
Traceback (most recent call last):
  File "/usr/local/sma/postRadarr.py", line 301, in <module>
    sys.exit(1)
SystemExit: 1

ffprobe is there but gives an error when you try to execute it:

root@50ce4818a9ca:/root# ls -l /usr/local/bin/ffprobe
-rwxr-xr-x 1 root users 133768 Apr 12  2021 /usr/local/bin/ffprobe
root@50ce4818a9ca:/root# /usr/local/bin/ffprobe
bash: /usr/local/bin/ffprobe: No such file or directory

If I switch the ffmpeg tag to ffmpeg_tag=snapshot-alpine, I get a little further, but still not looking great (not to mention I think no VAAPI). Probably related to your earlier comment.

Error loading shared library libgomp.so.1: No such file or directory (needed by /usr/local/lib/libvidstab.so.1.1)
Error relocating /usr/local/lib/libvidstab.so.1.1: omp_get_num_threads: symbol not found
Error relocating /usr/local/lib/libvidstab.so.1.1: omp_get_thread_num: symbol not found
Error relocating /usr/local/lib/libvidstab.so.1.1: omp_set_num_threads: symbol not found
Error relocating /usr/local/lib/libvidstab.so.1.1: GOMP_parallel: symbol not found
Error relocating /usr/local/lib/libvidstab.so.1.1: GOMP_critical_name_start: symbol not found
Error relocating /usr/local/lib/libvidstab.so.1.1: GOMP_critical_name_end: symbol not found
Error relocating /usr/local/lib/libvidstab.so.1.1: omp_get_max_threads: symbol not found
mdhiggins commented 2 years ago

Yeah looks like the FFMPEG build from the ubuntu containers does not work on alpine and the jrottenberg container only goes up to alpine 313 (linuxserver radarr container on 315)

The ffmpeg APK included in alpine however appears to contain VAAPI so I added some new options and this appears to be working for me. You'll need to include your hw devices and volumes etc but that's the environment variables needed

  radarr:
    image: ghcr.io/mdhiggins/radarr-sma:nightly
    container_name: radarr
    environment:
      - PUID=${PUID}
      - PGIG=${PGID}
      - TZ=${TZ}
      - SMA_USE_REPO=true
      - SMA_HWACCEL=true

7f36952f5a9cce9af11d3d65956c167ebbbb9067

Update: SMA_USE_REPO defaults to true on nightly, can leave that out on latest build

ridizy commented 2 years ago

Thank you. Rebuilt container and will test with a file later.

ridizy commented 2 years ago

So the conversion and tagging worked, but the rename failed:

2022-02-19 07:54:22 - RadarrPostProcess - ERROR - Failed to trigger Radarr renam
e.
Traceback (most recent call last):
  File "/usr/local/sma/venv/lib/python3.9/site-packages/requests/models.py", lin
e 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/sma/postRadarr.py", line 288, in <module>
    rename = renameRequest(baseURL, headers, movieinfo['movieFile']['id'], movie
id, log)
  File "/usr/local/sma/postRadarr.py", line 56, in renameRequest
    rstate = r.json()
  File "/usr/local/sma/venv/lib/python3.9/site-packages/requests/models.py", lin
e 917, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value] : 0

However, the file is named correctly. Side note, I have force-rename set to false.

mdhiggins commented 2 years ago

Hm it almost looks like the API just failed to return anything. Is it doing this for every file or was this a one off error?

If it's doing it for every file could you turn on debug logging and send a full log from postRadarr

ridizy commented 2 years ago

Looks like every file.

Here's a debug log: https://pastebin.com/bx3xhZwk

mdhiggins commented 2 years ago

Fixed in latest version of SMA