Gitlab Shell check failed "401 Unauthorized" to call API
Closed
Gitlab Shell check failed "401 Unauthorized" to call API
Created by: MiguelAngelLV
I installed 7.1, restore backup and update to 7.4
All works fine unless the push that return "access denied".
I check the instalation:
miguel@Server:/home/git/gitlab$ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...
Git configured for git user? ... yes
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 2.1.0 ? ... FAIL. Please update gitlab-shell to 2.1.0 from 2.0.1
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
Satellites access is drwxr-x---? ... yes
hooks directories in repos are links: ...
Wimu_src / Quidgets ... ok
Miguel Ángel / Quidgets JS ... ok
victor / wimu ... ok
Seego / SeegoSign ... ok
Miguel Ángel / Seego Cloud ... ok
Miguel Ángel / Rutas Alpujarra ... ok
Experimedia / PortalWeb ... ok
Salva / viyou ... ok
Wimu_src / web_wimu ... ok
Wimu_src / Dwimu ... ok
Wimu_src / Sensor_GPS ... ok
Experimedia / DAPS ... ok
Wimu_src / Sensor_DCM ... ok
Wimu_src / Sensor_AcelT ... ok
Wimu_src / Sensor_Acel ... ok
Wimu_src / Sensor_Weese_ANT ... ok
Wimu_src / Sensor_Weese_UDP ... ok
Wimu_src / Wimu_logger_ST ... ok
Wimu_src / Sensor_SDM_ANT ... ok
Wimu_src / Sensor_MOXY ... ok
Wimu_src / Sensor_HRM ... ok
Wimu_src / Sensor_Bike_sp-cad ... ok
Wimu_src / Sensor_Bike_power ... ok
Wimu_src / Sensor_barometer ... ok
Wimu_src / Sensor_fuerza ... ok
Wimu_src / Sensor_Magneto ... ok
Viyou / Viyou - Dart ... ok
Viyou / Viyou - Modulo Moodle ... ok
Viyou / Viyou - Theme ... ok
Wimu_src / Sensor_Salto ... ok
Wimu_src / Sensor_Pulsador_down ... ok
Wimu_src / Sensor_Pulsador_up ... ok
Viyou / Viyou - VTT ... repository is empty
Wimu_src / Sensor_RR_clasif ... ok
Miguel Ángel / Service Discover ... ok
Wimu_src / Config_GPS_ubx ... ok
Wimu_src / IMU_Flash ... ok
Wimu_src / Sensor_Status ... ok
Experimedia / DOC ... repository is empty
Seego / Seego Software ... ok
Seego / Seego Android ... ok
Wimu_src / Sensor_Pulsador_ANT ... ok
Wimu_src / Sensor_Env_ANT ... ok
Wimu_src / Sensor_Wisee ... ok
Experimedia / SportWis ... ok
Wimu_src / Sensor_Rango_Canal ... ok
Wimu_src / Sensor_Gyro ... ok
Wimu_src / Wimu_client_TCP ... ok
Wimu_src / Sensor_GPS_SP-dist ... ok
Wimu_src / Sensor_Contador_Reset ... ok
Wimu_src / Test-ANT-Mode ... ok
Seego / SeegoCloud ... ok
Wimu_src / Sensor_Peso_ANT ... ok
Wimu_src / Sensor_Acel_ST ... ok
Wimu_src / Sensor_Acel_MPU9150 ... ok
Wimu_src / Sensor_Acel_LIS331H ... ok
Wimu_src / Sensor_Magneto_Float ... ok
FiWare / DOC ... repository is empty
Jose / quiko ... repository is empty
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: FAILED. code: 401
gitlab-shell self-check failed
Try fixing it:
Make sure GitLab is running;
Check the gitlab-shell configuration file:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
Please fix the error above and rerun the checks.
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ...
[.... All fine]
Redis version >= 2.0.0? ... yes
Ruby version >= 2.0.0 ? ... yes (2.1.2)
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.9.1)
Checking GitLab ... Finished
Seen the problem is Gitlab Shell, that API return error 401
The log show:
E, [2014-11-06T10:16:12.547241 #14840] ERROR -- : API call <GET http://192.168.2.123/gitlab/api/v3/internal/check> failed: 401 => <{"message":"401 Unauthorized"}>.
Is a Ubuntu 14.04 with manual instalation
Created by: z0mt3c
https://github.com/gitlabhq/gitlabhq/blob/master/doc/update/7.4-to-7.5.md didn't mention about any gitlab-shell updates.... i checked out the latest tag v2.3.1 and my issue was solved:
cd /home/git/gitlab-shell sudo -u git -H git fetch sudo -u git -H git checkout v2.3.1
By Administrator on 2014-11-19T15:04:41 (imported from GitLab project)
Created by: simonzack
I'm getting the exact same problem, but I'm using the latest versions, including gitlab shell v2.3.1. I've triple checked my configuration and definitely can access the host name on the local machine, set
gitlab_url
, and the html pages on the local and remote machines can be accessed fine, but still getting this error.By Administrator on 2014-11-24T04:33:10 (imported from GitLab project)
Created by: simonzack
Found the problem by debugging ruby, good thing the rb files can be updated directly. Turns out my
.gitlab_shell_secret
file was different in thegitlab
andgitlab-shell
directories, resulting ingitlab-shell
loading the wrong one which isn't authorized bygitlab
.By Administrator on 2014-11-24T06:50:41 (imported from GitLab project)
Created by: jacobvosmaer
@Razer6 I am not sure what needs to be done here.
- gitlab 7.4 requires gitlab-shell 2.0.1, as did gitlab 7.3;
- gitlab 7.5 requires gitlab-shell 2.2.0;
- the 7.4-to-7.5 update guide mentions updating gitlab-shell
I don't understand why using gitlab-shell 2.3.1 with gitlab 7.5 helped @MiguelAngelLV, that is the wrong gitlab-shell version as far as I can tell.
The problem of @simonzack would not happen when
gitlab-shell/.gitlab_shell_secret
is a symlink togitlab/.gitlab_shell_secret
, which should have been the case.By Administrator on 2014-11-24T08:58:58 (imported from GitLab project)
Created by: netrix
Hi,
I have similar problem with 401. I have gitlab installed on arch.
I use versions:
System information System: Current User: gitlab Using RVM: no Ruby Version: 2.1.5p273 Gem Version: 2.2.2 Bundler Version:1.7.7 Rake Version: 10.3.2 Sidekiq Version:2.17.0 GitLab information Version: 7.5.1 DB Adapter: postgresql Using LDAP: no Using Omniauth: no GitLab Shell Version: 2.4.0
When running sudo -u gitlab bundle exec rake gitlab:check RAILS_ENV=production i get:
Running /usr/share/webapps/gitlab-shell/bin/check Check GitLab API access: "Performing GET http://mydomain:80//api/v3/internal/check" FAILED. code: 401 gitlab-shell self-check failed Try fixing it: Make sure GitLab is running; Check the gitlab-shell configuration file: sudo -u gitlab -H editor /usr/share/webapps/gitlab-shell/config.yml Please fix the error above and rerun the checks.
gitlab-shell.log shows:
E, [2014-11-26T13:46:56.163516 #584] ERROR -- : API call <GET http://mydomain//api/v3/internal/check> failed: 401 => <{"message":"401 Unauthorized"}>.
secret files in /etc/webapps/gitlab/ and /etc/webapps/gitlab-shell are the same.
WWW frontend works fine, I can check projects, diffs etc. But I cannot access it from gitlab-shell.
By Administrator on 2014-11-26T13:02:39 (imported from GitLab project)
Created by: alerque
@jacobvosmaer Could you be more specific about why that is a mismatch? I have almost exactly the same setup (and some problem) as @Netrix above. Gitlab 7.5.1 seems to be the latest release available, and gitlab-shell 2.4.0 is the latest release tag I see in the Gitlab repo. What is the correct version combination to run (and where is this info recorded)?
By Administrator on 2014-11-26T13:59:39 (imported from GitLab project)
Created by: alerque
Incidentally I've tried downgrading gitlab-shell to both 2.2.0 and 2.3.1 and am still getting exactly the same results. Where would one get more information about this elusive 401 error the API is giving?
By Administrator on 2014-11-26T14:44:56 (imported from GitLab project)
Created by: jacobvosmaer
@alerque as I wrote earlier, GitLab 7.5.1 is intended to be used with gitlab-shell 2.2.0. Gitlab-shell 2.3.0 and up are not compatible with GitLab 7.5.1.
- try comparing the MD5's of
.gitlab_shell_secret
in both directories - try doing
curl http://mydomain:80//api/v3/internal/check
from your GitLab server to see if your request gets routed correctly; the response body should be{"message":"401 Unauthorized"}
- see if you can find the
/api/v3/internal/check
in the production log of your GitLab instance (to see if you are reaching the right server)
Generally speaking, the 401 is there because GitLab 7.5 adds token authentication to the internal API used by gitlab-shell.
By Administrator on 2014-11-26T16:17:10 (imported from GitLab project)
- try comparing the MD5's of
Created by: alerque
@jacobvosmaer thanks for the rundown, that helped! In the end
.gitlab_shell_secret
was the issue. One of them was not symlinked to the right place, which seems to be an ArchLinux packaging issue. I'll comment over there. In spite of the secret's being mentioned in the thread above, the place where Arch puts the secret files has them the same, but the symlink is broken.And thanks for the other suggestions. I'd already done those and confirmed the manual access and that the check was being logged on the right server, but it's good to know those were the right steps.
By Administrator on 2014-11-26T16:43:31 (imported from GitLab project)
Created by: netrix
What is the difference between .gitlab_shell_secret and secret files? Which one should be used?
I have secret files in /etc/webapp/gitlab and gitlab-shell I have also .gitlab_shell_secret in /usr/share/webapps/gitlab and gitlab-shell
By Administrator on 2014-11-26T16:36:31 (imported from GitLab project)
Created by: alerque
@Netrix See my comment on the AUR packages and my email to you. The ones Arch has in etc need to be the same file (copied or symlinked together) and the .gitlab_shell_secret's neet to BOTH be linked to those. All four places need to be the same secret (the two places gitlab opens it from and the two places arch puts the actual secret files). Check with:
md5sum /etc/webapps/gitlab{,-shell}/secret /usr/share/webapps/gitlab{,-shell}/.gitlab_shell_secret
By Administrator on 2014-11-26T16:41:02 (imported from GitLab project)
Created by: axilleas
@Netrix please let's continue the Archlinux related discussion in the AUR page :)
For everyone else, If the problem persists make sure you followed the steps @jacobvosmaer pointed out above.
I believe this is a misconfiguration issue, if not let one of the team repoen this :)
By Administrator on 2014-11-26T16:58:00 (imported from GitLab project)
Created by: rumpelsepp
@alerque Should be fixed in my repo here https://github.com/rumpelsepp/gitlab-pkgbuilds/compare/a371b8a4fefcad52eb06934761cdb58e042aa618...c2b0dc8a70a2ce09b152921bec389a4555a9225f
By Administrator on 2014-11-26T17:03:37 (imported from GitLab project)
Created by: simonzack
@rumpelsepp Thanks for the patch, but is patching the
.rb
files really necessary? I found that just adding symlinks to /etc/ works in my case. These sets need to be the same, btw:md5sum /etc/webapps/gitlab-shell/secret md5sum /usr/share/webapps/gitlab/.gitlab_shell_secret md5sum /usr/share/webapps/gitlab-shell/.gitlab_shell_secret md5sum /etc/webapps/gitlab/secret md5sum /usr/share/webapps/gitlab/.secret
By Administrator on 2014-11-26T23:18:40 (imported from GitLab project)