LXD idmap improperly set for high uids and gids
Metadata
Current evaluation
Fixed by merged PR #98 (76a2d3a): LXD raw.idmap now maps the host UID and GID separately, correcting ownership for high, mismatched IDs.
Resolution: closed resolved
Reason: The incorrect combined idmap was replaced with separate uid and gid mappings in merged PR #98, merge commit 76a2d3a. Commit 5717e2c (#780) records the same correction in the provider implementation.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### What needs to get done
Craft-providers currently sets the raw.idmap to `both $(id -u) 0`. Instead, it should be set to `uid $(id -u) 0\ngid $(id -g) 0")`.
### Why it needs to get done
Files written to a mounted directory have the wrong gid when the user has high, mismatching uid and gid.
For example, a snap will have a group id like:
```
-rw-r--r-- 1 callahan.kovacs@canonical.com 1522341876 0 Jul 2 16:26 hello_1.0_amd64.snap
```
source: https://github.com/canonical/lxd/issues/15368
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #98 (76a2d3a): LXD raw.idmap now maps the host UID and GID separately, correcting ownership for high, mismatched IDs. | |
| stealth/space-bunny-alpha | — | closed resolved | LXD idmap handling was fixed by mapping the host UID and GID separately, correcting mounted-file group ownership for high, mismatched IDs. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #780 (commit 5717e2c), configuring separate LXD UID and GID mappings so high, mismatching IDs map correctly. | |
| qwen/qwen3.6-35b-a3b | — | closed resolved | Fixed LXD idmap for high uids/gids by correctly mapping both UID and GID in PR #98. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Related To:
lxd#15368
(confidence 100%)
Upstream LXD report cited as the motivating high-ID GID-mismatch issue.
-
Likely Fixed By:
canonical/craft-providers#98
(confidence 99%)
Merged PR #98 addresses the incorrect LXD idmap configuration.
-
Related To:
canonical/craft-providers#780
(confidence 90%)
Commit 5717e2c carries the separate UID/GID idmap fix.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1904 lxd: raw.idmap expects host and container id respectively | snapcraft | merged | Merged PR #1904 fixed LXD `raw.idmap` argument order so host UID maps to container root (0), instead of mapping both IDs to the host user; commit 6bd4c9e59. | |
| #97 Filesystem uid mapping incorrect in lxd instance | craft-providers | closed | LXD host-mount ID mapping was fixed by #98 (05d4834), then refined by merged #780 (5717e2c), which sets UID and GID maps separately. | |
| #259 Cannot launch lxd instance with high uids | craft-providers | open | LXD launches failed for host UIDs above 65,535; commit 5717e2c and PR #780 now configure separate UID and GID raw.idmap entries, resolving the reported failure. | |
| #1385 lxd: Don't assume user ID to 1000 for raw.idmap | snapcraft | merged | Merged PR #1385 as commit e85e0779b, removing LXD raw.idmap's hard-coded UID 1000 assumption for Launchpad bug 1700703; PR #1904 later corrected mapping order. | |
| #18 providers: fix id mapping in lxd project mount | rockcraft | merged | Merged PR #18 fixed LXD project mounts to map the host directory owner rather than the current UID, preventing file-creation failures when their IDs differ. | |
| #388 LXD config set raw.idmap random not applied | craft-providers | closed | Fixed by merged PR #386, which corrected LXC instance locking during creation so raw.idmap is applied. | |
| #780 fix(lxd): set uid map and gid map separately | craft-providers | merged | Merged PR #780 as commit 5717e2c, fixing #769 by configuring LXD UID and GID maps separately; approved by two reviewers. | |
| #1588 lxd: use SUDO_UID for ID mapping | snapcraft | merged | Merged PR #1588 as commit 695794f4c, changing LXD ID mapping to use SUDO_UID and fixing Launchpad bug 1719996. | |
| #98 lxd: pass id for host mount uid mapping | craft-providers | merged | Merged #98 added an application-provided ID for LXD host-mount UID mapping while retaining the running user's UID as the default, resolving #97. | |
| #1629 lxd: fix the unit test for the user id map | snapcraft | merged | Merged as commit e820e119e (#1629), fixing the LXD user ID-map unit test under root execution after #1588 changed ID mapping to use SUDO_UID. |