FATAL: Failed to start gitlab-runner: "launchctl" failed with stderr: Load failed: 5: Input/output error

Viewed 10716

After installing and registering gitlab-runner, when I'm running gitlab-runner start I get this error message. What will be the reason for this ?

Runtime platform                                    arch=amd64 os=darwin pid=65915 revision=c1edb478 version=14.0.1
FATAL: Failed to start gitlab-runner: "launchctl" failed with stderr: Load failed: 5: Input/output error
7 Answers

I edited the /Users/USERNAME/Library/LaunchAgents/gitlab-runner.plist file and changed the location of the log files to a location writeable by my user:

<key>StandardOutPath</key>
    <string>/Users/USERNAME/.gitlab-runner/gitlab-runner.out.log</string>
<key>StandardErrorPath</key>
    <string>/Users/USERNAME/.gitlab-runner/gitlab-runner.err.log</string>

Then issued a

launchctl unload /Users/USERNAME/Library/LaunchAgents/gitlab-runner.plist
launchctl load -w /Users/USERNAME/Library/LaunchAgents/gitlab-runner.plist
gitlab-runner stop
gitlab-runner start
gitlab-runner status

And the service is up and running

For more info: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/28136

I installed with brew and getting same error when I tried

gitlab-runner start

I have to start the runner service with brew and it worked

brew services restart gitlab-runner

enter image description here

Seeming your runner running in a non-sudo, bring the gitlab-runner daemon can't write log to the path that requires sudo permission. For example, the path in my Mac OS "/usr/local/var/log/gitlab-runner.out.log".

Steps to redirect log output:

  1. gitlab-runner uninstall followed by gitlab-runner install to get a clean "plist" as a basis.
  2. Edit /Users/<username>/Library/LaunchAgents/gitlab-runner.plist, and find the two XML-keys containing output paths for log files. A good path is /Users/<username>/.gitlab-runner/<log-file-name>
  3. gitlab-runner start

cd ~

sudo chmod +x /usr/local/bin/gitlab-runner

gitlub-runner start

worked for me

Check that exist directory /usr/local/var If not, create it

Related