# Unable to uninstall elastic-agent

**URL:** <https://discuss.elastic.co/t/unable-to-uninstall-elastic-agent/305347>\
**Category:** Beats\
**Tags:** fleet, elastic-agent\
**Created:** [May 22, 2022, 7:43am UTC](https://discuss.elastic.co/t/unable-to-uninstall-elastic-agent/305347 "2022-05-22T07:43:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![liwenbo97](https://avatars.discourse-cdn.com/v4/letter/l/ecccb3/32.png) [@liwenbo97](https://discuss.elastic.co/u/liwenbo97)\
**Post date:** [May 22, 2022, 7:43am UTC](https://discuss.elastic.co/t/unable-to-uninstall-elastic-agent/305347/1 "2022-05-22T07:43:09Z")

</div>

n227-012-170 ➜ ~ sudo elastic-agent uninstall

Error: can only be uninstall by executing the installed Elastic Agent at: /usr/bin/elastic-agent

For help, please see our troubleshooting guide at [Troubleshoot common problems | Fleet and Elastic Agent Guide [8.2] | Elastic](https://www.elastic.co/guide/en/fleet/8.2/fleet-troubleshooting.html)

n227-012-170 ➜ ~ cd /usr/bin

n227-012-170 ➜ bin sudo ./elastic-agent uninstall

Error: can only be uninstall by executing the installed Elastic Agent at: /usr/bin/elastic-agent

For help, please see our troubleshooting guide at [Troubleshoot common problems | Fleet and Elastic Agent Guide [8.2] | Elastic](https://www.elastic.co/guide/en/fleet/8.2/fleet-troubleshooting.html)

n227-012-170 ➜ bin sudo elastic-agent uninstall

Error: can only be uninstall by executing the installed Elastic Agent at: /usr/bin/elastic-agent

For help, please see our troubleshooting guide at [Troubleshoot common problems | Fleet and Elastic Agent Guide [8.2] | Elastic](https://www.elastic.co/guide/en/fleet/8.2/fleet-troubleshooting.html)

I follow the instructions at doc, but didn't work AT ALL

> **[Uninstall Elastic Agents from edge hosts | Fleet and Elastic Agent Guide \[8.2\]...](https://www.elastic.co/guide/en/fleet/current/uninstall-elastic-agent.html#_uninstall_on_macos_linux_and_windows)**

➜ bin sudo /opt/Elastic/Agent/elastic-agent uninstall

Error: can only be uninstall by executing the installed Elastic Agent at: /usr/bin/elastic-agent

For help, please see our troubleshooting guide at [Troubleshoot common problems | Fleet and Elastic Agent Guide [8.2] | Elastic](https://www.elastic.co/guide/en/fleet/8.2/fleet-troubleshooting.html)

---

<div class="post-metadata">

**Author:** ![MichelLaterman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michellaterman/32/110221_2.png) [@MichelLaterman](https://discuss.elastic.co/u/MichelLaterman)\
**Post date:** [May 30, 2022, 4:43pm UTC](https://discuss.elastic.co/t/unable-to-uninstall-elastic-agent/305347/2 "2022-05-30T16:43:43Z")

</div>

Strange,

Have you tried seeing where the `/usr/bin/elastic-agent` binary is linked to?  
It should be somewhere in `/opt/Elatic/Agent` and you may have better luck running directly from that binary, i.e. `sudo /opt/Elastic/Agent/elastic-agent uninstall`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 27, 2022, 6:44pm UTC](https://discuss.elastic.co/t/unable-to-uninstall-elastic-agent/305347/3 "2022-06-27T18:44:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
