prometheus-community / windows_exporter

Prometheus exporter for Windows machines
MIT License
2.92k stars 703 forks source link

msi "Installation failed" on Windows server 2003 64-bit #46

Closed bbigras closed 7 years ago

bbigras commented 7 years ago

I got these 4 events:

Event Type: Information
Event Source:   MsiInstaller
Event Category: None
Event ID:   1040
Date:       12/9/2016
Time:       13:38:57
User:       <host>\<user>
Computer:   <host>
Description:
Beginning a Windows Installer transaction: D:\wmi_exporter-0.1.1-amd64.msi. Client Process Id: 8076.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Event Type: Information
Event Source:   MsiInstaller
Event Category: None
Event ID:   1042
Date:       12/9/2016
Time:       13:38:57
User:       NT AUTHORITY\SYSTEM
Computer:   <host>
Description:
Ending a Windows Installer transaction: D:\wmi_exporter-0.1.1-amd64.msi. Client Process Id: 8076.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Event Type: Information
Event Source:   MsiInstaller
Event Category: None
Event ID:   11708
Date:       12/9/2016
Time:       13:38:57
User:       <host>\<user>
Computer:   <host>
Description:
Product: WMI Exporter -- Installation failed.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 7b 43 31 46 39 44 42 38   {C1F9DB8
0008: 41 2d 38 30 44 41 2d 34   A-80DA-4
0010: 31 41 33 2d 39 41 35 46   1A3-9A5F
0018: 2d 34 37 38 34 39 30 37   -4784907
0020: 44 41 33 37 38 7d         DA378}  
Event Type: Information
Event Source:   MsiInstaller
Event Category: None
Event ID:   1033
Date:       12/9/2016
Time:       13:38:57
User:       <host>\<user>
Computer:   <host>
Description:
Windows Installer installed the product. Product Name: WMI Exporter. Product Version: 0.1.1. Product Language: 1033. Installation success or error status: 1603.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 7b 43 31 46 39 44 42 38   {C1F9DB8
0008: 41 2d 38 30 44 41 2d 34   A-80DA-4
0010: 31 41 33 2d 39 41 35 46   1A3-9A5F
0018: 2d 34 37 38 34 39 30 37   -4784907
0020: 44 41 33 37 38 7d         DA378}  
carlpett commented 7 years ago

Hi @brunoqc! Thanks for reporting, and apologies for the slow response, I'm travelling with poor internet access. The error you're getting is a generic "something went wrong". Here are a few things to check:

  1. Is there a pending restart? For instance a Windows update that hasn't finalized yet, or some other software installation?
  2. How are you starting the installer? Commandline or gui?
  3. Windows 2003 was pre-UAC dialog, so I'm not sure how it would handle elevation... Does the user you are starting as have enough permissions to install in the Program Files directory?

It could also be related to some inconpatibility between the Windows Installer framework features we're using and what Windows 2003 provides. I'll need to do some research on that though, which will have to wait a few days until I'm home.

bbigras commented 7 years ago
  1. Is there a pending restart?

That is very possible. It's a server that doesn't reboot often.

  1. How are you starting the installer?

I tried both.

  1. Does the user you are starting as have enough permissions to install in the Program Files directory?

Yes

I'll try to schedule a server restart tonight and test again tomorrow.

carlpett commented 7 years ago

@brunoqc Did you manage to test the reboot? In case that did not fix it, some more questions:

  1. Does the server have any service packs installed?
  2. Could you try the installation with logging enabled? msiexec /i D:\wmi_exporter-0.1.1-amd64.msi /l*v D:\wmi_exporter-installer.log
bbigras commented 7 years ago

Did you manage to test the reboot?

No. Well I tried twice but I think I didn't use quotes the right way when running the at command. I'm trying again tonight.

Does the server have any service packs installed?

Windows Server 2003 R2 with Service Pack 2.

Could you try the installation with logging enabled?

wmi_exporter-installer.log.zip

carlpett commented 7 years ago

@brunoqc Thanks! I found this in the logs:

ExecFirewallExceptions: FirewallExtension: Cannot add firewall rule 'WMI Exporter (HTTP 9182)', which defines both an application and a port or protocol. Such a rule requires Microsoft Windows Vista or later.

So, we're using too modern features, basically. Are you having the firewall activated? If I recall correctly it was not on by default in those older versions. Maybe we should just skip installing the firewall rule for old versions? Alternatively we could have some installer flag for toggling it off.

I've build a custom msi without the firewall rule, could you give it a shot and see if it works better? https://www.dropbox.com/s/8ruzllesvvifh41/wmi_exporter-0.1.1-amd64.msi?dl=0

bbigras commented 7 years ago

Are you having the firewall activated?

No. The "Windows Firewall/Internet Connection Sharing (ICS) service" is not running.

Maybe we should just skip installing the firewall rule for old versions?

Can you detect if it's activated with the msi?

I've build a custom msi without the firewall rule

It works!

carlpett commented 7 years ago

Ok, great! Then there aren't other things that also break :) As for detection - msi:s conditions are pretty simplistic in themselves. I'll have to check the docs, but it would probably require building a custom dll for the installer and all the associated maintenance. So, I'd probably rather provide a flag for those slightly older OSes than make the normal flow hard to understand. Seems reasonable?

bbigras commented 7 years ago

Seems reasonable?

Yes. A flag is fine.

franciscomorra commented 7 years ago

Hi! Is the flag included in the installer as of today? Dropbox link is dead

martinlindhe commented 7 years ago

Hi @franciscomorra I think the link that @carlpett provided above on Dropbox only had extra logging enabled in order to track down this original bug. As far as i can tell, the flag hasn't been implemented yet.

If you are running Windows Server 2003, you could try out the non-installer download option instead. Also be aware of #49, meaning you would need to disable the "cs" collector

carlpett commented 7 years ago

@franciscomorra I started working on the flag yesterday, however, due to the events in Stockholm, I was not able finish that work. It should be pretty straightforward once I have time to work on it, though.

carlpett commented 7 years ago

@franciscomorra What was your use-case for the flag? Are you also using a version which does not support the Windows Firewall? I just noticed that there is actually an option when creating the firewall to ignore errors. This would be a much simpler solution, but it would not provide for the use-case of not creating the firewall rule on versions of Windows which support it.

franciscomorra commented 7 years ago

@carlpett Exactly, the error in Windows Server 2003 is the same as @bbigras Right now i got it working with the .exe without installing as a service so the error must be on the firewall config of the .msi