Fix JWT::DecodeError (Nil JSON web token) for Gitlab runner / CI job? - gitlab-ci

I am trying to install a simple job in Gitlab-CI. It should just copy most of the files (.php) in the repository to a different folder (from repository to Apache's /var/www/html/...).
The output goes like this:
Using Shell executor...
Preparing environment
Running on my.server...
Getting source from Git repository
Fetching changes with git depth set to 50...
Reinitialisierte existierendes Git-Projektarchiv in /home/gitlab-runner/builds/TyGXtawE/0/sdp-dev/ibo-php/.git/
fatal: unable to access 'https://gitlab-ci-token:[MASKED]#gitlab.sustainable-data-platform.org/sdp-dev/ibo-php.git/':
The requested URL returned error: 500
So I can find the corresponding problem in /var/log/gitlab/gitlab-rails/production.log
Started POST "/api/v4/jobs/request" for ip.ip.ip.ip at 2022-04-26 14:27:41 +0200
Started GET "/sdp-dev/ibo-php.git/info/refs?service=git-upload-pack" for ip.ip.ip.ip at 2022-04-26 14:27:44 +0200
Processing by Repositories::GitHttpController#info_refs as */*
Parameters: {"service"=>"git-upload-pack", "repository_path"=>"sdp-dev/ibo-php.git"}
Filter chain halted as :authenticate_user rendered or redirected
Completed 401 Unauthorized in 14ms (Views: 1.3ms | ActiveRecord: 1.5ms | Elasticsearch: 0.0ms | Allocations: 4656)
Started GET "/sdp-dev/ibo-php.git/info/refs?service=git-upload-pack" for ip.ip.ip.ip at 2022-04-26 14:27:44 +0200
Processing by Repositories::GitHttpController#info_refs as */*
Parameters: {"service"=>"git-upload-pack", "repository_path"=>"sdp-dev/ibo-php.git"}
Completed 500 Internal Server Error in 34ms (ActiveRecord: 7.6ms | Elasticsearch: 0.0ms | Allocations: 7564)
JWT::DecodeError (Nil JSON web token):
lib/gitlab/jwt_authenticatable.rb:17:in `decode_jwt_for_issuer'
lib/gitlab/workhorse.rb:210:in `decode_jwt'
# ... stacktrace
I have installed the runner from "https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_amd64.rpm" and gave it the token from Gitlab's GUI.
Gitlab (v 14.5.2) and the runner (v 14.10.0) are running on the same machine.
All this might be overhead for some cp -r, but I would like to understand the error for upcoming more complex jobs. Any idea how to debug the registration-token, how to find the problem?
Update
403 for Gitlab Runner from Gitlab?
It seems like gitlab-runner just gets a 403 (forbidden) from Gitlab. So I might need to change something in the corresponding (Apache). But how can I debug this (ERROR: Checking for jobs... forbidden)?
How to register a runner?
There is this command: sudo gitlab-runner register --url $URL --registration-token $REGISTRATION_TOKEN. But when I put the right data (URL, REGISTRATION_TOKEN) in this command (not using bash variables!), I am asked for the same data again (URL, TOKEN) and I just do c/p. E.g. Type the URL [MY_URL]:, then I c/p MY_URL and hit enter. Is this OK?
token / unhealthy runner problems
No success after creating a new token in gitlab and registering a new runner, also after updating Gitlab to v14.10.
But I can see some problems in /var/log/messages.
systemd: Started GitLab Runner.
gitlab-runner: Runtime platform #033[0;m arch#033[0;m=amd64 os#033[0;m=linux pid#033[0;m=20848 revision#033[0;m=c6bb62f6 version#033[0;m=14.10.0
gitlab-runner: Starting multi-runner from /etc/gitlab-runner/config.toml...#033[0;m builds#033[0;m=0
gitlab-runner: Running in system-mode. #033[0;m
gitlab-runner: #033[0;m
gitlab-runner: Configuration loaded #033[0;m builds#033[0;m=0
gitlab-runner: listen_address not defined, metrics & debug endpoints disabled#033[0;m builds#033[0;m=0
gitlab-runner: [session_server].listen_address not defined, session endpoints disabled#033[0;m builds#033[0;m=0
gitlab-runner: #033[31;1mERROR: Checking for jobs... forbidden #033[0;m #033[31;1mrunner#033[0;m=TyGXtawE
gitlab-runner: #033[31;1mERROR: Checking for jobs... forbidden #033[0;m #033[31;1mrunner#033[0;m=iU4sqj-p
gitlab-runner: #033[31;1mERROR: Checking for jobs... forbidden #033[0;m #033[31;1mrunner#033[0;m=TyGXtawE
gitlab-runner: #033[31;1mERROR: Checking for jobs... forbidden #033[0;m #033[31;1mrunner#033[0;m=iU4sqj-p
gitlab-runner: #033[31;1mERROR: Checking for jobs... forbidden #033[0;m #033[31;1mrunner#033[0;m=TyGXtawE
gitlab-runner: #033[31;1mERROR: Runner {URL}/{token} is not healthy and will be disabled!#033[0;m
gitlab-runner: #033[31;1mERROR: Checking for jobs... forbidden #033[0;m #033[31;1mrunner#033[0;m=iU4sqj-p
gitlab-runner: #033[31;1mERROR: Runner {URL}/{token} is not healthy and will be disabled!#033[0;m
I am interested in listen_address not defined, metrics & debug endpoints disabled and Checking for jobs... forbidden.
You can see this problem elsewhere in SO, but I could not find a solution (googling etc.).
Here? https://gitlab.com/gitlab-org/gitlab-runner/-/issues/28965

Some things you might try:
Create a new token
Update Gitlab

Related

SCM Manager returning 404 error when I try to restart scm from console

Goodevening Stackoverflow,
Today I upgraded scm from version 1.60 to 2.30 only that it returns a 404 error from Google console (the browser just keeps loading until the request times out).
running journalctl -u scm-server returning the following error:
Exception in thread "ScmEventBus-1-0" java.lang.UnsatisfiedLinkError: /tmp/jna6511840250923886855.tmp: /tmp/jna6511840250923886855.tmp: failed to map segment from shared object`
at java.lang.ClassLoader$NativeLibrary.load(Native Method)`
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
at java.lang.Runtime.load0(Runtime.java:810)
at java.lang.System.load(System.java:1088)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
at com.sun.jna.Native.<clinit>(Native.java:195)
at com.sun.akuma.CLibrary.<clinit>(CLibrary.java:89)
at com.sun.akuma.JavaVMArguments.resolvePID(JavaVMArguments.java:128)
at com.sun.akuma.JavaVMArguments.ofLinux(JavaVMArguments.java:116)
at com.sun.akuma.JavaVMArguments.of(JavaVMArguments.java:104)
at com.sun.akuma.JavaVMArguments.current(JavaVMArguments.java:92)
at sonia.scm.lifecycle.PosixRestartStrategy.restart(PosixRestartStrategy.java:57)
at sonia.scm.lifecycle.PosixRestartStrategy.executeRestart(PosixRestartStrategy.java:47)
at sonia.scm.lifecycle.RestartStrategy.restart(RestartStrategy.java:67)
at sonia.scm.lifecycle.BootstrapContextFilter.handleRestartEvent(BootstrapContextFilter.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.github.legman.InvocationContext.invoke(InvocationContext.java:108)
at com.github.legman.InvocationContext.proceed(InvocationContext.java:101)
at com.github.legman.micrometer.MicrometerInvocationInterceptor.invoke(MicrometerInvocationInterceptor.java:47)
at com.github.legman.InvocationContext.proceed(InvocationContext.java:99)
at com.github.legman.EventHandler.handleEvent(EventHandler.java:103)
at com.github.legman.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:52)
at com.github.legman.EventBus.dispatchSynchronous(EventBus.java:452)
at com.github.legman.EventBus.lambda$dispatch$1(EventBus.java:444)
at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120)
at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)`*
From google chrome console I get the following error:
GET http://serverip/scm/api/v2/ 404 (Not Found) ApiClient.request # apiclient.ts?718f:307
If I force restart from the server with service scm-server restart, scm manager returns up and running, and with the plugin installed.
Now it seems like the browser is finding it difficult to successfully restart SCM service even if in scm-manager.log I can see the jvm service was restarted.
I also checked the apache log error_log and found an error as follows:
[proxy:error] [pid 32822] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:8080 (localhost) failed
[proxy_http:error] [pid 32822] [client 10.12.173.165:62193] AH01114: HTTP: failed to make connection to backend: localhost
[proxy:error] [pid 32821] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:8080 (localhost) failed
The thing is with version 1.60 I never got any of these errors, the reverse proxy settings in httpd.conf works until this restart from console activity.
I really apologise for the long story, I am only trying to make it comprehensive as much as possibile.
Thanks to anyone willing to help a brother.
Regards
This problem occurs because your scm-manager restart accesses the tmp folder where it has no right to execute. This issue with jna is known by the SCM-Manager team and will be fixed soon.
As workaround try: After installation, run chmod -R 775 scm and scm should be able to restart service from browser

Puppet agent is not running successfully after updating ssl certs

I am running puppet 3.7. The certs are expiring for me so I have updated the certs (after creating a backup so I am able to get back to the original state and that's fine). After updating the certs on puppetmaster using this, updating certs on the agent using this and updating certs on puppetdb using this, I am unable to run puppet agent successfully on a client box. It gives me the following error:
root#ip-10-181-36:/var/lib/puppet# sudo puppet agent -t
Warning: Setting templatedir is deprecated. See http://links.puppetlabs.com/env-settings-deprecations
(at /usr/lib/ruby/vendor_ruby/puppet/settings.rb:1139:in 'issue_deprecation_warning')
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: Error 403 on SERVER: Forbidden request: newer-generic-host(127.0.0.1) access to /node/ip-10-181-36 [find] authenticated at :39
Error: Could not retrieve catalog from remote server: Error 403 on SERVER: Forbidden request: newer-generic-host(127.0.0.1) access to /catalog/ip-10-181-36 [find] authenticated at :1
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Error: Could not send report: Error 403 on SERVER: Forbidden request: newer-generic-host(127.0.0.1) access to /report/ip-10-181-36 [save] authenticated at :91
I am stuck at this point and no googling or reading docs or seeing the logs is helping. Does anyone have any ideas?

OpenDJ Multi-master replication fails(Hangs at Initializing registration information step):: javax.naming.AuthenticationException

I am using OpenDJ-2.4.6 along with Oracle JDK 7.80 and I want to run Multi-master replication on 2 of my servers, the OS for these servers is Amazon Linux.
The OpenDJ setup runs perfectly fine; I can start the server too without any errors.
It is when I run the "dsreplication" script as follows:
./dsreplication enable --host1 server1.example,com --port1 4444 --bindDN1 "cn=Directory Manager" --bindPassword1 "Passw0rd" --replicationPort1 1388 --host2 server2.example,com --port2 4444 --bindDN2 "cn=Directory Manager" --bindPassword2 "Passw0rd" --replicationPort2 1388 --adminUID admin --adminPassword "Passw0rd" --baseDN "dc=example,dc=com"
the script hangs on the following step:
Initializing registration information on server server2.example.com:4444 with the contents of server server1.example.com:4444 .....
And on checking the logs, there is no error reported in there.
But, when I run the following command:
./dsreplication status -h localhost -p 4444 --adminUID admin --adminPassword "Passw0rd" -X
it throws the following error:
The displayed information might not be complete because the following
errors were encountered reading the configuration of the existing
servers: Error on server2.example.com:4444: An error occurred
connecting to the server. Details:
javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid
Credentials] Error on server:4444: An error occurred connecting to the
server. Details: javax.naming.AuthenticationException: [LDAP: error
code 49 - Invalid Credentials]
Please help me.
Thanks in advance.
The error could not be more explicit: "Invalid Credentials" on server 2.
Check the bindDN and bindPassword are valid against server 2.
When doing replication with OpenDJ, the hostnames must be resolved and addressable from either machines. Have you checked that this is the case with your Amazon Linux servers ?

Access HP Helion from Apache Brooklyn

I want to access HP Helion cloud using Apache Brooklyn project.
With the help of the link Access HP Helion using jclouds,
I am able to launch an instance but deployment at Brooklyn fails with the following error :
Error invoking start at EmptySoftwareProcessImpl{id=nkJ0UYV4}: org.jclouds.compute.RunNodesException: error running 1 node group(brooklyn-guvb-ubuntu-simple-vm-c7zq-vm-nkj0) location(region-a.geo-1) image(43804523-7e3b-4adf-b6df-9d11d451c463) size(100) options({scriptPresent=true, userMetadata={Name=brooklyn-guvb-ubuntu-simple-vm-c7zq-vm-nkj0-qqjs, brooklyn-user=ubuntu, brooklyn-app-id=c7ZQXESh, brooklyn-app-name=simple-vm, brooklyn-entity-id=nkJ0UYV4, brooklyn-entity-name=VM, brooklyn-server-creation-date=2015-09-01-0503}, generateKeyPair=true, configDrive=false})
Execution failures:
1) ExecutionException on brooklyn-guvb-ubuntu-simple-vm-c7zq-vm-nkj0-f0c:
java.util.concurrent.ExecutionException: org.jclouds.http.HttpResponseException: command: POST https://region-a.geo-1.compute.hpcloudsvc.com/v2/............/servers/12bc827b-16e6-4616-b75d-e001693eb65a/action HTTP/1.1 failed with response: HTTP/1.1 400 Bad Request; content: [{"badRequest": {"message": "No nw_info cache associated with instance", "code": 400}}]
I can see in Helion that instances get created but no IP is assigned for instances and no network is associated with them.
Can anyone help me with this ?
-Thanks

Error in SSH connection to instance, While performing Burn CPU of Chaos Monkey tool using Simian Army tool

I am using Netflix/Simian army tool. I am not able to perform burn CPU strategy of chaos Monkey as I am getting error in SSH connection to instance. The error mentioned below.
I am running Chaos monkey in local system(windows 7). I am using ubuntu instance(Amazon EC2) on which performing burn CPU. My instance is running in Tokyo(ap-northeast-1) region. But I am getting an Unauthorized for eu-central-1 error
2015-04-01 10:52:48.147 - INFO BasicChaosInstanceSelector - [BasicChaosInstanceSelector.java:83] Group monkey [type ASG] has disabled probability: 0.0
2015-04-01 10:52:48.154 - INFO BasicChaosInstanceSelector - [BasicChaosInstanceSelector.java:65] Randomly selecting 1 from 1 instances, excluding null
2015-04-01 10:52:54.302 - WARN ChaosInstance - [ChaosInstance.java:105] Error making SSH connection to instance
at org.jclouds.rest.AuthorizationException: POST https://ec2.eu-central-1.amazonaws.com/ HTTP/1.1 -> HTTP/1.1 401 Unauthorized
at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.refineException(ParseAWSErrorFromXmlContent.java:123)
at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.handleError(ParseAWSErrorFromXmlContent.java:92)
at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:69)
at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:182)
at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:152)
at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.invoke(InvokeSyncToAsyncHttpMethod.java:133)
at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:99)
at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:60)
at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:119)
at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:70)
at com.sun.proxy.$Proxy144.describeInstancesInRegion(Unknown Source)
at org.jclouds.ec2.compute.strategy.EC2ListNodesStrategy$2.apply(EC2ListNodesStrategy.java:151)
at org.jclouds.ec2.compute.strategy.EC2ListNodesStrategy$2.apply(EC2ListNodesStrategy.java:147)
at com.google.common.collect.Iterators$8.transform(Iterators.java:860)
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
at com.google.common.collect.Iterables$3.next(Iterables.java:512)
at com.google.common.collect.Iterables$3.next(Iterables.java:505)
at com.google.common.collect.Iterators$5.hasNext(Iterators.java:597)
at com.google.common.collect.Iterables$3.hasNext(Iterables.java:508)
at com.google.common.collect.Iterators$5.hasNext(Iterators.java:596)
at com.google.common.collect.Iterators$7.computeNext(Iterators.java:700)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
at com.google.common.collect.TransformedIterator.hasNext(TransformedIterator.java:43)
at com.google.common.collect.Iterators$7.computeNext(Iterators.java:700)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:316)
at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:302)
at org.jclouds.ec2.compute.strategy.EC2ListNodesStrategy.listDetailsOnNodesMatching(EC2ListNodesStrategy.java:119)
at org.jclouds.ec2.compute.strategy.EC2ListNodesStrategy.listNodes(EC2ListNodesStrategy.java:95)
at org.jclouds.ec2.compute.strategy.EC2ListNodesStrategy.listNodes(EC2ListNodesStrategy.java:67)
at org.jclouds.compute.internal.BaseComputeService.listNodes(BaseComputeService.java:339)
at com.netflix.simianarmy.client.aws.AWSClient.getJcloudsNode(AWSClient.java:769)
at com.netflix.simianarmy.client.aws.AWSClient.connectSsh(AWSClient.java:749)
at com.netflix.simianarmy.chaos.ChaosInstance.connectSsh(ChaosInstance.java:123)
at com.netflix.simianarmy.chaos.ChaosInstance.canConnectSsh(ChaosInstance.java:101)
at com.netflix.simianarmy.chaos.ScriptChaosType.canApply(ScriptChaosType.java:61)
at com.netflix.simianarmy.basic.chaos.BasicChaosMonkey.pickChaosType(BasicChaosMonkey.java:141)
at com.netflix.simianarmy.basic.chaos.BasicChaosMonkey.doMonkeyBusiness(BasicChaosMonkey.java:121)
at com.netflix.simianarmy.Monkey.run(Monkey.java:134)
at com.netflix.simianarmy.Monkey$1.run(Monkey.java:155)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.jclouds.http.HttpResponseException: request: POST https://ec2.eu-central-1.amazonaws.com/ HTTP/1.1 [Action=DescribeInstances&Signature=**** &SignatureMethod=***& SignatureVersion=2&Timestamp=****&Version=2010-06-15&AWSAccessKeyId=****] failed with response: HTTP/1.1 401 Unauthorized
at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.handleError(ParseAWSErrorFromXmlContent.java:66)
... 49 more
2015-04-01 10:52:54.497 - WARN ScriptChaosType - [ScriptChaosType.java:62] Strategy disabled because SSH credentials failed
2015-04-01 10:52:54.501 - WARN BasicChaosMonkey - [BasicChaosMonkey.java:124] No chaos type was applicable to the instance: ****