Why am I getting a Exec format error/script returned exit code 126 failure?

Hello, I am currently attempting to develop a jenkins pipeline that runs our Katalon test suites. I have hit a wall and cannot get past this after days of trial and nothing but error.

The error is:

 /root/jenkins/workspace/SCALE/Bluefin/Katalon_Integration_Test-2@tmp/durable-8992c595/script.sh: ./katalonc: Exec format error

and it returns this at the bottom of the console:

ERROR: script returned exit code 126
Finished: FAILURE

Just before the erroring line I run:

sh "sudo chmod -R 777 '${WORKSPACE}'"

WORKSPACE being the path to the Jenkins workspace being used. From my understanding this should give permissions to everything inside so I do not understand the 126 error. I have also tried this with the KRE folder and my test suite folder individually to the same effect.


This is coming from this command:

sh """cd 'Katalon_KRE/Katalon_Studio_Engine_Linux_64-8.5.5' ; ./katalonc -projectPath='katalon/iXKatalon.prj' -browserType='Chrome' -testSuitePath='Test Suites/WebUI/TS_Login' -apiKey='CENSORED' -orgID='CENSORED' """


I have tried hundreds of combinations of double and single quotes as well as other arguments and it won’t give any different errors except “Permission Denied” when the above Sudo chmod command isn’t run.

I am afraid that your post is difficult to understand as you did not used “code formatting”.

Please encode your code fragments with a pair of triple backticks:

You wrote:

and also

Show use the concrete full path of the Katalon_KRE and the ${WORKSPACE}, please.

Is the Katalon_KRE directory is located inside the ${WORKSPACE}?

I guess, it is not; therefore you got the error #126.

Is Katalon_KRE directory is located inside the ${WORKSPACE} ?

Yes it is. The full path is: /root/jenkins/workspace/SCALE/Bluefin/Katalon_Integration_Test-2/Katalon_KRE/Katalon_Studio_Engine_Linux_64-8.5.5

WORKSPACE is: /root/jenkins/workspace/SCALE/Bluefin/Katalon_Integration_Test-2

It is worth mentioning that I have tried the cd with and without WORKSPACE prefixed and both result in the same error. I also do encounter a ‘No such file or directory’ error if I purposefully make the path wrong.

ls command of Katalon_Integration_Test-2 which is the base folder everything is cloned into:

+ ls
.git
.github
.gitignore
Dockerfile
Katalon_KRE
README.md
api-test-config
bhyve-ha-framework
bootstrap
custom
jenkins
jenkins-refactor
jira-key-test
katalon
kvm-cluster-framework
kvm-templates
release-automation
reports-automation
security
smb.conf
[Pipeline] sh
+ pwd
/root/jenkins/workspace/SCALE/Bluefin/Katalon_Integration_Test-2
[Pipeline] sh
+ cd katalon
+ ls
.git
.gitignore
.project
Data Files
Include
Keywords
Object Repository
Profiles
Scripts
Test Cases
Test Suites
console.properties
iXKatalon.prj
readme.md
settings
+ pwd
/root/jenkins/workspace/SCALE/Bluefin/Katalon_Integration_Test-2/katalon

Here is the same for the KRE:

[Pipeline] sh
+ cd /root/jenkins/workspace/SCALE/Bluefin/Katalon_Integration_Test-2/Katalon_KRE/Katalon_Studio_Engine_Linux_64-8.5.5
+ ls
artifacts.xml
configuration
features
icon.xpm
jre
katalonc
katalonc.ini
p2
plugins
+ pwd
/root/jenkins/workspace/SCALE/Bluefin/Katalon_Integration_Test-2/Katalon_KRE/Katalon_Studio_Engine_Linux_64-8.5.5

My apologies. First time using this site. I have edited the post to hopefully make it more understandable.

You should search in Google with keyword “Exec format error” for informatin.

When I tried, I got

I have discovered it is likely because the system the pipeline is being run off of is running FreeBSD. We are in the process of getting one that runs Ubuntu. According to one of my friends who has done Jenkins work for years, this will probably fix it.