GitLab CI: Explicit --user argument required to run as user manager

Since upgrading to GitLab Runner 16.6 jobs fail with:

Explicit --user argument required to run as user manager.
Cleaning up project directory and file based variables  00:01
ERROR: Job failed: exit code 1

Does anyone know what configuration needs to be updated to fix this, I couldn’t find mention of this change in the CHANGELOG.

The runner server is Debian:

lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

GitLab runner is installed using the .deb package:

dpkg -l gitlab-runner
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
ii  gitlab-runner  16.6.0       amd64        GitLab Runner

The systemd unit file at /etc/systemd/system/gitlab-runner.service contains:

Description=GitLab Runner

ExecStart=/usr/bin/gitlab-runner "run" "--working-directory" "/home/gitlab-runner" "--config" "/etc/gitlab-runner/config.toml" "--service" "gitlab-runner" "--user" "gitlab-runner"


The service appears to be running without any problems:

service gitlab-runner status
* gitlab-runner.service - GitLab Runner
     Loaded: loaded (/etc/systemd/system/gitlab-runner.service; enabled; preset: enabled)
     Active: active (running) since Sun 2023-11-19 15:47:37 UTC; 6s ago
   Main PID: 2432321 (gitlab-runner)
      Tasks: 13 (limit: 4630)
     Memory: 14.8M
        CPU: 625ms
     CGroup: /system.slice/gitlab-runner.service
             `-2432321 /usr/bin/gitlab-runner run --working-directory /home/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --user gitlab-runner
gitlab-runner status
Runtime platform                                    arch=amd64 os=linux pid=2434067 revision=3046fee8 version=16.6.0
gitlab-runner: Service is running

And the /etc/gitlab-runner/config.toml contains:

concurrent = 8
check_interval = 1
user = "gitlab-runner"
shutdown_timeout = 0

  session_timeout = 21600

  name = ""
  output_limit = 204800
  url = ""
  id = 0
  token = "XXX"
  token_obtained_at = 0001-01-01T00:00:00Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "docker"
  environment = ["DOCKER_DRIVER=overlay2"]
    tls_verify = true
    image = "docker:stable"
    memory = "8192m"
    memory_swap = "8192m"
    memory_reservation = "8192m"
    cpus = "8"
    dns = ["", ""]
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache", "/certs/client"]
    shm_size = 536870912

This server needs to run containers in privileged mode for systemd, in fact I think the error message might be from systemctl?

systemctl --help | grep "user service manager"
     --user              Connect to user service manager

I suspect that this merge request is the cause of this issue, reverting to the previous version is my current solution:

apt install gitlab-runner=16.5.0

I’ve pinned this version by creating a /etc/apt/preferences.d/pin-gitlab-runner.pref file containing:

Explanation: Prefer GitLab provided packages over the Debian native ones
Package: gitlab-runner
Pin: version 16.5.0
Pin: origin
Pin-Priority: 1002

So it doesn’t get upgraded:

apt list --upgradable
Listing... Done
gitlab-runner/bullseye 16.6.0 amd64 [upgradable from: 16.5.0]
N: There are 62 additional versions. Please use the '-a' switch to see them.

apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

I’d be interested to hear if anyone else is running containers with systemd via GitLab CI and how they managed to adapt to the changes in GitLab runner 16.6.0.

EDIT: I’ve opened an issue for this.

1 Like

Thanks to the release of 16.6.1 this issue is fully resoved :slight_smile: .