Issue After Updating GitLab Runner to 17.5
After upgrading to GitLab Runner version 17.5, we encountered the following error in journald
:
Oct 18 10:34:57 supergitlab systemd[1]: Started gitlab-runner.service - GitLab Runner.
Oct 18 10:34:57 supergitlab gitlab-runner[1002832]: FATAL: failed to get user home dir: $HOME is not defined
Oct 18 10:34:57 supergitlab systemd[1]: gitlab-runner.service: Main process exited, code=exited, status=1/FAILURE
Oct 18 10:34:57 supergitlab systemd[1]: gitlab-runner.service: Failed with result 'exit-code'.
Environment Details
The GitLab Runner was installed with the following package configuration:
# apt info gitlab-runner
Package: gitlab-runner
Version: 17.5.0-1
Priority: optional
Section: admin
Maintainer: GitLab Inc. <support@gitlab.com>
Installed-Size: 611 MB
Provides: gitlab-ci-multi-runner
Depends: ca-certificates, git, curl, tar
Suggests: docker-engine
Conflicts: gitlab-runner-beta, gitlab-ci-multi-runner, gitlab-ci-multi-runner-beta
Replaces: gitlab-ci-multi-runner
Homepage: https://gitlab.com/gitlab-org/gitlab-runner
Download-Size: 533 MB
APT-Manual-Installed: yes
APT-Sources: https://packages.gitlab.com/runner/gitlab-runner/debian bookworm/main amd64 Packages
Description: GitLab Runner
Solution
We resolved the issue by creating a systemd service override to define the $HOME
environment variable for the GitLab Runner. Here are the steps taken:
-
Open the systemd override configuration for GitLab Runner:
sudo systemctl edit gitlab-runner
-
Add the following configuration to
/etc/systemd/system/gitlab-runner.service.d/override.conf
:[Service] Environment="HOME=/home/gitlab-runner"
This configuration explicitly sets the HOME
environment variable, allowing GitLab Runner to locate the user’s home directory and start correctly.
Is this a known bug or is our system behaving oddly?