Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Self-Hosted Agent doesn't start with default configuration on Windows 11 without domain and with German language #4805

Open
1 of 4 tasks
SteffenBra opened this issue May 22, 2024 · 1 comment

Comments

@SteffenBra
Copy link

What happened?

We created a new Azure Windows VM and set the system language to German. The VM has no domain. When we tried to configure the self hosted agent with default configuration cmd.exe /c ".\config.cmd" --pool "<poolname>" --agent "<agentname>" --runAsService --unattended --url "<url>" --auth pat --token "<pat>" the service cannot be started. After some investigation we found that the Account for the service was set to "NT-Autorität\Netzwerkdienst" which is not a valid username on the VM. After switching the Account to "Netzwerkdienst" the agent started without problems.
This behaviour only occurs with the system language set to German, with English language the serviceaccount is set to "NetworkService" correctly.

Our workaround was to add the parameter --windowsLogonAccount "NT AUTHORITY\NetworkService" to the config call. With this parameter the account for the service was set to "Netzwerkdienst" correctly.

Our expectation is that the default configuration should work with the german language and that the Service Account is set correctly for Windows Machines without a domain.

Versions

Azure DevOps Agent v3.238.0, Windows 11 Pro Version 10.0.22621 Build 22621

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows 11 Pro Version 10.0.22621 Build 22621

Version controll system

No response

Relevant log output

[2024-05-22 07:39:54Z INFO ConfigurationManager] Configuring to run the agent as service
[2024-05-22 07:39:54Z INFO CommandSettings] Flag 'enableservicesidtypeunrestricted': 'False'
[2024-05-22 07:39:54Z INFO CommandSettings] Flag 'unattended': 'True'
[2024-05-22 07:39:54Z INFO PromptManager] ReadValue
[2024-05-22 07:39:54Z INFO CommandSettings] Flag 'deploymentgroup': 'False'
[2024-05-22 07:39:54Z INFO CommandSettings] Flag 'deploymentpool': 'False'
[2024-05-22 07:39:54Z INFO CommandSettings] Flag 'environment': 'False'
[2024-05-22 07:39:54Z INFO CommandSettings] Arg 'windowslogonaccount': ''
[2024-05-22 07:39:54Z INFO CommandSettings] Flag 'unattended': 'True'
[2024-05-22 07:39:54Z INFO PromptManager] ReadValue
[2024-05-22 07:39:54Z INFO WindowsServiceControlManager] LogonAccount after transforming: NT-AUTORITÄT\Netzwerkdienst, user: Netzwerkdienst, domain: NT-AUTORITÄT
[2024-05-22 07:39:54Z INFO WindowsServiceControlManager] Service name '<servicename>' display name 'Azure Pipelines Agent (<agentname>)' will be used for service configuration.
[2024-05-22 07:39:54Z INFO WindowsServiceControlManager] Verifying if the account has LogonAsService permission
[2024-05-22 07:39:54Z INFO WindowsServiceControlManager] Account: NT-AUTORITÄT\Netzwerkdienst already has Logon As Service Privilege.
[2024-05-22 07:39:54Z INFO WindowsServiceControlManager] Create local group and grant folder permission to service logon account.
[2024-05-22 07:39:54Z INFO HostContext] Well known directory 'Bin': 'C:\Program Files\<name>\_agent\bin'
[2024-05-22 07:39:54Z INFO HostContext] Well known directory 'Root': 'C:\Program Files\<name>\_agent'
[2024-05-22 07:39:54Z INFO ConfigurationStore] Read setting file: 195 chars
[2024-05-22 07:39:54Z INFO HostContext] Well known directory 'Bin': 'C:\Program Files\<name>\_agent\bin'
[2024-05-22 07:39:54Z INFO HostContext] Well known directory 'Root': 'C:\Program Files\<name>\_agent'
[2024-05-22 07:39:54Z INFO HostContext] Well known directory 'Work': 'C:\Program Files\<name>\_agent\_work'
[2024-05-22 07:39:54Z INFO HostContext] Well known directory 'Bin': 'C:\Program Files\<name>\_agent\bin'
[2024-05-22 07:39:54Z INFO NativeWindowsServiceHelper] Calculated unique group name VSTS_AgentService_Gf84c6
[2024-05-22 07:39:54Z INFO NativeWindowsServiceHelper] Trying to create group VSTS_AgentService_Gf84c6
[2024-05-22 07:39:54Z INFO NativeWindowsServiceHelper] Local Group 'VSTS_AgentService_Gf84c6' created
[2024-05-22 07:39:54Z INFO NativeWindowsServiceHelper] Trying to add userName NT-AUTORITÄT\Netzwerkdienst to the group VSTS_AgentService_Gf84c6
[2024-05-22 07:39:54Z INFO NativeWindowsServiceHelper] Account 'NT-AUTORITÄT\Netzwerkdienst' is added to local group 'VSTS_AgentService_Gf84c6'.
[2024-05-22 07:39:54Z INFO NativeWindowsServiceHelper] Set full access control to group for the folder C:\Program Files\<name>\_agent
[2024-05-22 07:39:54Z INFO NativeWindowsServiceHelper] Set full access control to group for the folder C:\Program Files\<name>\_agent\_work
[2024-05-22 07:39:54Z INFO NativeWindowsServiceHelper] Local group 'VSTS_AgentService_Gf84c6' already has full control to path 'C:\Program Files\<name>\_agent\_work'.
[2024-05-22 07:39:54Z INFO Terminal] WRITE LINE: „NT-AUTORITÄT\Netzwerkdienst“ werden Dateiberechtigungen erteilt.
[2024-05-22 07:39:54Z WARN NativeWindowsServiceHelper] NetIsServiceAccount return code is 3221356567
[2024-05-22 07:39:54Z INFO NativeWindowsServiceHelper] Account 'NT-AUTORITÄT\Netzwerkdienst' is managed service account: False.
[2024-05-22 07:39:54Z INFO HostContext] Well known directory 'Bin': 'C:\Program Files\<name>\_agent\bin'
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper] Starting process:
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper]   File name: '"C:\Program Files\<name>\_agent\bin\AgentService.exe"'
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper]   Arguments: 'init'
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper]   Working directory: ''
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper]   Require exit code zero: 'True'
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper]   Encoding web name:  ; code page: ''
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper]   Force kill process on cancellation: 'False'
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper]   Redirected STDIN: 'False'
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper]   Persist current code page: 'False'
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper]   Keep redirected STDIN open: 'False'
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper]   High priority process: 'False'
[2024-05-22 07:39:54Z INFO ProcessInvokerWrapper]   ContinueAfterCancelProcessTreeKillAttempt: 'False'
[2024-05-22 07:39:55Z INFO ProcessInvokerWrapper] OOM score adjustment is Linux-only.
[2024-05-22 07:39:55Z INFO ProcessInvokerWrapper] Process started with process id 5300, waiting for process exit.
[2024-05-22 07:39:55Z INFO ProcessInvokerWrapper] STDOUT/STDERR stream read finished.
[2024-05-22 07:39:55Z INFO ProcessInvokerWrapper] STDOUT/STDERR stream read finished.
[2024-05-22 07:39:55Z INFO ProcessInvokerWrapper] Exited process 5300 with exit code 0
[2024-05-22 07:39:55Z INFO ProcessInvokerWrapper] Finished process 5300 with exit code 0, and elapsed time 00:00:00.6508554.
[2024-05-22 07:39:55Z INFO Terminal] WRITE LINE: Der Dienst „<servicename>“ wurde erfolgreich installiert.
[2024-05-22 07:39:55Z INFO Terminal] WRITE LINE: Der Dienst „<servicename>“ hat die Wiederherstellungsoption erfolgreich festgelegt.
[2024-05-22 07:39:55Z INFO Terminal] WRITE LINE: Der Dienst „<servicename>“ für verzögerten Autostart wurde erfolgreich festgelegt.
[2024-05-22 07:39:55Z INFO Terminal] WRITE LINE: Der Dienst „<servicename>“ wurde erfolgreich konfiguriert.
[2024-05-22 07:39:55Z INFO HostContext] Well known directory 'Bin': 'C:\Program Files\<name>\_agent\bin'
[2024-05-22 07:39:55Z INFO HostContext] Well known directory 'Root': 'C:\Program Files\<name>\_agent'
[2024-05-22 07:39:55Z INFO HostContext] Well known config file 'Service': 'C:\Program Files\<name>\_agent\.service'
[2024-05-22 07:39:55Z INFO HostContext] Well known directory 'Bin': 'C:\Program Files\<name>\_agent\bin'
[2024-05-22 07:39:55Z INFO HostContext] Well known directory 'Bin': 'C:\Program Files\<name>\_agent\bin'
[2024-05-22 07:39:55Z INFO WindowsServiceControlManager] Configuration was successful, trying to start the service
[2024-05-22 07:39:55Z INFO CommandSettings] Flag 'preventservicestart': 'False'
[2024-05-22 07:39:55Z INFO CommandSettings] Flag 'unattended': 'True'
[2024-05-22 07:39:55Z INFO PromptManager] ReadValue
[2024-05-22 07:39:55Z ERR  NativeWindowsServiceHelper] System.InvalidOperationException: Cannot start service '<servicename>' on computer '.'.
 ---> System.ComponentModel.Win32Exception (1068): Der Abhängigkeitsdienst oder die Abhängigkeitsgruppe konnte nicht gestartet werden.
   --- End of inner exception stack trace ---
   at System.ServiceProcess.ServiceController.Start(String[] args)
   at System.ServiceProcess.ServiceController.Start()
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.NativeWindowsServiceHelper.StartService(String serviceName) in D:\a\_work\1\s\src\Agent.Listener\Configuration.Windows\NativeWindowsServiceHelper.cs:line 733
[2024-05-22 07:39:55Z ERR  Terminal] WRITE ERROR: Der Dienst kann nicht gestartet werden. Weitere Informationen finden Sie in den Protokollen.
[2024-05-22 07:39:55Z ERR  Agent] System.InvalidOperationException: Cannot start service '<servicename>' on computer '.'.
 ---> System.ComponentModel.Win32Exception (1068): Der Abhängigkeitsdienst oder die Abhängigkeitsgruppe konnte nicht gestartet werden.
   --- End of inner exception stack trace ---
   at System.ServiceProcess.ServiceController.Start(String[] args)
   at System.ServiceProcess.ServiceController.Start()
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.NativeWindowsServiceHelper.StartService(String serviceName) in D:\a\_work\1\s\src\Agent.Listener\Configuration.Windows\NativeWindowsServiceHelper.cs:line 733
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.WindowsServiceControlManager.ConfigureService(AgentSettings settings, CommandSettings command) in D:\a\_work\1\s\src\Agent.Listener\Configuration.Windows\WindowsServiceControlManager.cs:line 153
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.ConfigurationManager.ConfigureAsync(CommandSettings command) in D:\a\_work\1\s\src\Agent.Listener\Configuration\ConfigurationManager.cs:line 442
   at Microsoft.VisualStudio.Services.Agent.Listener.Agent.ExecuteCommand(CommandSettings command) in D:\a\_work\1\s\src\Agent.Listener\Agent.cs:line 103
[2024-05-22 07:39:55Z ERR  Terminal] WRITE ERROR: Cannot start service '<servicename>' on computer '.'.
@DmitriiBobreshev
Copy link
Contributor

Hi @SteffenBra, Thank you for the feedback. We we'll take a look and will try to fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants