Shell executor fails to prepare environment in Ubuntu 20.04 Gitlab Runner

2.1k Views Asked by At

Summary

After updating our build system to Ubuntu 20.04, any job using the Shell executor fails:
Running with gitlab-runner 13.1.1 (6fbc7474)
  on [redacted]
Preparing the "shell" executor
00:00
Using Shell executor...
Preparing environment
00:00
Running on [redacted]...
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

When we provision a runner instance using Ubuntu 18.04, the Shell executor works as expected.

Steps to reproduce

Provision a new runner instance using Ubuntu 18.04, and register as a runner. It will run Shell jobs successfully. Provision a new runner instance using Ubuntu 20.04, following the exact same steps as you did before, and register it as a runner. Shell jobs will fail. We use Ansible to provision our runners, and this was the only change we made. We tried several times configuring 18.04 and 20.04 from the same scripts, with only the AMI ID changing.

What is the current bug behavior?

Jobs using Shell executor fail in the "preparing environment" step.

What is the expected correct behavior?

Jobs using the Shell executor proceed past the "preparing environment" step and execute the shell script.

NOTE: This question asked originally here gitlab-community

1

There are 1 best solutions below

0
On

I had same error with shell executor of gitlab runner on AWS Ubuntu 20.04, I removed all .* files from /home/gitlab-runner and this seem to solve the issue

if your username gitlab-runner run this command

sudo rm -rf /home/gitlab-runner/.*

This answer given originally here gitlab-commmunity