Closed
Description
Version: 8.14.0
Operating System: Ubuntu 24.04 LTS
Platform: arm64
While working on this issue comparing root and unprivileged elastic agents, I encountered an error when upgrading the agent.
Steps to Reproduce:
- Deploy ESS v8.14.0
- Create agent policy with system integration
- Install fleet managed agent v8.13.4 with or without the unprivileged flag
sudo ./elastic-agent install --url=<fleet url> --enrollment-token=<token>
- Run
sudo elastic-agent upgrade 8.14.0
- Upgrade seems to work; however, when checking the status we get the following error
┌─ fleet
│ └─ status: (FAILED) status code: 500, fleet-server returned an error: BadRequest, message: failed to update upgrade_details: upgrade_details no action for id "" found
├─ elastic-agent
│ └─ status: (HEALTHY) Running
└─ upgrade_details
├─ target_version: 8.14.0
├─ state: UPG_WATCHING
└─ metadata
- Uninstall and unenroll the agent and install v8.13.4 again
- Upgrade through the fleet ui. This should work.
This bug occurs for both privileged and unprivileged agents.
Definition of Done
Synthesized from #4890 (comment):
- If an unprivileged user attempts to upgrade a Fleet-managed unprivileged Agent from the CLI, Agent should refuse to upgrade and output a message explaining why and additionally mention that the upgrade cannot be performed because the command was not executed with root/Administrator permissions (same as the
isAdmin
check incmd/install.go
). - If a privileged user attempts to upgrade a Fleet-managed Agent (privileged or unprivileged) from the CLI (
elastic-agent upgrade ...
), Agent should refuse to upgrade and output a message explaining why. The message should NOT mention anything about a--force
flag (explained below). - However, if a user additionally provides a
--force
flag in the previous scenario, Agent should present a warning message and proceed with the upgrade anyway. This--force
flag should be hidden; it should NOT show up in the output ofelastic-agent help upgrade
.