Shell runner only works when I "run" it but not when I "start" it

Following these instruction I have installed a GitLab runner on Digital Ocean. First I tried a docker runner and that worked well. Then I tried a “shell” runner following these instructions

Every time I ran a pipeline I got an error 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

I stopped the runner using gitlab-runner stop and started it using gitlab-runner run.
That time the Pipeline worked fine. When I started it again using gitlab-runner start it does not work again.

Of course I don’t want to run it in the foreground, so how can I fix this?

The error message points to this page but it does not have the real fix, just a partial hint.

It would have been so much simpler to say that one needs to edit the

/home/gitlab-runner/.bash_logout

file that was, I assume, added by the gitlab runner, and remove the “clear_console” lines. In my case after I commented all the 3 lines that file had the job started to work properly.

It’s a pity the error message does not tell the name of the user where I need to look for the .bash_logout file.

I hope the next person will find this solution and won’t waste time on this.