-
Notifications
You must be signed in to change notification settings - Fork 812
Windows Agent Installation
For general instructions on how to install and use the Agent on Windows, please refer to https://docs.datadoghq.com/agent/basic_agent_usage/windows/
So what’s the big deal with the upgrade to Datadog Agent 5.12 on Windows? Well, to answer that, there’s a bit of history required.
Prior to 5.12, the Datadog Agent installer was built, by default to be what’s known in the Windows world as a “per-user” installation. This type of installation is intended for end-user software, not for a system service like the Datadog Agent. With the release of 5.12, the Datadog Agent is now installed “per-machine”, always, as it should be.
Note: If you're upgrading to a v6 Agent from a pre-5.12 version, please first follow the instructions below to upgrade to a more recent version of Agent v5 (>= 5.12.0 but < 6.0.0), and then upgrade to v6.
The most significant problem with a “per-user” install is that Windows only makes the installation data (think the list in “Add/Remove Programs”) available to the user that did the install, rather than any administrator. So, if the Datadog Agent was installed when the logged in user was “Administrator”, if “bob” logs in, even though he’s in the administrator’s group, he won’t see the Datadog Agent install (even though it’s running normally).
The 5.12 installer has some features to help simplify this whole situation, but the most significant concept is this: to upgrade to 5.12 from prior versions, the installer must be run as the same user that did the original install. The installer will detect this, and will fail if this is not the case (more on troubleshooting this later), but it bears repeating: the installer must be run as the same user that did the original install.
Furthermore, starting with 5.12, Datadog will be releasing two packages. One in the traditional MSI format, and one in the EXE format. In truth, the EXE version is just a bundle that uninstalls the old version, and then runs the MSI. But, because of some limitations in the Windows installer, the upgrade MUST be done using the EXE version. To summarize:
- Log in as the same user that did the original, pre 5.12 installation
- Run the executable (EXE) version of the installer
- Voila, 5.12 should be up and running
The datadog
cookbook has full support for upgrades from pre 5.12 agent installations since version 2.9.0
. Please refer to its README for more information.
If the installation fails, the most likely culprit is that somewhere in the bowels of the Windows installation database, there’s another version of the Datadog Agent recorded. For example, let’s say you installed 5.8 as user ‘bob’, and 5.9 as user ‘mary’ (both of whom have Administrator privilege on the machine). Running the 5.12 upgrade as either user will still fail, as we’ll detect the per-user install and fail. In cases like these, the user must log in as each user that previously did an install, and manually uninstall (via Add/Remove programs) the previous version(s).
If the upgrade is attempted using the MSI, the upgrade will fail gracefully. It will leave the previous version of the Datadog Agent installed and running. The error message displayed isn’t particularly helpful. However, in the installation log, there will be a message like this indicating what really happened:
CustomAction CheckForOldVersion returned actual error code 1638 (note this may not be 100% accurate if translation happened inside sandbox) Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.
Action CheckForOldVersion, location: C:\Windows\Installer\MSID4D8.tmp, command: -oldcode={82210ed1-bbe4-4051-aa15-002ea31dde15} -newcode={0c50421b-aefb-4f15-a809-7af256d608a5} -checkonly=true
This indicates that somewhere, our installer found an old, per-user install on the machine.
If the upgrade is attempted using the EXE, and it’s run as a different user than the original install, it will fail gracefully. There’s a slightly (but not much) more helpful error message. The installation UI will show:
0x80070666 - Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel
In the case of an unattended install, the log file will contain the following messages:
[0CB8:0E3C][2017-03-22T11:08:18]i301: Applying execute package: upgrade_helper.exe, action: Install, path: C:\ProgramData\Package Cache\C0791B9F6337A171A7DAD5DFAA8257E36913E5D1\upgrade-helper.exe, arguments: '"C:\ProgramData\Package Cache\C0791B9F6337A171A7DAD5DFAA8257E36913E5D1\upgrade-helper.exe" -oldcode={82210ed1-bbe4-4051-aa15-002ea31dde15} -newcode={0c50421b-aefb-4f15-a809-7af256d608a5}'
[0CB8:0E3C][2017-03-22T11:08:18]e000: Error 0x80070666: Process returned error: 0x666
[0CB8:0E3C][2017-03-22T11:08:18]e000: Error 0x80070666: Failed to execute EXE package.
In each case, running the EXE as the correct user should correct the problem. If not, that’s an indication that there are multiple installs as multiple users that need to be removed.