bazarr
bazarr copied to clipboard
Bazarr v1.1.0 not able to start on aarch64 / missing rar archive extraction utilities
Describe the bug
Bazarr v1.1.0 is not able to start on aarch64 due to missing rar archive extraction utilities. Looks like Bazarr is not able to find their own unrar
extension even if available within /opt/bazarr/bin/Linux/aarch64/unrar/unrar
To Reproduce Steps to reproduce the behavior:
- install Bazaar on ARMv8/aarch64
- try to start the service
- service is going to fail due to missing rar archive extraction
Expected behavior
Bazaar is able to find their own unrar
extension available within /opt/bazarr/bin/Linux/aarch64/unrar/unrar
Error message
root@DietPi4:~# journalctl -u bazarr.service
-- Journal begins at Thu 2022-07-14 11:36:50 CEST, ends at Thu 2022-07-14 12:07:26 CEST. --
Jul 14 12:07:03 DietPi4 systemd[1]: Started Bazarr (DietPi).
Jul 14 12:07:24 DietPi4 Bazarr[4366]: 2022-07-14 12:07:24,737 - root (7fa97a6040) : ERROR (init:209) - BAZARR requires a rar archive extraction utilities (unrar, unar) and it can't be found.
Jul 14 12:07:24 DietPi4 Bazarr[4366]: Traceback (most recent call last):
Jul 14 12:07:24 DietPi4 Bazarr[4366]: File "/opt/bazarr/bazarr/init.py", line 198, in init_binaries
Jul 14 12:07:24 DietPi4 Bazarr[4366]: exe = get_binary("unar")
Jul 14 12:07:24 DietPi4 Bazarr[4366]: File "/opt/bazarr/bazarr/utilities/binaries.py", line 73, in get_binary
Jul 14 12:07:24 DietPi4 Bazarr[4366]: raise BinaryNotFound
Jul 14 12:07:24 DietPi4 Bazarr[4366]: utilities.binaries.BinaryNotFound
Jul 14 12:07:24 DietPi4 Bazarr[4366]: During handling of the above exception, another exception occurred:
Jul 14 12:07:24 DietPi4 Bazarr[4366]: Traceback (most recent call last):
Jul 14 12:07:24 DietPi4 Bazarr[4366]: File "/opt/bazarr/bazarr/init.py", line 207, in init_binaries
Jul 14 12:07:24 DietPi4 Bazarr[4366]: rarfile.tool_setup(unrar=True, unar=False, bsdtar=False, force=True)
Jul 14 12:07:24 DietPi4 Bazarr[4366]: File "/opt/bazarr/bazarr/../libs/rarfile.py", line 3331, in tool_setup
Jul 14 12:07:24 DietPi4 Bazarr[4366]: raise RarCannotExec("Cannot find working tool")
Jul 14 12:07:24 DietPi4 Bazarr[4366]: rarfile.RarCannotExec: Cannot find working tool
Jul 14 12:07:24 DietPi4 Bazarr[4366]: During handling of the above exception, another exception occurred:
Jul 14 12:07:24 DietPi4 Bazarr[4366]: Traceback (most recent call last):
Jul 14 12:07:24 DietPi4 Bazarr[4366]: File "/opt/bazarr/bazarr/main.py", line 21, in <module>
Jul 14 12:07:24 DietPi4 Bazarr[4366]: from init import * # noqa E402
Jul 14 12:07:24 DietPi4 Bazarr[4366]: File "/opt/bazarr/bazarr/init.py", line 223, in <module>
Jul 14 12:07:24 DietPi4 Bazarr[4366]: init_binaries()
Jul 14 12:07:24 DietPi4 Bazarr[4366]: File "/opt/bazarr/bazarr/init.py", line 210, in init_binaries
Jul 14 12:07:24 DietPi4 Bazarr[4366]: raise BinaryNotFound
Jul 14 12:07:24 DietPi4 Bazarr[4366]: utilities.binaries.BinaryNotFound
Jul 14 12:07:26 DietPi4 Bazarr[4353]: Bazarr starting...
Jul 14 12:07:26 DietPi4 Bazarr[4353]: Bazarr exited.
Jul 14 12:07:26 DietPi4 systemd[1]: bazarr.service: Succeeded.
Jul 14 12:07:26 DietPi4 systemd[1]: bazarr.service: Consumed 5.597s CPU time.
root@DietPi4:~# find /opt/bazarr/ -name "unrar"
/opt/bazarr/bin/Linux/aarch64/unrar
/opt/bazarr/bin/Linux/aarch64/unrar/unrar
Software (please complete the following information):
- Bazarr: 1.1.0
Additional Info probably this is caused by https://github.com/morpheus65535/bazarr/commit/642733f92f08c64cb048372d7ce92a4bede8dc84
You can install unrar by self on your DietPi device
Why should we do this if the unrar
executable is provided by Bazarr itself? Of course it is possible to install separate unrar
package, but unnecessary overhead for a functionality that has been working using v1.0.4 bevor. Especially as /opt/bazarr/bin/Linux/aarch64/unrar/unrar
is present on the system but not detected correctly.
Probably it has something to do with https://github.com/morpheus65535/bazarr/commit/2f01ab8, although I cannot see what is wrong after https://github.com/morpheus65535/bazarr/commit/4c08180, especially since it works on x86_64
and different architectures are not really handled differently with this code 🤔. Requires debugging code, I guess.
The error actually indicates that the file is present (and found) but cannot be executed. So I checked the ELF header and indeed it is no aarch64 one:
2022-07-23 20:34:56 root@OdroidN2:~# readelf -h /opt/bazarr/bin/Linux/aarch64/unrar/unrar
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x12274
Start of program headers: 52 (bytes into file)
Start of section headers: 239348 (bytes into file)
Flags: 0x5000402, Version5 EABI, hard-float ABI, <unknown>
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 8
Size of section headers: 40 (bytes)
Number of section headers: 29
Section header string table index: 28
2022-07-23 20:35:02 root@OdroidN2:~# /opt/bazarr/bin/Linux/aarch64/unrar/unrar
bash: /opt/bazarr/bin/Linux/aarch64/unrar/unrar: No such file or directory
2022-07-23 20:35:11 root@OdroidN2:~# l /opt/bazarr/bin/Linux/aarch64/unrar/unrar
-rwxrw-r-- 1 bazarr dietpi 235K Jul 23 20:25 /opt/bazarr/bin/Linux/aarch64/unrar/unrar
2022-07-23 20:38:43 root@OdroidN2:/tmp# uname -a
Linux OdroidN2 5.10.123-meson64 #22.05.3 SMP PREEMPT Wed Jun 22 07:23:04 UTC 2022 aarch64 GNU/Linux
This "No such file or directory" error is known to be thrown by bash when the binary is for a wrong architecture. However, ARMv8 is backwards-compatible, and that binary did not change since a time where it still worked: https://github.com/morpheus65535/bazarr-binaries/blob/master/bin/Linux/aarch64/unrar/unrar
But it works on ARMv6 and ARMv7 instead:
2022-07-23 20:39:27 root@micha:/tmp# curl -LO https://github.com/morpheus65535/bazarr-binaries/raw/master/bin/Linux/aarch64/unrar/unrar
2022-07-23 20:39:46 root@micha:/tmp# chmod +x unrar
2022-07-23 20:39:51 root@micha:/tmp# ./unrar
UNRAR 5.50 freeware Copyright (c) 1993-2017 Alexander Roshal
...
2022-07-23 20:40:32 root@micha:/tmp# uname -a
Linux micha.gnoedi.org 5.15.32-v7+ #1538 SMP Thu Mar 31 19:38:48 BST 2022 armv7l GNU/Linux
2022-07-23 20:43:32 root@Amizero:/tmp# curl -LO https://github.com/morpheus65535/bazarr-binaries/raw/master/bin/Linux/aarch64/unrar/unrar
2022-07-23 20:43:45 root@Amizero:/tmp# chmod +x unrar
2022-07-23 20:43:53 root@Amizero:/tmp# ./unrar
UNRAR 5.50 freeware Copyright (c) 1993-2017 Alexander Roshal
...
2022-07-23 20:43:57 root@Amizero:/tmp# uname -a
Linux Amizero 5.15.32+ #1538 Thu Mar 31 19:37:58 BST 2022 armv6l GNU/Linux
Now I see it is identical to the ARMv5 binary: https://github.com/morpheus65535/bazarr-binaries/blob/master/bin/Linux/armv5tel/unrar/unrar
2022-07-23 20:47:41 root@OdroidN2:/tmp# curl -Lo unrar_arm https://github.com/morpheus65535/bazarr-binaries/raw/master/bin/Linux/armv5tel/unrar/unrar
2022-07-23 20:48:14 root@OdroidN2:/tmp# l
-rwxr-xr-x 1 root root 235K Jul 23 20:38 unrar
-rwxr-xr-x 1 root root 235K Jul 23 20:48 unrar_arm
2022-07-23 20:48:14 root@OdroidN2:/tmp# diff unrar unrar_arm
2022-07-23 20:48:22 root@OdroidN2:/tmp#
So I'm maximum confused and not sure what changed, probably something on Debian arm64. However, a proper aarch64 unrar binary will solve it, and the ARMv5 binary can be used on ARMv6 and ARMv7 as well.
Currently I don't see how I can deal with that on Bazarr side. The architecture is reported to be the same for all of those version.
How/on which build environment did you compile unrar
, and which sources did you use? Replacing the aarch64
binary with one that is actually compiled for aarch64
would solve the issue. I have some hardware here to do that, but compatibility with shared library versions should be preserved the way it is now to not break anything.
I didn't build it myself for sure but I don't remember how it ended there. If you can provide a binary that can be used on any aarch64 version, I would hapilly replace the actual one.
PR up: https://github.com/morpheus65535/bazarr-binaries/pull/1 Latest supported version however is Debian Buster. I have no older system quickly available. GNU C v2.28 and C++ v8.3 are hence required at least.
if the original binary is a 32bit one, why not shipping it together with Bazarr for 32bit systems?
Yes, that would be great. If you can give me a hint where architecture detection is done, I could open a PR to use the armv5tel
path for all ARM 32-bit systems, including Raspberry Pi etc.
Yes, that would be great. If you can give me a hint where architecture detection is done, I could open a PR to use the
armv5tel
path for all ARM 32-bit systems, including Raspberry Pi etc.
This is done in get_binary
function: https://github.com/morpheus65535/bazarr/blob/development/bazarr/utilities/binaries.py#L43
This one have been fixed by releasing 1.1.1.
hi, this error persists using Ubuntu 22.04 on Raspberry Pi
ubuntu@raspberrypi:/opt/bazarr$ python3 bazarr.py
Bazarr starting...
2022-10-02 17:05:11,291 - root (ffff96fae420) : ERROR (init:209) - BAZARR requires a rar archive extraction utilities (unrar, unar) and it can't be found.
Traceback (most recent call last):
File "/opt/bazarr/bazarr/init.py", line 198, in init_binaries
exe = get_binary("unar")
File "/opt/bazarr/bazarr/utilities/binaries.py", line 73, in get_binary
raise BinaryNotFound
utilities.binaries.BinaryNotFound
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/bazarr/bazarr/init.py", line 207, in init_binaries
rarfile.tool_setup(unrar=True, unar=False, bsdtar=False, force=True)
File "/opt/bazarr/bazarr/../libs/rarfile.py", line 3331, in tool_setup
raise RarCannotExec("Cannot find working tool")
rarfile.RarCannotExec: Cannot find working tool
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/bazarr/bazarr/main.py", line 22, in <module>
from init import * # noqa E402
File "/opt/bazarr/bazarr/init.py", line 223, in <module>
init_binaries()
File "/opt/bazarr/bazarr/init.py", line 210, in init_binaries
raise BinaryNotFound
utilities.binaries.BinaryNotFound
Bazarr exited.
ubuntu@raspberrypi:/opt/bazarr$ uname -a
Linux raspberrypi 5.15.0-1015-raspi #17-Ubuntu SMP PREEMPT Mon Sep 12 13:14:51 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
ubuntu@raspberrypi:/opt/bazarr$
hi, this error persists using Ubuntu 22.04 on Raspberry Pi
You can install a final build of ffmpeg. I can't bundle binaries for each an every distro and platform out there.
indeed, i thought that i had unrar
installed manually but i checked and found that it wasn't, my bad
thx for the work you do on this