Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to install gitlab-runner: Init already exists

I installed gitlab-runner via sudo apt install gitlab-runner, configured it according to the tutorial and it worked well.

Now I want to change the user of the gitlab-runner. So I stop the service with service gitlab-runner stop and try to change the user via

sudo gitlab-runner install --user=my-user --working-directory=/home/my-user 

I get following error message:

FATAL: Failed to install gitlab-runner: Init already exists: /etc/systemd/system/gitlab-runner.service

How to proceed?

like image 540
Markus Weber Avatar asked May 18 '26 19:05

Markus Weber


2 Answers

  1. Rename the init file with

    sudo mv /etc/systemd/system/gitlab-runner.service  /etc/systemd/system/gitlab-runner.service.bak
    
  2. and execute again

    sudo gitlab-runner install --user=my-user --working-directory=/home/my-user
    
  3. cleanup the backup file

    sudo rm /etc/systemd/system/gitlab-runner.service.bak
    

Finally you can start the runner again with service gitlab-runner start.

like image 172
Markus Weber Avatar answered May 23 '26 19:05

Markus Weber


You can simply remove this file:

rm /etc/systemd/system/gitlab-runner.service

Or:

gitlab-runner uninstall

And then install gitlab-runner again.

like image 34
Nickeron-dev Avatar answered May 23 '26 18:05

Nickeron-dev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!