Skip to content

[diagnostics] - Update diagnostics socket path to support read-only filesystems#12312

Merged
pierrehilbert merged 4 commits intoelastic:mainfrom
VihasMakwana:fix-diagnostics-extension-read-only
Jan 20, 2026
Merged

[diagnostics] - Update diagnostics socket path to support read-only filesystems#12312
pierrehilbert merged 4 commits intoelastic:mainfrom
VihasMakwana:fix-diagnostics-extension-read-only

Conversation

@VihasMakwana
Copy link
Contributor

@VihasMakwana VihasMakwana commented Jan 19, 2026

What does this PR do?

Previously, the diagnostics socket path was hard coded as /usr/share/elastic-agent/edot-diagnostics-extension.sock, which resulted in failed to create listener: read-only file system when being run inside of a container.
This PR updates the diagnostics socket path based on the STATE_PATH environment variable, ensuring the socket is created in a writable state directory.

Why is it important?

Without this change, the collector fails to start in a read-only filesystem because it used to create the socket under /usr/share/elastic-agent or /tmp

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

How to test this PR locally

  • Build docker image from this PR by running
SNAPSHOT=true EXTERNAL=true PLATFORMS="linux/arm64" PACKAGES=docker DOCKER_VARIANTS=basic mage -v package
  • Run
docker run --read-only --rm -e STATE_PATH=/state --mount type=tmpfs,destination=/state docker.elastic.co/elastic-agent/elastic-agent:9.4.0-SNAPSHOT
  • Observe the logs. There shouldn't be any runtime failure.
  • Optional:
    • You can exec into the container and do ls /state/data. You'll see that the diagnostics socket is present under the directory.

Related issues

@VihasMakwana VihasMakwana requested a review from a team as a code owner January 19, 2026 06:18
@VihasMakwana VihasMakwana marked this pull request as draft January 19, 2026 06:18
@VihasMakwana VihasMakwana self-assigned this Jan 19, 2026
@VihasMakwana VihasMakwana added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-9.3 Automated backport to the 9.3 branch labels Jan 19, 2026
@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 19, 2026

💔 Build Failed

Failed CI Steps

History

cc @VihasMakwana

@VihasMakwana VihasMakwana marked this pull request as ready for review January 19, 2026 09:43
@elasticmachine
Copy link
Contributor

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

@VihasMakwana VihasMakwana requested a review from swiatekm January 19, 2026 11:18
@pierrehilbert pierrehilbert merged commit 26495cc into elastic:main Jan 20, 2026
22 checks passed
mergify bot pushed a commit that referenced this pull request Jan 20, 2026
…ilesystems (#12312)

* update socket path based on STATE_PATH variable

* test fix

* remove preserve

(cherry picked from commit 26495cc)
VihasMakwana added a commit that referenced this pull request Jan 20, 2026
…ilesystems (#12312) (#12335)

* update socket path based on STATE_PATH variable

* test fix

* remove preserve

(cherry picked from commit 26495cc)

Co-authored-by: Vihas Makwana <121151420+VihasMakwana@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-9.3 Automated backport to the 9.3 branch Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

4 participants