Fails to start: Could not handle configuration file locking
Summary
gitlab-runner fails to start if config directory is not writable.
Actual behavior
gitlab-runner dies immediately after start.
Expected behavior
gitlab-runner starts and processes requests.
Relevant logs and/or screenshots
Runtime platform arch=amd64 os=linux pid=6 revision=4b4e71f7 version=12.6.0~beta.2021.g4b4e71f7
Starting multi-runner from /home/gitlab-runner/.gitlab-runner/config.toml ... builds=0
Configuration loaded builds=0
Locking configuration file builds=0 file=/home/gitlab-runner/.gitlab-runner/config.toml pid=6
FATAL: Could not handle configuration file locking builds=0 error=can't acquire file lock on "/home/gitlab-runner/.gitlab-runner/config.toml.lock" file: open /home/gitlab-runner/.gitlab-runner/config.toml.lock: read-only file system file=/home/gitlab-runner/.gitlab-runner/config.toml pid=6
Environment description
Runs in Kubernetes without write access to the config directory.
Used GitLab Runner version
Runtime platform arch=amd64 os=linux pid=6 revision=4b4e71f7 version=12.6.0~beta.2021.g4b4e71f7
also with
Runtime platform arch=amd64 os=linux pid=6 revision=b295d93b version=12.5.0-rc1
Possible fixes
Make the requirement of the .lock file soft requirements up until %13.0 and then in 13.0 require this lock file all the time.
Workaround
Make the directory of where the runner configuration is writeable to the user that runs the gitlab-runner process.