[SOLVED] [Errno 8] Exec format error while running par2_rep

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
dirkonline
Newbie
Newbie
Posts: 18
Joined: February 12th, 2017, 4:09 am

[SOLVED] [Errno 8] Exec format error while running par2_rep

Post by dirkonline »

Hi,

I am running on a QNAP 431+ (ARM) with the last QNAP OS 4.3.x SAB based on the Master Branch and using the nzbToMedia scripts by Clinton Hall for post processing: https://github.com/clinton-hall/nzbToMedia
Version: 2.0.1 [be5bebb]
Uptime: 2h
Config File: /share/CACHEDEV1_DATA/.qpkg/SABnzbdplus/config/config.ini
Parameters: SABnzbd.py --daemon --browser 0 --config-file /share/CACHEDEV1_DATA/.qpkg/SABnzbdplus/config/config.ini --pidfile /tmp/SABnzbdplus.pid
Python Version: 2.7.13 (default, Apr 24 2017, 15:48:45) [GCC 6.3.0] [UTF-8]
OpenSSL: OpenSSL 1.0.2k 26 Jan 2017 [TLS v1.2, TLS v1.1, TLS v1]
Also:
Entware-3x (standard)
Git v2.12.2
Python v2.7.13
SABYenc v3.0.2
the single-thread par2
Cryptography v1.5.1


Are you using IPV6? (no)
Is the issue reproducible? (no) but happens frequently

On occasion, but not always, I will get this during unpacking within SAB

Code: Select all

2017-05-25 12:33:25,482::INFO::[postproc:649] Running verification and repair on set <HASH>ae59572
2017-05-25 12:33:25,491::INFO::[newsunpack:1844] Cannot Quick-check missing file yay.r31!
2017-05-25 12:33:25,492::INFO::[newsunpack:1844] Cannot Quick-check missing file yay.r30!
2017-05-25 12:33:25,501::INFO::[newsunpack:1844] Cannot Quick-check missing file yay.r20!
2017-05-25 12:33:25,520::INFO::[newsunpack:1844] Cannot Quick-check missing file yay.r75!
2017-05-25 12:33:25,527::INFO::[newsunpack:1844] Cannot Quick-check missing file yay.r63!
2017-05-25 12:33:25,546::INFO::[newsunpack:1844] Cannot Quick-check missing file yay.r04!
2017-05-25 12:33:25,547::INFO::[newsunpack:1844] Cannot Quick-check missing file yay.r06!
2017-05-25 12:33:25,551::INFO::[__init__:929] /share/USBDisk1/****************************/__ADMIN__/__renames__ missing
2017-05-25 12:33:25,559::INFO::[newsunpack:1055] Scanning "/share/USBDisk1/****************************/<HASH>ae59572.par2"
2017-05-25 12:33:25,652::ERROR::[newsunpack:1082] Error [Errno 8] Exec format error while running par2_repair on set <HASH>ae59572
2017-05-25 12:33:25,653::INFO::[newsunpack:1083] Traceback: 
Traceback (most recent call last):
  File "/share/CACHEDEV1_DATA/.qpkg/SABnzbdplus/SABnzbdplus/sabnzbd/newsunpack.py", line 1060, in par2_repair
    setname, joinables, single=single)
  File "/share/CACHEDEV1_DATA/.qpkg/SABnzbdplus/SABnzbdplus/sabnzbd/newsunpack.py", line 1210, in PAR_Verify
    par2text = run_simple([command[0], '-h'])
  File "/share/CACHEDEV1_DATA/.qpkg/SABnzbdplus/SABnzbdplus/sabnzbd/newsunpack.py", line 2104, in run_simple
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/opt/lib/python2.7/subprocess.py", line 390, in __init__
  File "/opt/lib/python2.7/subprocess.py", line 1024, in _execute_child
OSError: [Errno 8] Exec format error
2017-05-25 12:33:25,696::INFO::[postproc:719] Verification and repair finished for ****************************
2017-05-25 12:33:25,706::INFO::[misc:892] Creating directories: /share/Download/sabnzbd/complete/****************************
2017-05-25 12:33:25,748::INFO::[postproc:388] Running unpack_magic on ****************************
2017-05-25 12:33:25,813::INFO::[newsunpack:248] Unrar starting on /share/USBDisk1/****************************
2017-05-25 12:33:25,823::INFO::[newsunpack:473] Extracting rarfile /share/USBDisk1/****************************/yay.rar (belonging to yay) to /share/Download/sabnzbd/complete/_UNPACK_****************************
2017-05-25 12:33:39,750::WARNING::[newsunpack:653] ERROR: unable to find "yay.r04"
2017-05-25 12:33:39,923::INFO::[newsunpack:252] Unrar finished on /share/USBDisk1/****************************
2017-05-25 12:33:39,924::INFO::[postproc:393] unpack_magic finished on ****************************
I googled that error but none of the links, including what I found in here, really helped me as it only happens sometimes not all the time.
Last edited by dirkonline on June 8th, 2017, 9:44 am, edited 1 time in total.
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: Error [Errno 8] Exec format error while running par2_rep

Post by sander »

"Error [Errno 8] Exec format" can happen for the following reasons:

1) shell script without a shebang (like #!/bin/sh) at the beginning
2) trying to run a binary meant for another platform. See down below.

So ... your par2 and/or par2_repair are the suspects, especially as you're on ARM ... possibly you installed x86-versions of par2. To find out, run commands like this for par2 and par2_repair:

Code: Select all

sander@Stream-13:~$ par2 | head -1
Not enough command line arguments.
par2cmdline version 0.4, Copyright (C) 2003 Peter Brian Clements.


sander@Stream-13:~$ which par2
/usr/bin/par2

sander@Stream-13:~$ file /usr/bin/par2
/usr/bin/par2: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=90dcecba00e639720e1f0be676d26e0ca7843609, stripped





For reference:

Case 1: shell script, with x-bit, without she-bang:

Code: Select all

sander@Stream-13:~/os_exec$ echo "echo Hello" > a
sander@Stream-13:~/os_exec$ chmod +x a
sander@Stream-13:~/os_exec$ ./a 
Hello
sander@Stream-13:~/os_exec$ 
Looks good, but not when called from Python:

Code: Select all

>>> os.execl('./a', './a')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/os.py", line 314, in execl
    execv(file, args)
OSError: [Errno 8] Exec format error


Case 2: Mismatching CPU/Architecture:

On my x86_64 trying to run an ARM binary, I get:

Code: Select all

$ file unrar-5.3.7-arm 
unrar-5.3.7-arm: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.26, BuildID[sha1]=9d61be580c7b6bb29ecc4fce4d74345d05889d35, stripped

Code: Select all

>>> os.execl('./unrar-5.3.7-arm', './unrar-5.3.7-arm')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/os.py", line 314, in execl
    execv(file, args)
OSError: [Errno 8] Exec format error
... which is litterally from the OS (in this case: trying to execute an ARM binary on x86):

Code: Select all

sander@haring:~$ ./par2-arm
-bash: ./par2-arm: cannot execute binary file: Exec format error
dirkonline
Newbie
Newbie
Posts: 18
Joined: February 12th, 2017, 4:09 am

Re: Error [Errno 8] Exec format error while running par2_rep

Post by dirkonline »

Cheers! I will have a look and give feedback once I have some more conclusive information. The script is the one the comes built in sab if I am not mistaken so I would not think that is an issue. Thanks for the pointers!
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: Error [Errno 8] Exec format error while running par2_rep

Post by sander »

dirkonline wrote:Cheers! I will have a look and give feedback once I have some more conclusive information.
Why not execute the three commands I gave you? You can't get any more conclusive information than that.
dirkonline
Newbie
Newbie
Posts: 18
Joined: February 12th, 2017, 4:09 am

Re: Error [Errno 8] Exec format error while running par2_rep

Post by dirkonline »

Oh I did, @Sander I just only got back home yesterday as I was away for a few days:

So you were absolutely correct. It seems the Par2 Version that was supposed to be compiled for X41 (ARM) Qnaps contains the Intel version:

Code: Select all

[~] #  file /usr/bin/par2
/usr/bin/par2: symbolic link to /share/CACHEDEV1_DATA/.qpkg/Par2cmdline-MT/bin/par2
[~] #
[~] # file /share/CACHEDEV1_DATA/.qpkg/Par2cmdline-MT/bin/par2
/share/CACHEDEV1_DATA/.qpkg/Par2cmdline-MT/bin/par2: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for GNU/Linux 2.6.18, BuildID[sha1]=7cc4fc1414986a21aa2c2595101761ede4bd1e54, not stripped
[~] #
So OneCD over on the Qnap Forums jumped in and lent a hand:

Code: Select all

So I downloaded and extracted everthing from Stephane's x41 QPKG for Par2cmdline-mt and found:
CODE: SELECT ALL
~/Download/Par2cmdline-MT_0.6.14-MT_arm-x41.qpkg/Par2cmdline-MT_0.6.14-MT_arm-x41/bin$ file par2
par2: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for GNU/Linux 2.6.18, BuildID[sha1]=7cc4fc1414986a21aa2c2595101761ede4bd1e54, not stripped
... and it looks like it's been compiled for the wrong arch.

Let's compare it against one of Stephane's other x41 QPKGs:
CODE: SELECT ALL
~/Download/Gotty_1.0.0_arm-x41$ file gotty 
gotty: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped
So I reached out to the maintainer of the QPK and have asked him to kindly check the version for ARM if he accidentally compiled the Intel version. You were spot on and thank you for pointing me in the proper direction! I am sure this will be sorted out in no time.
dirkonline
Newbie
Newbie
Posts: 18
Joined: February 12th, 2017, 4:09 am

Re: Error [Errno 8] Exec format error while running par2_rep

Post by dirkonline »

Hi, the maintainer uploaded a new version which was compiled for the right Arch.

Code: Select all

[/share/Public] #
[/share/Public] # par2 -V
par2cmdline-mt version 0.6.14-mt1
[/share/Public] # which par2
/usr/bin/par2
[/share/Public] # file /usr/bin/par2
/usr/bin/par2: symbolic link to /share/CACHEDEV1_DATA/.qpkg/Par2cmdline-MT/bin/par2
[/share/Public] # file /share/CACHEDEV1_DATA/.qpkg/Par2cmdline-MT/bin/par2
/share/CACHEDEV1_DATA/.qpkg/Par2cmdline-MT/bin/par2: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=9f819292bd9ef356b783a7b5854fa51036911cbd, not stripped
Thank you once again, for pointing me in the right direction
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: Error [Errno 8] Exec format error while running par2_rep

Post by sander »

Cool. Thanks for sharing.
Post Reply