Skip to content

fix(storage): a df that cannot read one mount no longer stops the service - #30

Merged
inkly merged 1 commit into
mainfrom
fix/df-exit-code
Nov 11, 2026
Merged

inkly merged 1 commit into
mainfrom
fix/df-exit-code

Conversation

@inkly

@inkly inkly commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Reported in ReCasaOS/CasaOS#67 (comment 6805495048): after an update, every GET /v1/storage?system=show answers 502, the Storage tab reads "No standalone storage is available" and the dashboard's storage card falls back to the system drive and the USB disks. The ZFS routes of the same service answer.

Cause. GetStorageList reads the system disk from df -kPT, and GetSystemDf called log.Fatal on any error from it. df exits 1 whenever one mount cannot be read (a dead network or FUSE mount: "Transport endpoint is not connected", "Permission denied") and still lists every other one. log.Fatal is not a panic, so Echo's Recover middleware does not catch it: the whole service exits, systemd starts it again, and the gateway gets a closed connection, hence 502 on that route only. GetStorageList is the only caller.

Fix. The output is read whatever the exit code; only a df that prints nothing is an error, which GetStorageList already handles (no system path, the list is built without it).

Proof. Two tests put a fake df on the PATH: one exits 1 after printing the root line and a line on stderr, and must still give that line; one prints nothing and must be an error. Run on Linux (WSL). Not looked at: the reporter's box itself. Whether their df really exits 1 is to be confirmed (asked in the issue).

…vice

GET /v1/storage reads the system disk from df -kPT, and a non-zero exit
of df was log.Fatal. df exits 1 whenever one mount cannot be read (a dead
network or FUSE mount) while it still lists the others: the service
stopped on every call, the gateway answered 502, and the Storage tab and
the dashboard's storage card came up empty. The output is now read
whatever the exit code; only a df that prints nothing is an error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant