Repository navigation
Fix LSIO PUID/PGID permission race and harden abc rename - #450
Merged
Merged
Conversation
The LSIO init-nx-permissions chown sweep had no s6-rc dependency on the base init-adduser oneshot that remaps PUID/PGID onto the renamed account. s6-rc could therefore run the recursive chown of /config and /media before the remap, leaving files owned by the build-time UID while the mediaserver runs as the remapped UID, breaking writes. Add an init-adduser ordering dependency so the sweep (and, via it, init-nx-relocate) runs only after the remap. Extract the installer download and the LSIO abc->account rename into shell scripts that are copied and run with parameters, replacing the large inline RUN blocks. The rename script asserts the expected init-adduser signature before and after patching and fails the build if upstream changes it, instead of silently regressing PUID/PGID. Make the codegen write Dockerfiles as LF with a single trailing newline regardless of OS, since the raw-string literals inherit CRLF from the CRLF-encoded C# source and CRLF breaks RUN line continuations.
There was a problem hiding this comment.
Pull request overview
This PR addresses an LSIO startup ordering race that could leave /media (and other mounts) owned by the pre-remap UID/GID, causing write failures and repeated recursive chown sweeps on container start. It also refactors repeated Dockerfile RUN blocks into reusable shell scripts and ensures generated Dockerfiles are consistently LF-terminated to avoid Docker RUN continuation issues.
Changes:
- Add an s6-rc dependency so
init-nx-permissions(and dependent startup actions) runs after LSIO’sinit-adduserPUID/PGID remap. - Extract installer download logic and LSIO
abc→account rename logic intoDocker/download.shandDocker/lsio-rename-user.sh. - Normalize generated Dockerfiles to LF with exactly one trailing newline; make apt cleanup non-interactive (
apt-get autoremove --purge --yes).
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| NxWitness.code-workspace | Adds spell-check allowlist words used by the new scripts/log wording. |
| Docker/NxWitness.Dockerfile | Uses download.sh for installer staging; non-interactive autoremove. |
| Docker/NxWitness-LSIO.Dockerfile | Uses download.sh + lsio-rename-user.sh for LSIO variant; keeps s6-overlay layout. |
| Docker/NxMeta.Dockerfile | Same download script refactor + non-interactive autoremove. |
| Docker/NxMeta-LSIO.Dockerfile | Same download + LSIO rename script refactor. |
| Docker/NxGo.Dockerfile | Same download script refactor + non-interactive autoremove. |
| Docker/NxGo-LSIO.Dockerfile | Same download + LSIO rename script refactor. |
| Docker/DWSpectrum.Dockerfile | Same download script refactor + non-interactive autoremove. |
| Docker/DWSpectrum-LSIO.Dockerfile | Same download + LSIO rename script refactor. |
| Docker/WisenetWAVE.Dockerfile | Same download script refactor + non-interactive autoremove. |
| Docker/WisenetWAVE-LSIO.Dockerfile | Same download + LSIO rename script refactor. |
| Docker/download.sh | New shared download/staging implementation for .zip/.deb inputs. |
| Docker/lsio-rename-user.sh | New hardened LSIO abc rename + init-adduser repoint with signature assertions. |
| Docker/s6-overlay/s6-rc.d/init-nx-permissions/dependencies.d/init-adduser | Enforces s6-rc ordering so permission fixes happen after PUID/PGID remap. |
| CreateMatrix/Dockerfile.cs | Centralizes Dockerfile writes with LF normalization and makes apt cleanup non-interactive. |
ptr727
added a commit
that referenced
this pull request
Jun 25, 2026
Prep for the 2.14 `develop -> main` release. - Bump `version.json` NBGV floor 2.13 -> 2.14. - Add the `Version 2.14` release note to HISTORY.md and the README Release Notes for the LSIO PUID/PGID permission-ordering fix (#450). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ptr727
added a commit
that referenced
this pull request
Jun 25, 2026
Promote `develop` to `main` for the 2.14 release. ## Included - **Fix LSIO PUID/PGID permission race (#450)** — the `init-nx-permissions` chown sweep now depends on the base `init-adduser` oneshot, so it runs after the PUID/PGID remap instead of racing it (which could leave `/config` and `/media` owned by the wrong user and break media writes). Also extracts the installer download and LSIO `abc` rename into shell scripts, hardens the rename against upstream `init-adduser` changes, and makes codegen emit LF Dockerfiles. - **Bump version to 2.14 and document the fix (#451)** — `version.json` floor 2.13 -> 2.14, HISTORY.md and README release notes. - **Re-sync verbatim-carry artifacts from template (#448)** — already on develop. Validated on a live Synology server (the #449 reporter's scenario) via the `:develop` tag; the publish run on develop was green across the full matrix. Closes #449. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #449. On LSIO images, upgrading could leave
/mediachowned to the build-time UID while the mediaserver ran as the remappedPUID, breaking writes (QIODevice::write ... device not open) and triggering a full chown sweep on every start.Root cause: the
init-nx-permissionschown sweep had no s6-rc dependency on the baseinit-adduseroneshot that remapsPUID/PGIDonto the renamed account. As a dependency-free graph source, s6-rc could run the recursive chown of/configand/mediabefore the remap, locking files to the pre-remap UID.Changes
init-nx-permissions/dependencies.d/init-adduserso the chown sweep (and, transitively,init-nx-relocate) runs strictly after thePUID/PGIDremap. With correct ordering thestatguard sees/mediaalready owned by the account and skips the sweep entirely.abc→account rename move from large inlineRUNblocks intoDocker/download.shandDocker/lsio-rename-user.sh, copied and run with parameters (shellcheck-able, single-quote-clean, pinned LF).abcrename: the rename script asserts the expectedinit-addusersignature before and after patching and fails the build if upstream changes it, rather than silently regressingPUID/PGIDhandling. (LSIO still does not support renamingabc.)WriteDockerfilenormalizes generated Dockerfiles to LF + a single trailing newline regardless of OS (raw-string literals inherit CRLF from the CRLF-encoded C# source, and CRLF breaksRUNline continuations).Validation
NxMeta-LSIO(amd64) end-to-end: account renamed,abcremoved,init-adduserrepointed, new ordering dependency present,/tempclean.nx-base-lsio:ubuntu-noble; fails closed (exit 1, clear message) when the signature is broken or the file is missing.dotnet format style --verify-no-changesclean.🤖 Generated with Claude Code