Runner Not running as service

I just recently installed gitlab and went to go deploy runners. I created a runner and followed the steps to try to get it to run as a service. The service is running and it says it loads the config and initializing executor. Yet with the service running it doesn’t pull jobs. I can have it pull jobs when executing gitlab-runner run, but not as a service. Any guidance would be appreciated

OS: Ubuntu 22.04.3. LTS

uname -ar: Linux dockerrunner 5.15.0-83-generic #92-Ubuntu SMP Mon Aug 14 09:30:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

gitlab-runner verify:
Runtime platform arch=amd64 os=linux pid=2206 revision=8ec04662 version=16.3.0
WARNING: Running in user-mode.
WARNING: The user-mode requires you to manually start builds processing:
WARNING: $ gitlab-runner run
WARNING: Use sudo for system-mode:
WARNING: $ sudo gitlab-runner…

Verifying runner… is valid

You need to register the Runner in your GitLab intance - Registering runners | GitLab

I did, It can accept jobs when doing gitlab-runner run.
Its not running as a service in the background

Do you use tags, or if you left tags empty you need to make sure that “Run untagged jobs” is checked in UI (or use --run-untagged when registering in CLI). You can read more about tags in docs

I encountered same behaviour which looks like regression to me. I’d been using gitllab-runner for 5+ years, and it never required any extra steps to be set up as a service (i.e. background running task) on Ubuntu. Yesterday I installed runner on a new instance and whenever I run it (as per docs) via gitlab-runner run it stays in foreground, i.e. will I need to either manually run it via cron @reboot or add & to send to background or use any other kludge of the day, while I never had to do such extra steps with previous versions.

Just do:

systemctl enable gitlab-runner
systemctl restart gitlab-runner

why would you jump through hoops to do it in cron, when you can just enable the service? If you are using runners that were 5+ years old that worked differently, it’s obvious that things change for the better. It’s called progress and moving things forward.

Also, using things like /etc/rc.local which was possible in the past and a normal method when there was no service config, is being deprecated (some distros still support it at least for now).

1 Like

I followed this steps to install it and there isn’t a comment to do systemctl enable gitlab-runner, this command do what is expected and in the past it was on there in the documentation I think, I hope someone add it to that section or somewhere.

I solved this. Looking at the service file it showed by default it uses the config in /etc/gitlab~runner/config.toml. That config doesnt have the connection info or any auth or actual configuration. The actual config exists in ~/.gitlab-runner/config.toml. So you have to uninstall the service and reinstall it giving the arguments to point it to the home directory config of the user you used to create the service. This is what fixed it for me. When I checked the contents of /etc/gitlab-runner/config.toml there was nothing really. I looked at ~/.gitlab-runner/config.toml and there was all the information

I solved this issue, Check the solved response

sorry, but can you show me how you changed the config.toml file, because I can’t find the folder in any way .gitlab-runner