- Notifications
You must be signed in to change notification settings - Fork 197
fix: endpoint with tamper protection deb upgrade #9462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: endpoint with tamper protection deb upgrade #9462
Conversation
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
💚 Build Succeeded
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well sleuthed, glad this is a simple fix after all. See my inline comment about just doing this all the time not only when the vault exists.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Mirror's self-upgrade as well, all components are stopped before the upgrade occurs.
@Mergifyio backport 8.17 8.18 8.19 9.0 9.1 |
✅ Backports have been created
|
* fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl (cherry picked from commit eb0d46c) # Conflicts: # dev-tools/packaging/templates/linux/preinstall.sh.tmpl # testing/integration/ess/endpoint_security_test.go
* fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl (cherry picked from commit eb0d46c) # Conflicts: # dev-tools/packaging/templates/linux/preinstall.sh.tmpl # testing/integration/ess/endpoint_security_test.go
* fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl (cherry picked from commit eb0d46c)
* fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl (cherry picked from commit eb0d46c) # Conflicts: # dev-tools/packaging/templates/linux/preinstall.sh.tmpl # testing/integration/ess/endpoint_security_test.go
* fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl (cherry picked from commit eb0d46c)
* fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl (cherry picked from commit eb0d46c)
…ade (#9471) * fix: endpoint with tamper protection deb upgrade (#9462) * fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl (cherry picked from commit eb0d46c) # Conflicts: # dev-tools/packaging/templates/linux/preinstall.sh.tmpl # testing/integration/ess/endpoint_security_test.go * fix: resolve conflicts * fix: adjust changelog fragment --------- Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
* fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl (cherry picked from commit eb0d46c) Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
…de (#9473) * fix: endpoint with tamper protection deb upgrade (#9462) * fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl (cherry picked from commit eb0d46c) # Conflicts: # dev-tools/packaging/templates/linux/preinstall.sh.tmpl # testing/integration/ess/endpoint_security_test.go * fix: resolve conflicts * fix: adjust changelog fragment --------- Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
* fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl (cherry picked from commit eb0d46c) Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
…ade (#9470) * fix: endpoint with tamper protection deb upgrade (#9462) * fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl (cherry picked from commit eb0d46c) # Conflicts: # dev-tools/packaging/templates/linux/preinstall.sh.tmpl # testing/integration/ess/endpoint_security_test.go * fix: resolve conflicts * fix: adjust changelog fragment --------- Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
* fix: stop elastic-agent service if we need to stop endpoint * fix: re-enable same version over the installed agent endpoint test * chore: add changelog fragment * fix: stop elastic-agent unconditionally in preinstall.sh.tmpl
What does this PR do?
This PR fixes upgrade and reinstall failures from a deb package involving Elastic Agent and Endpoint by ensuring that the
elastic-agent
service is explicitly stopped before we attempt to stop theendpoint
service or remove its vault directory.Specifically:
preinstall.sh
template so that ifelastic-agent
is running, it is stopped before interacting with Endpoint.PS: thanks to @gabriellandau for pointing out the existence of such an interference
Why is it important?
Without this change, the
elastic-agent
process could continue to invoke Endpoint’sverify
logic in the background during package upgrades.This race condition allowed Endpoint to restart right after being stopped, which recreated the vault directory and led to uninstall/upgrade failures (exit code 28).
By explicitly stopping
elastic-agent
before managing Endpoint, we eliminate these conflicts and make upgrades deterministic and reliable.This restores passing CI for upgrade and reinstall tests across multiple version ranges (e.g. 9.1.2→9.2.0, 9.0.5→9.1.2, 8.18.5→8.19.1).
Checklist
./changelog/fragments
using the changelog toolDisruptive User Impact
No disruptive impact is expected.
The change only affects package preinstall scripts, ensuring the agent is stopped before managing the Endpoint service.
Users upgrading Elastic Agent will benefit from more reliable upgrades without needing to take manual action.
How to test this PR locally
You can either run the respective integration tests or
9.1.2
version of Elastic Agent through deb, enroll it to Fleet and install Defend integration.9.2.0
versionRelated issues