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

Windows Container fails to install & start service #1894

Open
atehrani-statrad opened this issue Feb 20, 2025 · 4 comments · May be fixed by #1907
Open

Windows Container fails to install & start service #1894

atehrani-statrad opened this issue Feb 20, 2025 · 4 comments · May be fixed by #1907
Labels

Comments

@atehrani-statrad
Copy link

Current Behavior

I am using the following Docker image mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2022 and have my application installed and running on it. I am attempting to install and start the windows_exporter to obtain metrics.

Snippets from my Containerfile

ADD https://github.com/prometheus-community/windows_exporter/releases/download/v0.30.4/windows_exporter-0.30.4-amd64.msi C:\windows_exporter.msi
RUN powershell -Command Start-Process msiexec.exe -ArgumentList '/i', 'C:\windows_exporter.msi', 'ENABLED_COLLECTORS=os,iis,eventlog', '/quiet', '/norestart', '/log windows_exporter_install.log' -NoNewWindow -Wait

However, the installation fails, as it fails to start the windows_exporter service.

Expected Behavior

Expected behavior is that the installation succeeds

Steps To Reproduce

Simple Containerfile

FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2022 AS final
FROM final
WORKDIR /inetpub/wwwroot
ADD https://github.com/prometheus-community/windows_exporter/releases/download/v0.30.4/windows_exporter-0.30.4-amd64.msi C:\windows_exporter.msi
RUN powershell -Command Start-Process msiexec.exe -ArgumentList '/i', 'C:\windows_exporter.msi', 'ENABLED_COLLECTORS=os,iis,eventlog', '/quiet', '/norestart', '/log windows_exporter_install.log' -NoNewWindow -Wait

Environment

  • windows_exporter Version: 0.30.4
  • Windows Server Version: Microsoft Windows [Version 10.0.20348.3207]

windows_exporter logs

This is the log file from msiexec
=== Logging started: 2/20/2025  8:37:24 ===
Action start 8:37:24: INSTALL.
Action start 8:37:24: FindRelatedProducts.
Action ended 8:37:24: FindRelatedProducts. Return value 1.
Action start 8:37:24: LaunchConditions.
Action ended 8:37:24: LaunchConditions. Return value 1.
Action start 8:37:24: ValidateProductID.
Action ended 8:37:24: ValidateProductID. Return value 1.
Action start 8:37:24: CostInitialize.
Action ended 8:37:24: CostInitialize. Return value 1.
Action start 8:37:24: FileCost.
Action ended 8:37:24: FileCost. Return value 1.
Action start 8:37:24: CostFinalize.
Action ended 8:37:24: CostFinalize. Return value 1.
Action start 8:37:24: MigrateFeatureStates.
Action ended 8:37:24: MigrateFeatureStates. Return value 0.
Action start 8:37:24: InstallValidate.
Action ended 8:37:24: InstallValidate. Return value 1.
Action start 8:37:24: InstallInitialize.
Action ended 8:37:24: InstallInitialize. Return value 1.
Action start 8:37:24: RemoveExistingProducts.
Action ended 8:37:24: RemoveExistingProducts. Return value 1.
Action start 8:37:24: ProcessComponents.
Action ended 8:37:24: ProcessComponents. Return value 1.
Action start 8:37:24: UnpublishFeatures.
Action ended 8:37:24: UnpublishFeatures. Return value 1.
Action start 8:37:24: StopServices.
Action ended 8:37:24: StopServices. Return value 1.
Action start 8:37:24: DeleteServices.
Action ended 8:37:24: DeleteServices. Return value 1.
Action start 8:37:24: RemoveRegistryValues.
Action ended 8:37:24: RemoveRegistryValues. Return value 1.
Action start 8:37:24: SetKillProcess.
Action ended 8:37:24: SetKillProcess. Return value 1.
Action start 8:37:24: KillProcess.
Action ended 8:37:24: KillProcess. Return value 1.
Action start 8:37:24: Wix5SchedFirewallExceptionsUninstall_X64.
SchedFirewallExceptions:  Component 'C_FirewallException' action state (0) doesn't match request (2)
SchedFirewallExceptions:  No firewall exceptions scheduled
Action ended 8:37:24: Wix5SchedFirewallExceptionsUninstall_X64. Return value 1.
Action start 8:37:24: RemoveFiles.
Action ended 8:37:24: RemoveFiles. Return value 0.
Action start 8:37:24: RemoveFolders.
Action ended 8:37:24: RemoveFolders. Return value 1.
Action start 8:37:24: CreateFolders.
Action ended 8:37:24: CreateFolders. Return value 1.
Action start 8:37:24: InstallFiles.
Action ended 8:37:24: InstallFiles. Return value 1.
Action start 8:37:24: SetCollectorsFlag.
Action ended 8:37:24: SetCollectorsFlag. Return value 1.
Action start 8:37:24: SetConfigFile_Default.
Action ended 8:37:24: SetConfigFile_Default. Return value 1.
Action start 8:37:24: SetConfigFileFlag.
Action ended 8:37:24: SetConfigFileFlag. Return value 1.
Action start 8:37:24: Wix5SchedFirewallExceptionsInstall_X64.
SchedFirewallExceptions:  Component 'C_FirewallException' action state (0) doesn't match request (1)
SchedFirewallExceptions:  No firewall exceptions scheduled
Action ended 8:37:24: Wix5SchedFirewallExceptionsInstall_X64. Return value 1.
Action start 8:37:24: WriteRegistryValues.
Action ended 8:37:24: WriteRegistryValues. Return value 1.
Action start 8:37:24: SetCreateConfigFile.
Action ended 8:37:24: SetCreateConfigFile. Return value 1.
Action start 8:37:24: CreateConfigFile.
Action ended 8:37:24: CreateConfigFile. Return value 1.
Action start 8:37:24: InstallServices.
Action ended 8:37:24: InstallServices. Return value 1.
Action start 8:37:24: Wix4SchedServiceConfig_X64.
Action start 8:37:24: Wix4RollbackServiceConfig_X64.
Action ended 8:37:24: Wix4RollbackServiceConfig_X64. Return value 1.
Action start 8:37:24: Wix4ExecServiceConfig_X64.
Action ended 8:37:24: Wix4ExecServiceConfig_X64. Return value 1.
Action ended 8:37:24: Wix4SchedServiceConfig_X64. Return value 1.
Action start 8:37:24: MsiConfigureServices.
Action ended 8:37:24: MsiConfigureServices. Return value 1.
Action start 8:37:24: StartServices.
Action ended 8:37:24: StartServices. Return value 1.
Action start 8:37:24: RegisterUser.
Action ended 8:37:24: RegisterUser. Return value 1.
Action start 8:37:24: RegisterProduct.
Action ended 8:37:24: RegisterProduct. Return value 1.
Action start 8:37:24: PublishFeatures.
Action ended 8:37:24: PublishFeatures. Return value 1.
Action start 8:37:24: PublishProduct.
Action ended 8:37:24: PublishProduct. Return value 1.
Action start 8:37:24: InstallFinalize.
WixQuietExec:  ERROR: The process "windows_exporter.exe" not found.
WixQuietExec:  Error 0x80070080: Command line returned an error.
WixQuietExec:  Error 0x80070080: QuietExec Failed
WixQuietExec:  Error 0x80070080: Failed in ExecCommon method
CustomAction KillProcess returned actual error code 1603 but will be translated to success due to continue marking
MSI (s) (18:30) [08:37:54:743]: Product: windows_exporter -- Error 1920. Service 'windows_exporter' (windows_exporter) failed to start. Verify that you have sufficient privileges to start system services.

Error 1920. Service 'windows_exporter' (windows_exporter) failed to start. Verify that you have sufficient privileges to start system services.
Action ended 8:37:54: InstallFinalize. Return value 3.
Action ended 8:37:54: INSTALL. Return value 3.
Property(S): ALLUSERS = 1
Property(S): CONFIG_FILE = config.yaml
Property(S): LISTEN_PORT = 9182
Property(S): ARPHELPLINK = https://github.com/prometheus-community/windows_exporter/issues
Property(S): ARPSIZE = 9000
Property(S): ARPURLINFOABOUT = https://github.com/prometheus-community/windows_exporter
Property(S): START_MENU_FOLDER = 0
Property(S): NOSTART = 0
Property(S): Manufacturer = prometheus-community
Property(S): ProductCode = {007D0223-1CC1-402D-808D-66D89A1ECE9D}
Property(S): ProductLanguage = 1033
Property(S): ProductName = windows_exporter
Property(S): ProductVersion = 0.30.4
Property(S): UpgradeCode = {66A6EB5B-1FC2-4B14-A362-5CEEC6413308}
Property(S): DefaultUIFont = WixUI_Font_Normal
Property(S): ErrorDialog = ErrorDlg
Property(S): WixUIRMOption = UseRM
Property(S): SecureCustomProperties = BURNMSIMODIFY;BURNMSIREPAIR;BURNMSIUNINSTALL;CONFIG_FILE;ENABLED_COLLECTORS;EXTRA_FLAGS;LISTEN_PORT;METRICS_PATH;NEWERVERSIONDETECTED;OLDERVERSIONBEINGUPGRADED;REMOTE_ADDR;TEXTFILE_DIRS;WIX_DOWNGRADE_DETECTED;WIX_UPGRADE_DETECTED
Property(S): CreateConfigFile = "C:\Windows\system32\cmd.exe" /c TYPE NUL >>"C:\Program Files\windows_exporter\config.yaml"
Property(S): KillProcess = "C:\Windows\\System32\taskkill.exe" /T /F /IM windows_exporter.exe
Property(S): CollectorsFlag = --collectors.enabled os,iis,eventlog
Property(S): ConfigFile_Default = C:\Program Files\windows_exporter\config.yaml
Property(S): ConfigFileFlag = --config.file="C:\Program Files\windows_exporter\config.yaml"
Property(S): Wix4ExecServiceConfig_X64 = SchedServiceConfigwindows_exporter1restartrestartrestart060
Property(S): Wix4RollbackServiceConfig_X64 = SchedServiceConfig
Property(S): APPLICATIONFOLDER = C:\Program Files\windows_exporter\
Property(S): ENABLED_COLLECTORS = os,iis,eventlog
Property(S): textfile_inputs = C:\Program Files\windows_exporter\textfile_inputs\
Property(S): ProgramFiles64Folder = C:\Program Files\
Property(S): TARGETDIR = C:\
Property(S): SourceDir = C:\
Property(S): VersionNT = 603
Property(S): MsiLogFileLocation = C:\windows_exporter_install.log
Property(S): PackageCode = {F1AFFE41-7844-474A-8BC2-DE6946EF2E2C}
Property(S): ProductState = -1
Property(S): PackagecodeChanging = 1
Property(S): REBOOT = ReallySuppress
Property(S): CURRENTDIRECTORY = C:\
Property(S): CLIENTUILEVEL = 3
Property(S): CLIENTPROCESSID = 1388
Property(S): VersionDatabase = 500
Property(S): VersionMsi = 5.00
Property(S): VersionNT64 = 603
Property(S): WindowsBuild = 9600
Property(S): ServicePackLevel = 0
Property(S): ServicePackLevelMinor = 0
Property(S): MsiNTProductType = 3
Property(S): MsiNTSuiteDataCenter = 1
Property(S): WindowsFolder = C:\Windows\
Property(S): WindowsVolume = C:\
Property(S): System64Folder = C:\Windows\system32\
Property(S): SystemFolder = C:\Windows\SysWOW64\
Property(S): RemoteAdminTS = 1
Property(S): TempFolder = C:\Users\ContainerAdministrator\AppData\Local\Temp\
Property(S): ProgramFilesFolder = C:\Program Files (x86)\
Property(S): CommonFilesFolder = C:\Program Files (x86)\Common Files\
Property(S): CommonFiles64Folder = C:\Program Files\Common Files\
Property(S): AppDataFolder = C:\Users\ContainerAdministrator\AppData\Roaming\
Property(S): FavoritesFolder = C:\Users\ContainerAdministrator\Favorites\
Property(S): NetHoodFolder = C:\Users\ContainerAdministrator\AppData\Roaming\Microsoft\Windows\Network Shortcuts\
Property(S): PersonalFolder = C:\Users\ContainerAdministrator\Documents\
Property(S): PrintHoodFolder = C:\Users\ContainerAdministrator\AppData\Roaming\Microsoft\Windows\Printer Shortcuts\
Property(S): RecentFolder = C:\Users\ContainerAdministrator\AppData\Roaming\Microsoft\Windows\Recent\
Property(S): SendToFolder = C:\Users\ContainerAdministrator\AppData\Roaming\Microsoft\Windows\SendTo\
Property(S): TemplateFolder = C:\ProgramData\Microsoft\Windows\Templates\
Property(S): CommonAppDataFolder = C:\ProgramData\
Property(S): LocalAppDataFolder = C:\Users\ContainerAdministrator\AppData\Local\
Property(S): MyPicturesFolder = C:\Users\ContainerAdministrator\Pictures\
Property(S): AdminToolsFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\
Property(S): StartupFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\
Property(S): ProgramMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\
Property(S): StartMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\
Property(S): DesktopFolder = C:\Users\Public\Desktop\
Property(S): FontsFolder = C:\Windows\Fonts\
Property(S): GPTSupport = 1
Property(S): OLEAdvtSupport = 1
Property(S): ShellAdvtSupport = 1
Property(S): MsiAMD64 = 6
Property(S): Msix64 = 6
Property(S): Intel = 6
Property(S): PhysicalMemory = 1023
Property(S): VirtualMemory = 2173
Property(S): AdminUser = 1
Property(S): MsiTrueAdminUser = 1
Property(S): LogonUser = ContainerAdministrator
Property(S): UserSID = S-1-5-93-2-1
Property(S): UserLanguageID = 1033
Property(S): ComputerName = EE513EF960D1
Property(S): SystemLanguageID = 1033
Property(S): ScreenX = 1024
Property(S): ScreenY = 768
Property(S): CaptionHeight = 23
Property(S): BorderTop = 1
Property(S): BorderSide = 1
Property(S): TextHeight = 16
Property(S): TextInternalLeading = 3
Property(S): ColorBits = 32
Property(S): TTCSupport = 1
Property(S): Time = 8:37:54
Property(S): Date = 2/20/2025
Property(S): MsiNetAssemblySupport = 4.8.4161.0
Property(S): MsiWin32AssemblySupport = 10.0.20348.2849
Property(S): RedirectedDllSupport = 2
Property(S): MsiRunningElevated = 1
Property(S): Privileged = 1
Property(S): DATABASE = C:\Windows\Installer\a03c62.msi
Property(S): OriginalDatabase = C:\windows_exporter.msi
Property(S): UILevel = 2
Property(S): ACTION = INSTALL
Property(S): ROOTDRIVE = C:\
Property(S): CostingComplete = 1
Property(S): OutOfDiskSpace = 0
Property(S): OutOfNoRbDiskSpace = 0
Property(S): PrimaryVolumeSpaceAvailable = 0
Property(S): PrimaryVolumeSpaceRequired = 0
Property(S): PrimaryVolumeSpaceRemaining = 0
Property(S): INSTALLLEVEL = 1
Property(S): SourcedirProduct = {007D0223-1CC1-402D-808D-66D89A1ECE9D}
Property(S): SOURCEDIR = C:\
Property(S): ProductToBeRegistered = 1
MSI (s) (18:30) [08:37:54:807]: Product: windows_exporter -- Installation failed.

MSI (s) (18:30) [08:37:54:822]: Windows Installer installed the product. Product Name: windows_exporter. Product Version: 0.30.4. Product Language: 1033. Manufacturer: prometheus-community. Installation success or error status: 1603.

=== Logging stopped: 2/20/2025  8:37:54 ===

Anything else?

This issue seems to be very similar to #1838

@jkroepke
Copy link
Member

jkroepke commented Feb 21, 2025

Hi @atehrani-statrad

thats expected. The golang stdlib does not support that context (running the exporter as a windows service inside a container).

the scenario is not supported unless it's fixed upstream.

instead using the msi, I would recommend to download the exe from GitHub and start the exporter directly.

Ref:

@atehrani-statrad
Copy link
Author

@jkroepke Thank you for the quick response. I have tried to run the exe, however having issues ensuring it runs in the background like a service (are there examples?)

Containerfile snippets

ADD https://github.com/prometheus-community/windows_exporter/releases/download/v0.30.4/windows_exporter-0.30.4-amd64.exe C:\windows_exporter.exe
RUN powershell -Command "Unblock-File -Path C:\windows_exporter.exe"
RUN powershell -Command Start-Job -ScriptBlock { Start-Process -FilePath "C:\windows_exporter.exe" -ArgumentList "\"--collectors.enabled="cpu,logical_disk,memory,net,os,physical_disk,service,system,iis,process\"","--collector.process.iis","--web.listen-address=:9182","--log.file=C:\inetpub\logs\windows-exporter.log" -NoNewWindow }

The final command does not seem to have it run in the background

@jkroepke
Copy link
Member

You can run windows_export just in foreground and run it as dedicated container. Thats it preferred and supported way.

@jkroepke jkroepke linked a pull request Feb 28, 2025 that will close this issue
3 tasks
@jkroepke
Copy link
Member

jkroepke commented Feb 28, 2025

please check, if the following snapshot build fixes your use-case:

https://github.com/prometheus-community/windows_exporter/actions/runs/13613018234/artifacts/2676889026

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

Successfully merging a pull request may close this issue.

2 participants