← Back to issue list

lxd: raw.idmap expects host and container id respectively

View original Github issue

Metadata

Project
snapcraft
Number
#1904
Type
pull request
State
merged
Author
kalikiana
Labels
Created
Updated
Closed

Current evaluation

Merged a fix correcting raw.idmap syntax in LXD configuration. The change maps host and container IDs correctly, preventing container files from being owned by root. Resolves LP: #1741753 with a four-line adjustment across two files.

Suggested action:

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? ----- Fixes: [LP: #1741753](https://bugs.launchpad.net/snapcraft/+bug/1741753) The `lxc config` call is not setting `raw.idmap` correctly. The syntax being used here is `both HOST_ID CONTAINER_ID` which means the user and group ID from the host will be mapped to the user in the container. The latter is always root, hence 0 is correct. Without the fix, files will be written with the actual user ID from the container, so they're effectively owned by root, causing the problem. Manual steps to test: > SNAPCRAFT_CONTAINER_BUILDS=1 snapcraft # Wait until Snapcraft creates stage/prime/parts folders # See that they're owned by the user

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged a fix correcting raw.idmap syntax in LXD configuration. The change maps host and container IDs correctly, preventing container files from being owned by root. Resolves LP: #1741753 with a four-line adjustment across two files.
qwen3.6-35b-a3b-mtp-q6 Merged fix correcting LXD raw.idmap syntax to properly map host and container IDs. Resolves Launchpad bug #1741753 where container files were incorrectly owned by root. Related test failures were addressed in separate PRs.
qwen3.6-35b-a3b-mtp-q6 Merged fix correcting LXD raw.idmap syntax to properly map host and container IDs. Resolves file ownership issues where files were incorrectly owned by root. Addresses Launchpad bug #1741753.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1385 lxd: Don't assume user ID to 1000 for raw.idmap snapcraft merged Merged fix for LXD raw.idmap that incorrectly assumed user ID 1000. Resolves bug 1700703. Approved by reviewers and validated across environments.
78%
#18 providers: fix id mapping in lxd project mount rockcraft merged Merged fix for LXD project mount ID mapping. The change maps the directory owner instead of the current user's UID, preventing file creation failures when IDs differ. This resolves OCI image generation failures in GCE environments.
72%
#1588 lxd: use SUDO_UID for ID mapping snapcraft merged Merged a one-file change implementing SUDO_UID for LXD ID mapping, resolving bug 1719996. The pull request passed CI, received approval from one reviewer with no unresolved comments, and was successfully integrated.
70%
#1629 lxd: fix the unit test for the user id map snapcraft merged Merged a fix for an LXD unit test failure when run as root, introduced in #1588. Adjusts the user ID map test logic. Approved by two reviewers and passed CI. One remaining test error was noted but did not block the merge.
70%