question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

./config.sh remove - Failed: Removing service - even after service uninstall

See original GitHub issue

Describe the bug error on removing runners [user@server folder]$ ./config.sh remove

Runner removal

Removing service Failed: Removing service Unconfigure service first

To Reproduce run ./config.sh remove

[user@server folder]$ ./config.sh remove

Runner removal

Removing service Failed: Removing service Unconfigure service first

Expected behavior runner should be removed locally and from github.

Runner Version and Platform

Version of your runner? 2.277.1

OS of the machine running the runner? OSX/Windows/Linux/… Linux

What’s not working?

[user@server folder]$ ./config.sh remove

# Runner removal

Removing service
Failed: Removing service
Unconfigure service first
[ec2-user@ip-10-97-97-125 eap_automations_10_97_97_125_b_1]$ sudo ./svc.sh status

not installed

Job Log Output

If applicable, include the relevant part of the job / step log output here. All sensitive information should already be masked out, but please double-check before pasting here.

Runner and Worker’s Diagnostic Logs

If applicable, add relevant diagnostic log information. Logs are located in the runner’s _diag folder. The runner logs are prefixed with Runner_ and the worker logs are prefixed with Worker_. Each job run correlates to a worker log. All sensitive information should already be masked out, but please double-check before pasting here.

[2021-03-24 15:28:31Z INFO ConfigurationStore] IsServiceConfigured()
[2021-03-24 15:28:31Z INFO ConfigurationStore] IsServiceConfigured: True
[2021-03-24 15:28:31Z INFO Terminal] WRITE LINE: Removing service
[2021-03-24 15:28:31Z ERR  Terminal] WRITE ERROR: Failed: Removing service
[2021-03-24 15:28:31Z ERR  Runner] System.Exception: Unconfigure service first
   at GitHub.Runner.Listener.Configuration.ConfigurationManager.UnconfigureAsync(CommandSettings command)
   at GitHub.Runner.Listener.Runner.ExecuteCommand(CommandSettings command)
[2021-03-24 15:28:31Z ERR  Terminal] WRITE ERROR: Unconfigure service first
[2021-03-24 15:28:31Z INFO Listener] Runner execution has finished with return code 1

So for some reason it thinks the service is configured, but it has already been uninstalled.

I looked at https://github.com/actions/runner/issues/403 This is the same error, but it seems this was solved by uninstalling the service first. I’ve uninstalled, but the error persists.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

6reactions
kane1997commented, Jan 11, 2023

Hi Where can I find the runner remove token here?

5reactions
fhammerlcommented, Jun 7, 2021

Platform: Linux (Ubuntu 20.04)

Steps:

  1. Run curl -s https://raw.githubusercontent.com/actions/runner/main/scripts/create-latest-svc.sh | bash -s yourorg/yourrepo to install and configure service. The runner is now active: image

  2. Try to remove the runner now (see it fail):

# Runner removal
Removing service
Failed: Removing service
Unconfigure service first
  1. Run sudo ./svc.sh uninstall: Runner is now offline: image

  2. Run ./config.sh remove:

./config.sh remove
# Runner removal
Enter runner remove token: *****************************
√ Runner removed successfully
√ Removed .credentials
√ Removed .runner

Summary

@TingluoHuang I never managed to get to the state where ./svc.sh status gives not installed and config.sh remove fails using our scripts. I suspect if someone removes the service from systemd using something other than svc.sh uninstall, .service remains in the runner folder, which means config.sh remove can’t run.

Details

The message Unconfigure service first is shown if the runner finds a .service file. The hidden file should be on the top level, runner/.service, in the same directory as svc.sh. Normally, ./svc.sh uninstall should delete it. That means either svc.sh uninstall exits without deleting .service, or the file got restored somehow since the last time you ran uninstall. This could be the cause of your issue. Note that./svc.sh uninstall will not help if the service is no longer registered in systemd, then the only solution is to delete .service locally.

ferenc@ubuntu:~/Dev/runner/runner$ sudo ./svc.sh uninstall
Failed to stop actions.runner.fhammerl-hello-github-actions.ubuntu.service: Unit actions.runner.fhammerl-hello-github-actions.ubuntu.service not loaded.
Failed: failed to stop actions.runner.fhammerl-hello-github-actions.ubuntu.service
ferenc@ubuntu:~/Dev/runner/runner$ ./config.sh remove

# Runner removal

Removing service
Failed: Removing service
Unconfigure service first
ferenc@ubuntu:~/Dev/runner/runner$ rm .service 
ferenc@ubuntu:~/Dev/runner/runner$ ./config.sh remove

# Runner removal

Enter runner remove token: *************************

Read more comments on GitHub >

github_iconTop Results From Across the Web

GitHub action self-host runner as service fails - linux
I have installed GitHub self-hosted runner on my Ubuntu system. Getting below error when i try to configure it as service. $ sudo...
Read more >
Cannot delete an existing service using sc command
sc delete "SERVICE NAME". Don't forget to put double quotes around the service name (if it has spaces in it). If left out...
Read more >
Self-hosted Linux agents - Azure Pipelines
After you've removed the agent, you can configure it again. Unattended config. The agent can be set up from a script with no...
Read more >
4 Ways to Delete or Remove a Service in Windows
To delete a service, use the command sc delete name, where the name should be replaced with the actual name of the service...
Read more >
How to remove NetWorker when uninstall or upgrade failed ...
Command -Line Removal: 1. Stop all NetWorker, NetWorker Management Console, and NetWorker Web User Interfaces services were applicable:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found