I was well on my way with my Powerunit© project until I stumbled upon a problem. I had created my GitHub repository, uploaded all scripts. Everything deems to go well, but when I installed the scrips on my Raspberry Pi© it returned the error message code=exited, status=203/EXEC. So it’s time for a thorough investigation before I can go further with my Powerunit© project.
code=exited, status=203/EXEC error message
After an extensive search, I found out what this report means, or in each case where I had to search. The error message (code=exited, status=203/EXEC) is often seen when the script itself or its interpreter cannot be executed.
It could have these reasons:
- wrong path to script (e.g. /home/py/Myscript.py)
- script not executable
- no shebang (first line)
- wrong path in shebang (e.g. /bin/python3)
- internal files in your script might be missing access permissions.
the problem
I use a MacBook Pro for checking in files into git repo. My git repo contains few shell scripts which needs to be executed on a Raspberry Pi©. In order to execute a shell script on unix/linux you need to have execute permissions on the file. Whenever you create a file the systems it gives you a read-write permissions by default to the owner of file. So here is the issue if you need to provide execute permissions to a shell script file being checked on from a Github Repository you are stuck.
I struggled with this annoying issue for a while and found the solution. you have to change the file permissions to execute and then upload the shell script file again to the Github Repository.
The solution
Most of the folks on Windows working with git repo’s use windows git bash for doing git check-ins and check-outs to/from from git repo…. if you are already not using it I will highly recommend use it… pretty neat tool for Windows OS.
Download git bash for MacOS
No Software needed! just use your Terminal on your Mac.
Download git bash for windows
Change file permissions when working with git repo’s
Open Terminal On your Mac, do one of the following Click the Launchpad icon in the Dock, type Terminal in the search field, then click Terminal. In the Finder , open the /Applications/Utilities folder, then double-click Terminal.
First we have to clone the repository.
git clone https://github.com/GIT_NAME/REPOSITORY_NAME.git
Navigate to the .sh file for which permissions have to be changed to execute through gitbash.
cd powerunit
Check the existing permissions by the using the following command.
git ls-files --stage
the command will show you the current file permissions like.
100644
Now git bash has command to update the file permission to execute looks like.
git update-index --chmod=+x 'name-of-shell-script'
Check the file permission again
git ls-files --stage
now the file permissions will be like.
100755
Now check-in the files back to github with new permissions.
git commit -m "made a file executable"
and push the code to repo.
git push --all https://github.com/GIT_NAME/REPOSITORY_NAME.git --force
That’s it! problem solved!