elastic / elastic-agent

Elastic Agent - single, unified way to add monitoring for logs, metrics, and other types of data to a host.
Other
127 stars 136 forks source link

[Fleet]: Uninstalling the standalone Windows agent after upgrading from 8.13.3 to 8.14.0 shows an error in CLI. #4666

Open harshitgupta-qasource opened 5 months ago

harshitgupta-qasource commented 5 months ago

Kibana Build details:

VERSION: 8.14.0 BC2
BUILD: 73626
COMMIT: bcf6960778ae270d0894a8aab07f10197ee9b97f
Artifact: https://staging.elastic.co/8.14.0-2bf292f8/summary-8.14.0.html#elastic-agent-package

Host OS and Browser version: Windows, All

Preconditions:

  1. 8.14.0 BC2 Kibana cloud environment should be available.
  2. Windows standalone agent should be installed with 813.3 agent version.

Steps to reproduce:

  1. Navigate to CLI.
  2. Upgrade Standalone agent from 8.13.3 to 8.14.0 build.
  3. Wait for 20-30 mins.
  4. Now uninstall the upgraded Standalone agent.
  5. Observe that on uninstalling the standalone Windows agent shows an error in CLI.
  6. Navigate to installed directory and Observe agent is completely uninstalled

Expected Result: On uninstalling the standalone Windows agent after upgrading from 8.13.3 to 8.14.0 should not show errors in CLI. Screen-Shot: Uninstall Error image Installed Directory after Uninstallation image

Error after Uninstalling

PS C:\Users\Administrator\Downloads> & 'C:\Program Files\Elastic\Agent\elastic-agent.exe' uninstall
Elastic Agent will be uninstalled from your system at C:\Program Files\Elastic\Agent. Do you want to continue? [Y/n]:Y
[====] Failed to uninstall agent  [30s] Error uninstalling. Printing logs
2024-05-03T07:30:00.296Z        DEBUG   [uninstall]     Loaded configuration from C:\Program Files\Elastic\Agent\elastic-agent.yml
2024-05-03T07:30:00.296Z        DEBUG   [uninstall]     Merged configuration from C:\Program Files\Elastic\Agent\elastic-agent.yml into result
2024-05-03T07:30:00.296Z        DEBUG   [uninstall]     Merged all configuration files from [C:\Program Files\Elastic\Agent\elastic-agent.yml], no external input files
2024-05-03T07:30:00.297Z        DEBUG   [uninstall.composable]  Starting controller for composable inputs
2024-05-03T07:30:00.297Z        DEBUG   [uninstall.composable]  Started controller for composable inputs
2024-05-03T07:30:00.297Z        DEBUG   [uninstall.composable]  Variable state changed for composable inputs; debounce started
2024-05-03T07:30:00.297Z        INFO    [uninstall.composable.providers.docker] Docker provider skipped, unable to connect: protocol not available
2024-05-03T07:30:00.297Z        DEBUG   [uninstall.composable]  kubernetes_secrets provider skipped, unable to connect: unable to build kube config due to error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
2024-05-03T07:30:00.298Z        DEBUG   [uninstall.composable]  Kubernetes leaderelection provider skipped, unable to connect: unable to build kube config due to error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
2024-05-03T07:30:00.298Z        DEBUG   [uninstall.composable.providers.kubernetes]     Kubernetes provider for resource pod skipped, unable to connect: unable to build kube config due to error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
2024-05-03T07:30:00.298Z        DEBUG   [uninstall.composable.providers.kubernetes]     Kubernetes provider for resource node skipped, unable to connect: unable to build kube config due to error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
2024-05-03T07:30:00.403Z        DEBUG   [uninstall.composable]  Computing new variable state for composable inputs
2024-05-03T07:30:00.403Z        DEBUG   [uninstall.composable]  Stopping controller for composable inputs
2024-05-03T07:30:00.499Z        DEBUG   [uninstall.composable]  Stopped controller for composable inputs
Error: error uninstalling agent: failed to remove installation directory (C:\Program Files\Elastic\Agent): timed out while removing "C:\\Program Files\\Elastic\\Agent". Last error: remove C:\Program Files\Elastic\Agent: The process cannot access the file because it is being used by another process.
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.14/fleet-troubleshooting.html
PS C:\Users\Administrator\Downloads>
elasticmachine commented 5 months ago

Pinging @elastic/fleet (Team:Fleet)

harshitgupta-qasource commented 5 months ago

@amolnater-qasource Kindly review

amolnater-qasource commented 5 months ago

Secondary review for this ticket is Done.

elasticmachine commented 5 months ago

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

elasticmachine commented 5 months ago

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

cmacknz commented 5 months ago

@blakerouse it's back again

blakerouse commented 5 months ago

@leehinman Was the delete on reboot ever added? I thought that was added when the directory could not be delete.

leehinman commented 5 months ago

@leehinman Was the delete on reboot ever added? I thought that was added when the directory could not be delete.

No, because if the user doesn't reboot immediately, and then does an install again you can get into a situation where they eventually reboot and it deletes the "new" install.

blakerouse commented 5 months ago

Okay. Best option is if we cannot remove it just to add a warning and exit uninstall successfully. I don't think we are ever going to solve this 100% of the cases.