actions / runner

The Runner for GitHub Actions :rocket:
https://github.com/features/actions
MIT License
4.79k stars 937 forks source link

1068: Dependency service or group failed to start. #1368

Open Misiu opened 2 years ago

Misiu commented 2 years ago

Describe the bug I've downloaded the latest version of the agent and I wanted to install it as a windows service. I am able to run the agent as a standalone app without any problems, but It can't start the windows service.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Run '....'
  3. See error

Expected behavior Windows service should start without any problems

Runner Version and Platform

Version of your runner? v2.283.1

OS of the machine running the runner? Windows 10 Pro 21H1 19043.1237 Polish language

What's not working?

image

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

[2021-09-23 13:54:03Z INFO HostContext] No proxy settings were found based on environmental variables (http_proxy/https_proxy/HTTP_PROXY/HTTPS_PROXY)
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Root': 'C:\actions-runner'
[2021-09-23 13:54:03Z INFO HostContext] Well known config file 'Credentials': 'C:\actions-runner\.credentials'
[2021-09-23 13:54:03Z INFO Listener] Runner is built for Windows (X64) - win-x64.
[2021-09-23 13:54:03Z INFO Listener] RuntimeInformation: Microsoft Windows 10.0.19043.
[2021-09-23 13:54:03Z INFO Listener] Version: 2.283.1
[2021-09-23 13:54:03Z INFO Listener] Commit: e6baf0d2755bc747d0eb58f24941e273d16c6524
[2021-09-23 13:54:03Z INFO Listener] Culture: pl-PL
[2021-09-23 13:54:03Z INFO Listener] UI Culture: pl-PL
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Root': 'C:\actions-runner'
[2021-09-23 13:54:03Z INFO Listener] Validating directory permissions for: 'C:\actions-runner'
[2021-09-23 13:54:03Z INFO CommandLineParser] Parse
[2021-09-23 13:54:03Z INFO CommandLineParser] Parsing 5 args
[2021-09-23 13:54:03Z INFO CommandLineParser] parsing argument
[2021-09-23 13:54:03Z INFO CommandLineParser] HasArgs: False
[2021-09-23 13:54:03Z INFO CommandLineParser] Adding Command: configure
[2021-09-23 13:54:03Z INFO CommandLineParser] parsing argument
[2021-09-23 13:54:03Z INFO CommandLineParser] HasArgs: True
[2021-09-23 13:54:03Z INFO CommandLineParser] arg: url
[2021-09-23 13:54:03Z INFO CommandLineParser] parsing argument
[2021-09-23 13:54:03Z INFO CommandLineParser] HasArgs: True
[2021-09-23 13:54:03Z INFO CommandLineParser] Adding option 'url': 'https://github.com/Misiu/argon40'
[2021-09-23 13:54:03Z INFO CommandLineParser] parsing argument
[2021-09-23 13:54:03Z INFO CommandLineParser] HasArgs: True
[2021-09-23 13:54:03Z INFO CommandLineParser] arg: token
[2021-09-23 13:54:03Z INFO CommandLineParser] parsing argument
[2021-09-23 13:54:03Z INFO CommandLineParser] HasArgs: True
[2021-09-23 13:54:03Z INFO CommandLineParser] Adding option 'token': '***'
[2021-09-23 13:54:03Z INFO Listener] Arguments parsed
[2021-09-23 13:54:03Z INFO Runner] ExecuteCommand
[2021-09-23 13:54:03Z INFO ConfigurationStore] currentAssemblyLocation: C:\actions-runner\bin\Runner.Listener.dll
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:03Z INFO ConfigurationStore] binPath: C:\actions-runner\bin
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Root': 'C:\actions-runner'
[2021-09-23 13:54:03Z INFO ConfigurationStore] RootFolder: C:\actions-runner
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Root': 'C:\actions-runner'
[2021-09-23 13:54:03Z INFO HostContext] Well known config file 'Runner': 'C:\actions-runner\.runner'
[2021-09-23 13:54:03Z INFO ConfigurationStore] ConfigFilePath: C:\actions-runner\.runner
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Root': 'C:\actions-runner'
[2021-09-23 13:54:03Z INFO HostContext] Well known config file 'Credentials': 'C:\actions-runner\.credentials'
[2021-09-23 13:54:03Z INFO ConfigurationStore] CredFilePath: C:\actions-runner\.credentials
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Root': 'C:\actions-runner'
[2021-09-23 13:54:03Z INFO HostContext] Well known config file 'MigratedCredentials': 'C:\actions-runner\.credentials_migrated'
[2021-09-23 13:54:03Z INFO ConfigurationStore] MigratedCredFilePath: C:\actions-runner\.credentials_migrated
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:03Z INFO HostContext] Well known directory 'Root': 'C:\actions-runner'
[2021-09-23 13:54:03Z INFO HostContext] Well known config file 'Service': 'C:\actions-runner\.service'
[2021-09-23 13:54:03Z INFO ConfigurationStore] ServiceConfigFilePath: C:\actions-runner\.service
[2021-09-23 13:54:03Z INFO CommandSettings] Flag 'help': 'False'
[2021-09-23 13:54:03Z INFO CommandSettings] Flag 'version': 'False'
[2021-09-23 13:54:03Z INFO CommandSettings] Flag 'commit': 'False'
[2021-09-23 13:54:03Z INFO CommandSettings] Flag 'check': 'False'
[2021-09-23 13:54:03Z INFO CommandSettings] Command 'configure': 'True'
[2021-09-23 13:54:03Z INFO Terminal] WRITE LINE: 
[2021-09-23 13:54:03Z INFO Terminal] WRITE LINE: --------------------------------------------------------------------------------
[2021-09-23 13:54:03Z INFO Terminal] WRITE LINE: |        ____ _ _   _   _       _          _        _   _                      |
[2021-09-23 13:54:03Z INFO Terminal] WRITE LINE: |       / ___(_) |_| | | |_   _| |__      / \   ___| |_(_) ___  _ __  ___      |
[2021-09-23 13:54:03Z INFO Terminal] WRITE LINE: |      | |  _| | __| |_| | | | | '_ \    / _ \ / __| __| |/ _ \| '_ \/ __|     |
[2021-09-23 13:54:03Z INFO Terminal] WRITE LINE: |      | |_| | | |_|  _  | |_| | |_) |  / ___ \ (__| |_| | (_) | | | \__ \     |
[2021-09-23 13:54:03Z INFO Terminal] WRITE LINE: |       \____|_|\__|_| |_|\__,_|_.__/  /_/   \_\___|\__|_|\___/|_| |_|___/     |
[2021-09-23 13:54:03Z INFO Terminal] WRITE LINE: |                                                                              |
[2021-09-23 13:54:03Z INFO Terminal] WRITE: |                       
[2021-09-23 13:54:03Z INFO Terminal] WRITE: Self-hosted runner registration
[2021-09-23 13:54:03Z INFO Terminal] WRITE LINE:                         |
[2021-09-23 13:54:03Z INFO Terminal] WRITE LINE: |                                                                              |
[2021-09-23 13:54:03Z INFO Terminal] WRITE LINE: --------------------------------------------------------------------------------
[2021-09-23 13:54:03Z INFO ConfigurationManager] ConfigureAsync
[2021-09-23 13:54:03Z INFO ConfigurationStore] IsConfigured()
[2021-09-23 13:54:03Z INFO ConfigurationStore] IsConfigured: False
[2021-09-23 13:54:03Z INFO ConfigurationManager] Is configured: False
[2021-09-23 13:54:03Z INFO CommandSettings] Arg 'url': 'https://github.com/Misiu/argon40'
[2021-09-23 13:54:03Z INFO CommandSettings] Remove url from Arg dictionary.
[2021-09-23 13:54:03Z INFO CommandSettings] Arg 'token': '***'
[2021-09-23 13:54:03Z INFO CommandSettings] Remove token from Arg dictionary.
[2021-09-23 13:54:04Z INFO ConfigurationManager] Http response code: OK from 'POST https://api.github.com/actions/runner-registration'
[2021-09-23 13:54:04Z INFO ConfigurationManager] cred retrieved via GitHub auth
[2021-09-23 13:54:04Z INFO RunnerServer] Establish connection with 100 seconds timeout.
[2021-09-23 13:54:04Z INFO GitHubActionsService] Starting operation Location.GetConnectionData
[2021-09-23 13:54:04Z INFO RunnerServer] Establish connection with 60 seconds timeout.
[2021-09-23 13:54:04Z INFO GitHubActionsService] Starting operation Location.GetConnectionData
[2021-09-23 13:54:04Z INFO RunnerServer] Establish connection with 60 seconds timeout.
[2021-09-23 13:54:04Z INFO GitHubActionsService] Starting operation Location.GetConnectionData
[2021-09-23 13:54:05Z INFO GitHubActionsService] Finished operation Location.GetConnectionData
[2021-09-23 13:54:05Z INFO GitHubActionsService] Finished operation Location.GetConnectionData
[2021-09-23 13:54:05Z INFO GitHubActionsService] Finished operation Location.GetConnectionData
[2021-09-23 13:54:05Z INFO Terminal] WRITE LINE: 
[2021-09-23 13:54:05Z INFO ConfigurationManager] Test Connection complete.
[2021-09-23 13:54:05Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:05Z INFO HostContext] Well known directory 'Root': 'C:\actions-runner'
[2021-09-23 13:54:05Z INFO HostContext] Well known config file 'RSACredentials': 'C:\actions-runner\.credentials_rsaparams'
[2021-09-23 13:54:05Z INFO RSAEncryptedFileKeyManager] Creating new RSA key using 2048-bit key length
[2021-09-23 13:54:05Z INFO RSAEncryptedFileKeyManager] Successfully saved RSA key parameters to file C:\actions-runner\.credentials_rsaparams
[2021-09-23 13:54:05Z INFO CommandSettings] Arg 'runnergroup': ''
[2021-09-23 13:54:05Z INFO CommandSettings] Flag 'unattended': 'False'
[2021-09-23 13:54:05Z INFO PromptManager] ReadValue
[2021-09-23 13:54:05Z INFO Terminal] WRITE: Enter the name of the runner group to add this runner to: 
[2021-09-23 13:54:05Z INFO Terminal] WRITE: [press Enter for Default] 
[2021-09-23 13:54:05Z INFO Terminal] READ LINE
[2021-09-23 13:54:07Z INFO Terminal] Read value: ''
[2021-09-23 13:54:07Z INFO PromptManager] Falling back to the default: 'Default'
[2021-09-23 13:54:07Z INFO Terminal] WRITE LINE: 
[2021-09-23 13:54:07Z INFO ConfigurationManager] Found a self-hosted runner group with id 1 and name Default
[2021-09-23 13:54:07Z INFO CommandSettings] Flag 'ephemeral': 'False'
[2021-09-23 13:54:07Z INFO CommandSettings] Arg 'name': ''
[2021-09-23 13:54:07Z INFO CommandSettings] Flag 'unattended': 'False'
[2021-09-23 13:54:07Z INFO PromptManager] ReadValue
[2021-09-23 13:54:07Z INFO Terminal] WRITE: Enter the name of runner: 
[2021-09-23 13:54:07Z INFO Terminal] WRITE: [press Enter for TOMKA] 
[2021-09-23 13:54:07Z INFO Terminal] READ LINE
[2021-09-23 13:54:07Z INFO Terminal] Read value: ''
[2021-09-23 13:54:07Z INFO PromptManager] Falling back to the default: 'TOMKA'
[2021-09-23 13:54:07Z INFO Terminal] WRITE LINE: 
[2021-09-23 13:54:07Z INFO CommandSettings] Arg 'labels': ''
[2021-09-23 13:54:07Z INFO CommandSettings] Flag 'unattended': 'False'
[2021-09-23 13:54:07Z INFO PromptManager] ReadValue
[2021-09-23 13:54:07Z INFO Terminal] WRITE: This runner will have the following labels: 'self-hosted', 'Windows', 'X64' 
Enter any additional labels (ex. label-1,label-2): 
[2021-09-23 13:54:07Z INFO Terminal] WRITE: [press Enter to skip] 
[2021-09-23 13:54:07Z INFO Terminal] READ LINE
[2021-09-23 13:54:08Z INFO Terminal] Read value: ''
[2021-09-23 13:54:08Z INFO Terminal] WRITE LINE: 
[2021-09-23 13:54:09Z INFO ConfigurationStore] Saving OAuth credential @ C:\actions-runner\.credentials
[2021-09-23 13:54:09Z INFO ConfigurationStore] Credentials Saved.
[2021-09-23 13:54:09Z INFO ConfigurationStore] HasCredentials()
[2021-09-23 13:54:09Z INFO ConfigurationStore] stored True
[2021-09-23 13:54:09Z INFO CredentialManager] GetCredentialProvider
[2021-09-23 13:54:09Z INFO CredentialManager] Creating type OAuth
[2021-09-23 13:54:09Z INFO CredentialManager] Creating credential type: OAuth
[2021-09-23 13:54:09Z INFO RSAEncryptedFileKeyManager] Loading RSA key parameters from file C:\actions-runner\.credentials_rsaparams
[2021-09-23 13:54:09Z INFO RunnerServer] Establish connection with 100 seconds timeout.
[2021-09-23 13:54:09Z INFO GitHubActionsService] Starting operation Location.GetConnectionData
[2021-09-23 13:54:09Z INFO RunnerServer] Establish connection with 60 seconds timeout.
[2021-09-23 13:54:09Z INFO GitHubActionsService] Starting operation Location.GetConnectionData
[2021-09-23 13:54:09Z INFO RunnerServer] Establish connection with 60 seconds timeout.
[2021-09-23 13:54:09Z INFO GitHubActionsService] Starting operation Location.GetConnectionData
[2021-09-23 13:54:09Z INFO GitHubActionsService] Finished operation Location.GetConnectionData
[2021-09-23 13:54:09Z INFO GitHubActionsService] Finished operation Location.GetConnectionData
[2021-09-23 13:54:10Z INFO GitHubActionsService] Finished operation Location.GetConnectionData
[2021-09-23 13:54:10Z WARN GitHubActionsService] Authentication failed with status code 401.
WWW-Authenticate: Bearer
Strict-Transport-Security: max-age=2592000
X-TFS-ProcessId: b546efdb-5e57-415b-bb90-5b7223f92327
ActivityId: e8a80f48-f652-4562-a013-7743b2359060
X-TFS-Session: 0e4fff96-e20d-4150-afeb-511cc6680401
X-VSS-E2EID: 6facb032-609a-4b4f-9bdf-156bc58c40ef
X-VSS-SenderDeploymentId: 13a19993-c6bc-326c-afb4-32c5519f46f0
X-TFS-ServiceError: The+user+%27System%3aPublicAccess%3baaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa%27+is+not+authorized+to+access+this+resource.
X-VSS-S2STargetService: 0000005A-0000-8888-8000-000000000000/visualstudio.com
X-Cache: CONFIG_NOCACHE
X-MSEdge-Ref: Ref A: A77A211ED4F6446AA35042CBC4F159F4 Ref B: WAW01EDGE0213 Ref C: 2021-09-23T13:54:10Z
Date: Thu, 23 Sep 2021 13:54:10 GMT

[2021-09-23 13:54:10Z INFO RSAEncryptedFileKeyManager] Loading RSA key parameters from file C:\actions-runner\.credentials_rsaparams
[2021-09-23 13:54:10Z INFO RSAEncryptedFileKeyManager] Loading RSA key parameters from file C:\actions-runner\.credentials_rsaparams
[2021-09-23 13:54:11Z INFO GitHubActionsService] AAD Correlation ID for this token request: Unknown
[2021-09-23 13:54:11Z INFO CommandSettings] Arg 'work': ''
[2021-09-23 13:54:11Z INFO CommandSettings] Flag 'unattended': 'False'
[2021-09-23 13:54:11Z INFO PromptManager] ReadValue
[2021-09-23 13:54:11Z INFO Terminal] WRITE: Enter name of work folder: 
[2021-09-23 13:54:11Z INFO Terminal] WRITE: [press Enter for _work] 
[2021-09-23 13:54:11Z INFO Terminal] READ LINE
[2021-09-23 13:54:12Z INFO Terminal] Read value: ''
[2021-09-23 13:54:12Z INFO PromptManager] Falling back to the default: '_work'
[2021-09-23 13:54:12Z INFO ConfigurationStore] Saving runner settings.
[2021-09-23 13:54:12Z INFO ConfigurationStore] Settings Saved.
[2021-09-23 13:54:12Z INFO Terminal] WRITE LINE: 
[2021-09-23 13:54:12Z INFO Terminal] WRITE LINE: 
[2021-09-23 13:54:12Z INFO CommandSettings] Flag 'runasservice': 'False'
[2021-09-23 13:54:12Z INFO CommandSettings] Flag 'unattended': 'False'
[2021-09-23 13:54:12Z INFO PromptManager] ReadValue
[2021-09-23 13:54:12Z INFO Terminal] WRITE: Would you like to run the runner as service? (Y/N) 
[2021-09-23 13:54:12Z INFO Terminal] WRITE: [press Enter for N] 
[2021-09-23 13:54:12Z INFO Terminal] READ LINE
[2021-09-23 13:54:14Z INFO Terminal] Read value: 'y'
[2021-09-23 13:54:14Z INFO ConfigurationManager] Configuring to run the agent as service
[2021-09-23 13:54:14Z INFO CommandSettings] Arg 'windowslogonaccount': ''
[2021-09-23 13:54:14Z INFO CommandSettings] Flag 'unattended': 'False'
[2021-09-23 13:54:14Z INFO PromptManager] ReadValue
[2021-09-23 13:54:14Z INFO Terminal] WRITE: User account to use for the service 
[2021-09-23 13:54:14Z INFO Terminal] WRITE: [press Enter for ZARZĄDZANIE NT\USŁUGA SIECIOWA] 
[2021-09-23 13:54:14Z INFO Terminal] READ LINE
[2021-09-23 13:54:24Z INFO Terminal] Read value: ''
[2021-09-23 13:54:24Z INFO PromptManager] Falling back to the default: 'ZARZĄDZANIE NT\USŁUGA SIECIOWA'
[2021-09-23 13:54:24Z INFO WindowsServiceControlManager] LogonAccount after transforming: ZARZĄDZANIE NT\USŁUGA SIECIOWA, user: USŁUGA SIECIOWA, domain: ZARZĄDZANIE NT
[2021-09-23 13:54:24Z INFO WindowsServiceControlManager] Service name 'actions.runner.Misiu-argon40.TOMKA' display name 'GitHub Actions Runner (Misiu-argon40.TOMKA)' will be used for service configuration.
[2021-09-23 13:54:24Z INFO WindowsServiceControlManager] Verifying if the account has LogonAsService permission
[2021-09-23 13:54:24Z INFO WindowsServiceControlManager] Account: ZARZĄDZANIE NT\USŁUGA SIECIOWA already has Logon As Service Privilege.
[2021-09-23 13:54:24Z INFO WindowsServiceControlManager] Create local group and grant folder permission to service logon account.
[2021-09-23 13:54:24Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:24Z INFO HostContext] Well known directory 'Root': 'C:\actions-runner'
[2021-09-23 13:54:24Z INFO ConfigurationStore] Read setting file: 284 chars
[2021-09-23 13:54:24Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:24Z INFO HostContext] Well known directory 'Root': 'C:\actions-runner'
[2021-09-23 13:54:24Z INFO HostContext] Well known directory 'Work': 'C:\actions-runner\_work'
[2021-09-23 13:54:24Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:24Z INFO NativeWindowsServiceHelper] Calculated unique group name GITHUB_ActionsRunner_G17fda
[2021-09-23 13:54:24Z INFO NativeWindowsServiceHelper] Trying to create group GITHUB_ActionsRunner_G17fda
[2021-09-23 13:54:24Z INFO NativeWindowsServiceHelper] Local Group 'GITHUB_ActionsRunner_G17fda' created
[2021-09-23 13:54:24Z INFO NativeWindowsServiceHelper] Trying to add userName ZARZĄDZANIE NT\USŁUGA SIECIOWA to the group GITHUB_ActionsRunner_G17fda
[2021-09-23 13:54:24Z INFO NativeWindowsServiceHelper] Account 'ZARZĄDZANIE NT\USŁUGA SIECIOWA' is added to local group 'GITHUB_ActionsRunner_G17fda'.
[2021-09-23 13:54:24Z INFO NativeWindowsServiceHelper] Set full access control to group for the folder C:\actions-runner
[2021-09-23 13:54:24Z INFO NativeWindowsServiceHelper] Set full access control to group for the folder C:\actions-runner\_work
[2021-09-23 13:54:24Z INFO NativeWindowsServiceHelper] Local group 'GITHUB_ActionsRunner_G17fda' already has full control to path 'C:\actions-runner\_work'.
[2021-09-23 13:54:24Z INFO Terminal] WRITE LINE: Granting file permissions to 'ZARZĄDZANIE NT\USŁUGA SIECIOWA'.
[2021-09-23 13:54:24Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper] Starting process:
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper]   File name: '"C:\actions-runner\bin\RunnerService.exe"'
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper]   Arguments: 'init'
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper]   Working directory: ''
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper]   Require exit code zero: 'True'
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper]   Encoding web name:  ; code page: ''
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper]   Force kill process on cancellation: 'False'
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper]   Redirected STDIN: 'False'
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper]   Persist current code page: 'False'
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper]   Keep redirected STDIN open: 'False'
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper]   High priority process: 'False'
[2021-09-23 13:54:24Z INFO ProcessInvokerWrapper] Process started with process id 1612, waiting for process exit.
[2021-09-23 13:54:25Z INFO ProcessInvokerWrapper] STDOUT/STDERR stream read finished.
[2021-09-23 13:54:25Z INFO ProcessInvokerWrapper] STDOUT/STDERR stream read finished.
[2021-09-23 13:54:25Z INFO ProcessInvokerWrapper] Finished process 1612 with exit code 0, and elapsed time 00:00:01.1929951.
[2021-09-23 13:54:25Z INFO Terminal] WRITE LINE: Service actions.runner.Misiu-argon40.TOMKA successfully installed
[2021-09-23 13:54:25Z INFO Terminal] WRITE LINE: Service actions.runner.Misiu-argon40.TOMKA successfully set recovery option
[2021-09-23 13:54:25Z INFO Terminal] WRITE LINE: Service actions.runner.Misiu-argon40.TOMKA successfully set to delayed auto start
[2021-09-23 13:54:25Z INFO Terminal] WRITE LINE: Service actions.runner.Misiu-argon40.TOMKA successfully configured
[2021-09-23 13:54:25Z INFO HostContext] Well known directory 'Bin': 'C:\actions-runner\bin'
[2021-09-23 13:54:25Z INFO HostContext] Well known directory 'Root': 'C:\actions-runner'
[2021-09-23 13:54:25Z INFO HostContext] Well known config file 'Service': 'C:\actions-runner\.service'
[2021-09-23 13:54:25Z INFO WindowsServiceControlManager] Configuration was successful, trying to start the service
[2021-09-23 13:54:25Z ERR  NativeWindowsServiceHelper] System.InvalidOperationException: Cannot start service actions.runner.Misiu-argon40.TOMKA on computer '.'.
 ---> System.ComponentModel.Win32Exception (1068): Uruchomienie usługi zależności lub grupy nie powiodło się.
   --- End of inner exception stack trace ---
   at System.ServiceProcess.ServiceController.Start(String[] args)
   at System.ServiceProcess.ServiceController.Start()
   at GitHub.Runner.Listener.Configuration.NativeWindowsServiceHelper.StartService(String serviceName)
[2021-09-23 13:54:25Z ERR  NativeWindowsServiceHelper] #####################################################
[2021-09-23 13:54:25Z ERR  NativeWindowsServiceHelper] System.ComponentModel.Win32Exception (1068): Uruchomienie usługi zależności lub grupy nie powiodło się.
[2021-09-23 13:54:25Z ERR  Terminal] WRITE ERROR: Cannot start the service. Check the logs for more details.
[2021-09-23 13:54:25Z ERR  Runner] System.InvalidOperationException: Cannot start service actions.runner.Misiu-argon40.TOMKA on computer '.'.
 ---> System.ComponentModel.Win32Exception (1068): Uruchomienie usługi zależności lub grupy nie powiodło się.
   --- End of inner exception stack trace ---
   at System.ServiceProcess.ServiceController.Start(String[] args)
   at System.ServiceProcess.ServiceController.Start()
   at GitHub.Runner.Listener.Configuration.NativeWindowsServiceHelper.StartService(String serviceName)
   at GitHub.Runner.Listener.Configuration.WindowsServiceControlManager.ConfigureService(RunnerSettings settings, CommandSettings command)
   at GitHub.Runner.Listener.Configuration.ConfigurationManager.ConfigureAsync(CommandSettings command)
   at GitHub.Runner.Listener.Runner.ExecuteCommand(CommandSettings command)
[2021-09-23 13:54:25Z ERR  Runner] #####################################################
[2021-09-23 13:54:25Z ERR  Runner] System.ComponentModel.Win32Exception (1068): Uruchomienie usługi zależności lub grupy nie powiodło się.
[2021-09-23 13:54:25Z ERR  Terminal] WRITE ERROR: Cannot start service actions.runner.Misiu-argon40.TOMKA on computer '.'.
[2021-09-23 13:54:25Z INFO Listener] Runner execution has finished with return code 1

The service is installed with the default settings. The logon account is set to: image

When I search this account on my PC I have this available: image there is USŁUGA SIECIOWA but without the ZARZĄDZANIE NT prefix.

Misiu commented 2 years ago

I've changed the logon account to: image

and now the service starts. I think the problem was with the account that is used for log on. So instead of ZARZĄDZANIE NT\USŁUGA SIECIOWA (NT AUTHORITY\NETWORK SERVICE ) I must use Usługa sieciowa (Network Service)

Can someone confirm this bug?

Misiu commented 2 years ago

I've done some tests, and when I install (my own) service via PInvoke it is installed correctly and starts and runs without any problem. I'm also setting the permissions, so the service will work as Network Service.

The main difference between my code and the runner code is that I'm installing the service as local account and setting the permissions separately.

Here the service is installed using one call: https://github.com/actions/runner/blob/be9632302ceef50bfb36ea998cea9c94c75e5d4d/src/Runner.Listener/Configuration/NativeWindowsServiceHelper.cs#L486

svcHndl = CreateService(scmHndl,
                        serviceName,
                        serviceDisplayName,
                        ServiceRights.AllAccess,
                        SERVICE_WIN32_OWN_PROCESS,
                        ServiceBootFlag.AutoStart,
                        ServiceError.Normal,
                        runnerServiceExecutable,
                        null,
                        IntPtr.Zero,
                        null,
                        logonAccount,
                        logonPassword);

in my installer I'm doing this as two steps:

service = CreateService(scm, serviceName, displayName, ServiceAccessRights.AllAccess, SERVICE_WIN32_OWN_PROCESS, ServiceBootFlag.AutoStart, ServiceError.Normal,
                        fileName, null, IntPtr.Zero, null, null, null);
if (!ChangeServiceConfig(service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, null, null, IntPtr.Zero, null, logonAccount, logonPassword, null))
{
                        throw new ApplicationException("Unable to set permissions");
}

Can someone explain to me what is the difference? Why the service can't start when it is set to NT AUTHORITY\NETWORK SERVICE?

MichaelVoelkel commented 1 year ago

I've changed the logon account to: image

and now the service starts. I think the problem was with the account that is used for log on. So instead of ZARZĄDZANIE NT\USŁUGA SIECIOWA (NT AUTHORITY\NETWORK SERVICE ) I must use Usługa sieciowa (Network Service)

Can someone confirm this bug?

Yes, same here with Win10. And your workaround fixes it, so thanks a lot for that :)

Wow, bug open for quite some time. This is essential for having the runner run on Windows