The Runner of type Shell don't work: Job failed (system failure): preparing environment:
Asked Answered
M

5

22

1- Environment:

  • Gitlab-CE
  • GitLab 13.2.1 (b55baf593e6)
  • GitLab Shell 13.3.0
  • GitLab Workhorse v8.37.0
  • GitLab API v4
  • Ruby 2.6.6p146
  • Rails 6.0.3.1
  • PostgreSQL 11.7
  • Debian GNU / Linux 10 server (buster)

2- .gitlab-ci.yml file:

before_script:
  - echo "--------- STARTING WORK ------------"

job_homologacao:
   only:
     - homologation
   script:
     - cd /home/ati/
     - mkdir test
     - echo "got here"

job_producao:
   only:
     - master
   script:
     - cd /home/ati/test/
     - echo "got here"

3- Error presented when the runner is executed: Running with gitlab-runner 13.2.1 (efa30e33) on runner with Akx_BvYF shell Preparing the "shell" performer Using Shell executor ... Preparing environment Running on hermes ... ERROR: Job failed (system failure): prepare environment: exit status 1. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

4- correction attempts: I read and executed all the procedures contained in the codumentation:

Mahican answered 29/7, 2020 at 13:36 Comment(0)
M
66

I was erroneously editing the file .bash_logout located inside my Home /home/ati/

Gitlab when installing gitlab-runner create a Home for it in /home/gitlab-runner/

I just had to comment on the contents of the /home/gitlab-runner/.bash_logout file for the job to work.

Mahican answered 29/7, 2020 at 17:58 Comment(3)
I renamed the file to .bash_logout_bkp. Found this way to be easier.Purpura
I wish they(gitlab) add this bit in their documentation on linkWhalen
Ah! definitely saved my day! Thanks!Herbart
H
46

If your runner is on Ubuntu 20.04, check this out: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/26605

Solution:

sudo rm /home/gitlab-runner/.bash_logout
Hercegovina answered 19/2, 2021 at 21:16 Comment(1)
no such file exists in mine. k8s environment. runners helm chart :0.31Silvestro
O
7

First find out home directory for gitlab runner.

$ ps aux | grep gitlab-runner
/usr/bin/gitlab-runner run --working-directory /var/lib/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --syslog --user gitlab-runner

Now, check .bash_logout exist or not.

$ ls -lah /var/lib/gitlab-runner/
total 20K
drwxr-xr-x  4 gitlab-runner root          4.0K Dec  1 02:53 .
drwxr-xr-x 42 root          root          4.0K Nov 11 03:29 ..
-rwxr--r--  1 gitlab-runner gitlab-runner   30 Dec  1 02:53 .bash_logout
drwxr-xr-x  2 gitlab-runner gitlab-runner 4.0K Dec  1 02:26 .terraform.d
drwxrwxr-x  3 gitlab-runner gitlab-runner 4.0K Nov 11 03:23 builds

At last, open .bash_logout file and comment out all lines and save it.

 $ vim /var/lib/gitlab-runner/.bash_logout
 # ~/.bash_logout: executed by bash(1) when login shell exits.

 # when leaving the console clear the screen to increase privacy

 #if [ "$SHLVL" = 1 ]; then
 #    [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
 #fi

ps: Originally answer was given by Jonathan Allen Jonathan Allen (@sc_jallen) on gilab-runner issues.

Obligor answered 2/4, 2021 at 9:19 Comment(0)
S
1

After upgrading Ubuntu 18.04 to 20.04, I was also hit by this bug. Removing .bash_logout worked for me.

Singlebreasted answered 19/7, 2021 at 18:59 Comment(0)
C
0

Did you check these?

  • Debian users should use APT pinning, because a native package called gitlab-ci-multi-runner is available in Debian Stretch and by default, when installing gitlab-runner, that package from the official repositories will have a higher priority.

  • Also, be sure to disable SKEL when installing GitLab Runner: set the environment variable GITLAB_RUNNER_DISABLE_SKEL to true before you install the package.

For details on both, see https://docs.gitlab.com/runner/install/linux-repository.html#apt-pinning

Conditioner answered 29/7, 2020 at 16:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.