GitLab Runner “Runner has never contacted this instance”

I just installed and configured a GitLab Runner on a separate Ubuntu 22.04 server. Following tips here and here, I’ve started the runner with ‘sudo gitlab-runner start’ and I’ve verified the config with ‘sudo gitlab-runner verify’, but the GitLab server is still showing the ‘never contacted this instance’ error:

Following the troubleshooting steps here, I used journalctl to view the logs:

sudo journalctl --unit=gitlab-runner.service -n 100 --no-pager

and this gave me a clue:

Oct 19 14:36:24 proxmox-ubuntu2204-server systemd[1]: Started GitLab Runner.
Oct 19 14:36:25 proxmox-ubuntu2204-server gitlab-runner[1264]: FATAL: failed to get user home dir: $HOME is not defined
Oct 19 14:36:25 proxmox-ubuntu2204-server systemd[1]: gitlab-runner.service: Main process exited, code=exited, status=1/FAILURE
Oct 19 14:36:25 proxmox-ubuntu2204-server systemd[1]: gitlab-runner.service: Failed with result 'exit-code'.

To set a home dir for the gitlab-runner user, I checked /etc/passwd, found the line for gitlab-runner and it has an entry towards the end of the line for /home/gitlab-runner, so that seems ok.

Following tips here, I edited the service config with:

sudo systemctl edit gitlab-runner

which edits
/etc/systemd/system/gitlab-runner.service.d/override.conf and added this section:

[Service]
Environment="HOME=/home/gitlab-runner"

Restarted the service with:

sudo systemctl restart gitlab-runner

checked the logs again with jornalctl and now we’re up and running, and the runner is reported as available on the Runners page. Done!

Oct 19 14:51:48 proxmox-ubuntu2204-server gitlab-runner[1400]: Runtime platform                                    arch=amd64 os=linux pid=1400 revision=66a723c3 version=17.5.0
Oct 19 14:51:48 proxmox-ubuntu2204-server gitlab-runner[1400]: Starting multi-runner from /etc/gitlab-runner/config.toml... builds=0 max_builds=0
Oct 19 14:51:48 proxmox-ubuntu2204-server gitlab-runner[1400]: Running in system-mode.
Oct 19 14:51:48 proxmox-ubuntu2204-server gitlab-runner[1400]:
Oct 19 14:51:48 proxmox-ubuntu2204-server gitlab-runner[1400]: Configuration loaded builds=0 max_builds=1

Downloading Proxmox Container images

Before you can create a LXC container on a Proxmox virtualized environment, you need to download the template images first from an available list. You need to pre-download the images first befoe you can create new containers from them in the web ui.

From the docs here, there steps are (while ssh’d into your Proxmox server):

Update catalog of available templates:

pveam update

List the available templates:

root@pve:~# pveam available

system          alpine-3.3-default_20160427_amd64.tar.xz

system          alpine-3.4-default_20161206_amd64.tar.xz

system          alpine-3.5-default_20170504_amd64.tar.xz

system          archlinux-base_20170704-1_amd64.tar.gz

system          centos-6-default_20161207_amd64.tar.xz

system          centos-7-default_20170504_amd64.tar.xz

system          debian-6.0-standard_6.0-7_amd64.tar.gz

system          debian-7.0-standard_7.11-1_amd64.tar.gz

system          debian-8.0-standard_8.7-1_amd64.tar.gz

system          debian-9.0-standard_9.0-2_amd64.tar.gz

system          fedora-24-default_20161207_amd64.tar.xz

system          fedora-25-default_20170316_amd64.tar.xz

system          gentoo-current-default_20170503_amd64.tar.xz

system          opensuse-42.2-default_20170406_amd64.tar.xz

system          ubuntu-12.04-standard_12.04-1_amd64.tar.gz

system          ubuntu-14.04-standard_14.04-1_amd64.tar.gz

system          ubuntu-16.04-standard_16.04-1_amd64.tar.gz

system          ubuntu-16.10-standard_16.10-1_amd64.tar.gz

system          ubuntu-17.04-standard_17.04-1_amd64.tar.gz

For each of the templates you wish to use, download using for example for Ubuntu 14.04:

pveam download local ubuntu-14.04-standard_14.04-1_amd64.tar.gz

Now from the web ui, you should be able to click the ‘Create CT’ button and pick from your available templates: