Disk mounts not writable due to UID mapping #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Directories mounted as read-write into containers are not actually
writable by the
devuser. This affects both the reviewer and developercontainers.
Affected mounts
For the reviewer container:
~/issues/— should be read-write, is read-only~/reviewer-comments/— should be read-write, is read-onlyFor the developer container (expected, not yet verified):
~/code-repo/— should be read-write, likely read-only~/developer-comments/— should be read-write, likely read-onlyRoot cause
The
incus-add-devicecall indegudev.elcorrectly omits thereadonly=trueflag for writable mounts. The mount logic is correct.The problem is UID mapping. Inside the container the directories appear
owned by
nobody:nogroup:The host UID that owns these directories does not map to the
devuser(UID 1000) inside the unprivileged container. Without UID shifting, the
container's
devuser has no write permission.Proposed fix
Add
shift=trueto writable disk devices inincus-add-deviceor atthe
degudev.ellevel. Theshift=trueoption enables Incus's idmapshifting so the host UID is transparently mapped to the container UID.
Alternatively,
degudev--setup-containercould setraw.idmapon thecontainer to explicitly map the host user to container UID 1000.
The
shift=trueapproach is simpler and more portable.Where to fix
This should be fixed in
degudev.el, notincus.el. Theincus-add-devicefunction is a generic low-level wrapper — not allcallers will want UID shifting.
degudev.elknows which mounts need tobe writable by the container user and should pass the appropriate
option.
This means
incus-add-deviceneeds to be extended to accept additionaldevice options (like
shift=true), ordegudev.elshould callincus--rundirectly with the extra parameter.Idempotency requirement
Re-running
degudev-create-containerson an existing container MUST fixthe permissions on already-mounted devices.
Currently, mount setup is guarded by
(unless (incus-device-exists-p ...)), which skips devices that alreadyexist — even if their configuration is wrong. The fix must update
existing device config in place rather than skip or remove/re-add.
Concretely:
shift=true, set it viaincus config device set <container> <device> shift=true.incus.el(e.g.,incus-device-set)or direct use of
incus--runfromdegudev.el.if missing, update config if exists".
Reproduction
Inside the reviewer container: