elastic / elastic/beats

[Heartbeat] Browser monitors do not start on a read-only filesystem

Open
#49,043 2 comments 0 reactions 0 assignees View on GitHub
Team:obs-ds-hosted-services
Dominant language
Go
Stars
12.7k
Forks
5k
Avg merge
2d 15m
Merged PRs (30d)
385

Description

### Summary

When configuring a project monitor on read-only filesystem, heartbeat fails to correctly extract and execute the journey, even if it has write access to temp directories.
From initial investigation, it seems part of the reify process is trying to symlink the binary into the read-only fs:

```
16 verbose stack Error: EROFS: read-only file system, chmod '/tmp/elastic-synthetics-unzip-2303854328/node_modules/@elastic/synthetics/dist/cli.js'
16 verbose stack at async chmod (node:internal/fs/promises:1086:10)
16 verbose stack at async Promise.all (index 1)
16 verbose stack at async Promise.all (index 0)
16 verbose stack at async #createBinLinks (/usr/share/elastic-agent/.node/node/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js:394:5)
16 verbose stack at async Promise.allSettled (index 0)
16 verbose stack at async #linkAllBins (/usr/share/elastic-agent/.node/node/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js:375:5)
16 verbose stack at async #build (/usr/share/elastic-agent/.node/node/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js:160:7)
16 verbose stack at async Arborist.rebuild (/usr/share/elastic-agent/.node/node/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js:67:7)
16 verbose stack at async [reifyPackages] (/usr/share/elastic-agent/.node/node/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:325:11)
16 verbose stack at async Arborist.reify (/usr/share/elastic-agent/.node/node/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:142:5)
17 error code EROFS
18 error syscall chmod
19 error path /tmp/elastic-synthetics-unzip-2303854328/node_modules/@elastic/synthetics/dist/cli.js
20 error errno -30
21 error rofs EROFS: read-only file system, chmod '/tmp/elastic-synthetics-unzip-2303854328/node_modules/@elastic/synthetics/dist/cli.js'
22 error rofs Often virtualized file systems, or other file systems
```

Contributor guide

Open the contributing guide

Research direction

Reproduce a Heartbeat browser monitor on a read-only filesystem with writable temporary directories, then trace the reifyPackages flow through @npmcli/arborist/rebuild.js and the @elastic/synthetics dist/cli.js path. Done means the journey is extracted and executed without the EROFS chmod failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.