Unable to Register Gitlab Runner

I am trying to set up a simple Gitlab runner on one of my projects on my Gitlab server (not Gitlab.com), but when I run sudo gitlab-ci-multi-runner register I get back:

ERROR: Registering runner... failed                 runner=<token> status=401 Unauthorized
PANIC: Failed to register this runner. Perhaps you are having network problems 

I am not having network problems - I can ping and SSH to the Gitlab server from the runner’s machine.
The Gitlab server has a valid certificate, not a self-signed one.
I am trying to set up a private runner, the token comes from https://my-gitlab-server/my-project/settings/ci_cd.
The CI URL from the same page is: https://my-gitlab-server/ci
In the server-side logs, I see the 401 returned, but there’s no information about why it’s a 401:

==> /var/log/gitlab/gitlab-rails/production.log <==
Started POST "/api/v4/runners" for <runnerip> at 2017-03-23 13:18:04 -0600

==> /var/log/gitlab/gitlab-workhorse/current <==
2017-03-23_19:18:04.37172 <gitlab server> @ - - [2017-03-23 13:18:04.366723579 -0600 MDT] "POST /api/v4/runners HTTP/1.1" 401 30 "" "gitlab-ci-multi-runner 9.0.0 (9-0-stable; go1.7.5; linux/amd64)" 0.004886

==> /var/log/gitlab/nginx/gitlab_access.log <==
<runnerip> - - [23/Mar/2017:13:18:04 -0600] "POST /api/v4/runners HTTP/1.1" 401 30 "-" "gitlab-ci-multi-runner 9.0.0 (9-0-stable; go1.7.5; linux/amd64)"

==> /var/log/gitlab/gitlab-rails/production.log <==
Started POST "/ci/api/v1/builds/register.json" for 134.253.210.47 at 2017-03-23 13:18:04 -0600

The Gitlab server is Gitlab CE 8.17.2 (omnibus) running on Ubuntu 16.04.
The Gitlab runner is version 9.0.0, running on Ubuntu 14.04.

Any ideas about what I’m doing wrong?

I had exactly the same with Gitlab 8.16.x and three already registered runners a while back. Issue solved itself after some hours. Try restarting Gitlab and your runner server.

Tried restarting both, sadly nothing changed. I’ll try again another day, but I’m still open to other troubleshooting suggestions.

I got the same issue. I’m using both gitlab and gitlab-runner on docker.
Gitlab works perfect on docker but when I run gitlab-runner register, I get the same error, 401 Unauthorized.

Had same issue, downgraded gitlab-ci-multi-runner to 1.11.1 and everything worked as expected.

3 Likes

same issue. solved with v1.11.1 tag

Thanks, this solved my problem. That’s such an odd version number jump, I wonder if something was misdeployed.

Good call, thank you. Fixed on RHEL/CentOS7 by running: sudo yum install gitlab-ci-multi-runner-1.11.1-1.x86_64

@eadmin indeed, something seems amiss in the overnight jump from version 1.x to 9.x — perhaps this corresponds to the latest GitLab version 9.0, while the previous GitLab 8.x versions must use runner versions 1.x.

1 Like

For the ubuntu/debian/apt folks,

sudo apt-get install gitlab-ci-multi-runner=1.11.1
1 Like

Thx, this was due to our gitswarm uses GitLab 8.3 which is compatible with 1.11.1 only and not latest one.
Solved my problem installing tag v1.11.1 instead of latest as described here:
https://docs.gitlab.com/runner/install/bleeding-edge.html#download-any-other-tagged-release

For macOS:
sudo curl --output /usr/local/bin/gitlab-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v1.11.1/binaries/gitlab-ci-multi-runner-darwin-amd64

3 Likes

Had a same issue downgraded gitlab-ci-multi-runner to 1.11.1 and still facing the same issue ,could you please exact solution for this issue.

most probably you have wrong registration token. check it