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.

I have confirmed it was FreeBSD causing the issues. We switched to Debian and the pipeline is now running and executing tests as expected.

may u explain it how to switched freebsd pipeline to debian pipeline

The server (node) that the job was executing on was a FreeBSD system. We got a new server that is running Debian 11 to host our VMs. We use a VM on said server running on Debian 11 as a Jenkins node that contains the KRE and executes the tests. I am not sure what the exact issue is but from one of my friends who has been using Jenkins and Unix OS’s for a long time, it is something to do with how FreeBSD handles bash.

I hope, you and your friends knows that, BSD is not Linux:

ref: Exploring the Evolution and Diversity of Unix BSD and Linux.

Aside of that, as shown into the docs, Katalon for Linux it is mainly tested on Ubuntu only:

Note:

Our Katalon team has tested Katalon Studio for Linux on Ubuntu Linux.

On anything else, it may work or not.
So, you should be happy that it is working on Debian, at least.

Yes I am aware. This is why we aren’t using it anymore.

It is working well on Debian. I appreciate the heads up about Ubuntu. If it starts having issues we will change to that.

personally i am using katalon studio (ui part) on fedora and it is working fine.
so, chances are, on certain Centos releases may work fine also.
Note that I am not using KRE as i don’t have a licence for it, but you cand consider it for your pipelines, depending on your company policies
so you have some room to play in the Linux family.

BSD is a different animal, starting from the kernel.
I don’t have anymore the patience to play with, could be fun but can lead to darksides. so i am avoiding it for now (i have played with such in the past but those days i don’t have a strong use case for it)