Answers: <p>I had to just set the following in <code>/etc/gitlab-runner/config.toml</code></p>
  <pre><code>[[runners]]
    ...
    builds_dir = &quot;/home/gitlab-runner/build/&quot;
  </code></pre>
  <p>This parameter does not change the value in  <code>/etc/systemd/system/gitlab-runner.service</code> <strong>until</strong> a build is triggered (it seems)...</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-06-06T14:58:42.990Z
Answers: 2023-06-06T14:58:42.990Z
Answers: Chris Stryczynski
Body: <p>I installed the runners using the <code>docker</code> executor, but then later realized I actually needed the <code>shell</code> executor for layer caching... However now I just keep running into so many errors trying to get the runner to work...</p>
  <pre><code>sudo gitlab-runner list
  Runtime platform                                    arch=amd64 os=linux pid=17362 revision=79704081 version=16.0.1
  Listing configured runners                          ConfigFile=/etc/gitlab-runner/config.toml
  affiliate-processor-1                               Executor=shell Token=******************* URL=https://gitlab.com
  affiliate-processor-1                               Executor=shell Token=******************* URL=https://gitlab.com
  gitlab-runner-final                                 Executor=shell Token=******************* URL=https://gitlab.com
  </code></pre>
  <p>And the journal logs:</p>
  <pre><code>sudo journalctl -u gitlab-runner --follow
  -- Logs begin at Sat 2023-05-27 18:43:05 UTC. --
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: Running in system-mode.                           
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]:                                                   
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: Configuration loaded                                builds=0
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: listen_address not defined, metrics &amp; debug endpoints disabled  builds=0
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: [session_server].listen_address not defined, session endpoints disabled  builds=0
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: Initializing executor providers                     builds=0
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: ERROR: Checking for jobs... forbidden               runner=m5Q9_Nc_6
  Jun 05 12:29:03 affiliate-processor-1 gitlab-runner[17177]: ERROR: Checking for jobs... forbidden               runner=m5Q9_Nc_6
  Jun 05 12:29:04 affiliate-processor-1 gitlab-runner[17177]: ERROR: Checking for jobs... forbidden               runner=m5Q9_Nc_6
  Jun 05 12:29:04 affiliate-processor-1 gitlab-runner[17177]: ERROR: Runner &quot;https://gitlab.com************************&quot; is unhealthy and will be disabled for 1h0m0s seconds!  unhealthy_requests=3 unhealthy_requests_limit=3
  </code></pre>
  <p>How can I fix this?</p>
  <p>Some more issues, <code>systemctl status gitlab-runner.service</code> shows:</p>
  <pre><code>/usr/bin/gitlab-runner run --working-directory /home/chris --config /etc/gitlab-runner/config.toml --service gitlab-runner --user gitlab-runner
  </code></pre>
  <p>Why is it using my PERSONAL home directory as the working directory??? Surely it rather uses some system directory instead or the gitlab-runner home directory?!?!</p>
  <hr />
  <p>OKAY I have uninstalled the old runners which seemed to be the cause of the issue... But now I have these pipeline errors:</p>
  <pre><code>mkdir: cannot create directory ‘/home/chris/builds/onty8Erw6’: Permission denied
  </code></pre>
  <p>?!?!?!? WHY IS IT USING THE <code>/home/chris</code> directory?!?!</p>
  
Tags: <gitlab><gitlab-ci-runner>
Title: Gitlab runner tons of errors when trying to use shell executor
UserDisplayName: Chris Stryczynski
ThreadText: # Gitlab runner tons of errors when trying to use shell executor
  
  (Asked by: username_0 on 2023-06-05)
  
  I installed the runners using the `docker` executor, but then later realized I actually needed the `shell` executor for layer caching... However now I just keep running into so many errors trying to get the runner to work...
  
  ```
  sudo gitlab-runner list
  Runtime platform                                    arch=amd64 os=linux pid=17362 revision=79704081 version=16.0.1
  Listing configured runners                          ConfigFile=/etc/gitlab-runner/config.toml
  affiliate-processor-1                               Executor=shell Token=******************* URL=https://gitlab.com
  affiliate-processor-1                               Executor=shell Token=******************* URL=https://gitlab.com
  gitlab-runner-final                                 Executor=shell Token=******************* URL=https://gitlab.com
  
  ```
  
  And the journal logs:
  
  ```
  sudo journalctl -u gitlab-runner --follow
  -- Logs begin at Sat 2023-05-27 18:43:05 UTC. --
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: Running in system-mode.                           
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]:                                                   
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: Configuration loaded                                builds=0
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: listen_address not defined, metrics & debug endpoints disabled  builds=0
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: [session_server].listen_address not defined, session endpoints disabled  builds=0
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: Initializing executor providers                     builds=0
  Jun 05 12:29:01 affiliate-processor-1 gitlab-runner[17177]: ERROR: Checking for jobs... forbidden               runner=m5Q9_Nc_6
  Jun 05 12:29:03 affiliate-processor-1 gitlab-runner[17177]: ERROR: Checking for jobs... forbidden               runner=m5Q9_Nc_6
  Jun 05 12:29:04 affiliate-processor-1 gitlab-runner[17177]: ERROR: Checking for jobs... forbidden               runner=m5Q9_Nc_6
  Jun 05 12:29:04 affiliate-processor-1 gitlab-runner[17177]: ERROR: Runner "https://gitlab.com************************" is unhealthy and will be disabled for 1h0m0s seconds!  unhealthy_requests=3 unhealthy_requests_limit=3
  
  ```
  
  How can I fix this?
  
  Some more issues, `systemctl status gitlab-runner.service` shows:
  
  ```
  /usr/bin/gitlab-runner run --working-directory /home/username_0 --config /etc/gitlab-runner/config.toml --service gitlab-runner --user gitlab-runner
  
  ```
  
  Why is it using my PERSONAL home directory as the working directory??? Surely it rather uses some system directory instead or the gitlab-runner home directory?!?!
  
  ---
  
  OKAY I have uninstalled the old runners which seemed to be the cause of the issue... But now I have these pipeline errors:
  
  ```
  mkdir: cannot create directory ‘/home/username_0/builds/onty8Erw6’: Permission denied
  
  ```
  
  ?!?!?!? WHY IS IT USING THE `/home/username_0` directory?!?!
  
  **Tags:** gitlab, gitlab-ci-runner
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-06-06. Score: 0
  
  I had to just set the following in `/etc/gitlab-runner/config.toml`
  
  ```
  [[runners]]
    ...
    builds_dir = "/home/gitlab-runner/build/"
  
  ```
  
  This parameter does not change the value in `/etc/systemd/system/gitlab-runner.service` **until** a build is triggered (it seems)...
  
  
  ---
  
  