Client fails at first start: it does not create its data directory #284

Closed
opened 2026-11-16 13:20:48 +00:00 by vivy · 3 comments
Owner

Found while setting up a campus client (board GRI-2146), on dev at a61eed0.

What happens

On a fresh install (install.sh client --server https://scryglass.sint-norbertus.be, Ubuntu 26.04), the install finishes without errors, but the player stops about one second after the autologin of scryglass:

cannot create a temporary file for /home/scryglass/.local/share/grimoirix-signage/client.db: No such file or directory

The device then never reaches the server, so no pending device shows in the panel. Every new PC fails in this way.

Cause

config.rs resolves the data dir to GRIMOIRIX_SIGNAGE_DATA_DIR, else $XDG_DATA_HOME/grimoirix-signage, else ~/.local/share/grimoirix-signage. Store::open (crates/client/src/state.rs) treats a missing client.db as an empty state, but nothing creates the directory itself, so the first write (temporary file + rename) fails. cache.rs does call create_dir_all for its own directory; state.rs does not. The installer does not create the directory for the scryglass user either.

Fix

  • The client: create_dir_all(data_dir) (mode 0700) before the first write. That covers every install path, including the GRIMOIRIX_SIGNAGE_DATA_DIR and XDG_DATA_HOME cases.
  • Optional: the installer also creates it for the screen account.
  • A test: Store::open + update on a data dir that does not exist.

Workaround, until it is fixed

sudo install -d -o scryglass -g scryglass -m 0700 /home/scryglass/.local/share/grimoirix-signage

Then log the session out, or reboot.

Found while setting up a campus client (board GRI-2146), on `dev` at `a61eed0`. ## What happens On a fresh install (`install.sh client --server https://scryglass.sint-norbertus.be`, Ubuntu 26.04), the install finishes without errors, but the player stops about one second after the autologin of `scryglass`: ``` cannot create a temporary file for /home/scryglass/.local/share/grimoirix-signage/client.db: No such file or directory ``` The device then never reaches the server, so no pending device shows in the panel. **Every new PC fails in this way.** ## Cause `config.rs` resolves the data dir to `GRIMOIRIX_SIGNAGE_DATA_DIR`, else `$XDG_DATA_HOME/grimoirix-signage`, else `~/.local/share/grimoirix-signage`. `Store::open` (`crates/client/src/state.rs`) treats a missing `client.db` as an empty state, but nothing creates the directory itself, so the first write (temporary file + rename) fails. `cache.rs` does call `create_dir_all` for its own directory; `state.rs` does not. The installer does not create the directory for the `scryglass` user either. ## Fix - The client: `create_dir_all(data_dir)` (mode `0700`) before the first write. That covers every install path, including the `GRIMOIRIX_SIGNAGE_DATA_DIR` and `XDG_DATA_HOME` cases. - Optional: the installer also creates it for the screen account. - A test: `Store::open` + `update` on a data dir that does not exist. ## Workaround, until it is fixed ``` sudo install -d -o scryglass -g scryglass -m 0700 /home/scryglass/.local/share/grimoirix-signage ``` Then log the session out, or reboot.
Member

Fixed: Store::open (crates/client/src/state.rs) now creates the data directory (0700, recursive) before its first write, covering GRIMOIRIX_SIGNAGE_DATA_DIR, XDG_DATA_HOME and the default path alike. Added tests for opening against a data directory that does not exist yet, and for its permissions. cargo test -p client --lib state:: passes (13/13) and ./scripts/local-gates.sh --rust-only passes. Did not change install.sh — the client-side fix already covers every install path, per the issue's own analysis. PR: #287

Fixed: `Store::open` (crates/client/src/state.rs) now creates the data directory (0700, recursive) before its first write, covering GRIMOIRIX_SIGNAGE_DATA_DIR, XDG_DATA_HOME and the default path alike. Added tests for opening against a data directory that does not exist yet, and for its permissions. `cargo test -p client --lib state::` passes (13/13) and `./scripts/local-gates.sh --rust-only` passes. Did not change install.sh — the client-side fix already covers every install path, per the issue's own analysis. PR: https://git.grimoirix.org/Grimoirix/grimoire-of-digital-signage/pulls/287
Member

CI on PR #287 is green: cargo clippy, cargo fmt, cargo test, cargo deny, repository boundary and the pre-push hook all passed on 281aede9. Ready for review/merge into dev.

CI on PR #287 is green: cargo clippy, cargo fmt, cargo test, cargo deny, repository boundary and the pre-push hook all passed on 281aede9. Ready for review/merge into dev.
Author
Owner

Fixed by #287, merged into dev. No deploy to the test servers (PO hold).

Fixed by #287, merged into dev. No deploy to the test servers (PO hold).
vivy closed this issue 2026-11-16 14:27:05 +00:00
Sign in to join this conversation.
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage#284
No description provided.