actions / runner

The Runner for GitHub Actions :rocket:
https://github.com/features/actions
MIT License
4.8k stars 944 forks source link

Github action runner svc start not working on MacOS Monterey #1959

Open c3-kaspesi opened 2 years ago

c3-kaspesi commented 2 years ago

Describe the bug

Trying to set up a self-hosted github actions runner as a service so it launches on startup. Currently am getting

starting actions.runner.X
Load failed: 5: Input/output error
Try running `launchctl bootstrap` as root for richer errors.
status actions.runner.X:
/Users/ec2-user/Library/LaunchAgents/actions.runner.X.plist
Stopped

To Reproduce Steps to reproduce the behavior:

  1. Configure action runner with ./config.sh
  2. Install the service with ./svc.sh install (Successful)
  3. Start the service with ./svc.sh start

Expected behavior Service starts and can be seen running: launchctl list | grep X

Runner Version and Platform

Version of your runner? Latest 2.293

OS of the machine running the runner? OSX/Windows/Linux/... MacOS Monterey

What's not working?

Service Starting

Workaround:

I can get the runner started by running: sudo chown root:wheel /Users/ec2-user/Library/LaunchAgents/actions.runner.X sudo launchctl bootstrap system ~/Library/LaunchAgents/actions.runner.c3-e-c3vsce.GAR-5.plist Though this is installing the runner in the system domain instead of the user, and the service does not start on restart.

asenyaev commented 2 years ago

I've faced the same issue today on my 2 different devices with macOS (x86_64 and ARM64).

In addition, if to run the command which starts a service in svc.sh:

launchctl load -w /Users/<user>/Library/LaunchAgents/actions.runner.<organization>.<runner_name>.plist

echo $?
134

it doesn't show anything, but the exit code is 134.

I use 2.294.0 version of Actions Runner.

asenyaev commented 2 years ago

Found the source of this issue and a solution - launchd can't load user's services until it logs in via GUI, that's why need to login under the certain user via GUI. In addition, auto login feature can help in that case.

F-WRunTime commented 2 years ago

Does Mac have a method to remote log into the GUI? We do not have easy access to the hardware. Any recommendations? I am having this same issue. Notably our M1 regularly cycles between online and offline when connected to github. Is there a networking configuration change needed in order to fix connectivity and stay online for extended period of time?

bash-3.2$ ./svc.sh install
Creating launch runner in /Users/github-runner/Library/LaunchAgents/actions.runner.<ORG>.<RUNNER>.plist
Failed: error: exists /Users/github-runner/Library/LaunchAgents/actions.runner.<ORG>.<RUNNER>.plist
c3-kaspesi commented 2 years ago

You need to remote login via vnc and then enable Automatic Login to the account you are using in system preferences, under User & Groups -> Login Options. Now next time the machine turns on GUI should be enabled on that account.

F-WRunTime commented 2 years ago

You need to remote login via vnc and then enable Automatic Login to the account you are using in system preferences, under User & Groups -> Login Options. Now next time the machine turns on GUI should be enabled on that account.

Quite painful to get VNC up and running when remote management is enabled as I have now learned :smile:

Once enabled though only way to get the service properly installed without error was to run through the UI on the desktop terminal session. NOT from a remote terminal.

Now the service says it's "started" but it's not connecting. I think this needs some work still. Trying the workaround into the system domain as mentioned in issue body. Will update for more detail to GH.

F-WRunTime commented 2 years ago

After some messing around I'm still not able to get this to work. I tried what was mentioned in the post and my results end up with an error code: 78 -> This seems to mean permissions error but from looking at the info it be running the service as my user? Or is it the system User?

Back to having to run this in the GUI it seems. No luck with the service side. Help if anyone has any suggestions!

richstokes commented 1 year ago

I think this is the same issue as this https://github.com/actions/runner/issues/1056

Same problem on MacOS Ventura, FWIW

tcptps commented 1 year ago

@F-WRunTime would you mind to take a look at my Example (the spoiler) in https://github.com/actions/runner/issues/947#issuecomment-1436032205 and maybe trie if that works for you as well, I'd be very thankfull.

aaroncforme commented 7 months ago

If you're setting up your self-hosted runner for the first time (meaning you haven't ran any jobs on it yet), here's what I did to resolve the issue:

  1. Navigate to the actions-runner directory
  2. Uninstall the service: ./svc.sh uninstall
  3. Turn the runner on manually: ./run.sh
  4. Run any workflow in your repository that will use your self-hosted runner. After doing so, you should see a _work/ directory under your actions-runner directory. The job doesn't have to run successfully; all you need it to do is set up the _work/ folder. Also, check to see if your self-hosted runner's status is connected under Settings -> Runners.
  5. Turn off the runner manually: crtl + c
  6. Re-follow the steps to configure the self-hosted runner as a service (instructions).
Koston411 commented 1 week ago

I had the same problem, I reinstalled the runner in ~/actions-runner. I then followed these instructions