-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix operation not permitted
with systemd-homed
#2064
Conversation
f377aa5
to
b4ec7b9
Compare
defer unmounter(m.Source) | ||
if m.Type == "bind" && userns.RunningInUserNS() { | ||
// For https://github.com/containerd/nerdctl/issues/2056 | ||
unpriv, err := mountutil.UnprivilegedMountFlags(m.Source) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have an integ or an unit test for this that the unpriv mount flags are carried over?
If my understanding is correct; a user will still have to ensure that the right subuid and subgid ranges are specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally yes, but not sure how to do that
Fix issue 2056 Note: in addition to this PR, the subid ranges in`/etc/subuid` and `/etc/subgid` have to begin from 524288 e.g., ``` test:524288:65536 ``` Otherwise running most images will fail with `value too large for defined data type` ```console $ ./nerdctl run -it --rm alpine:3.17.0 docker.io/library/alpine:3.17.0: resolved |++++++++++++++++++++++++++++++++++++++| index-sha256:8914eb54f968791faf6a8638949e480fef81e697984fba772b3976835194c6d4: done |++++++++++++++++++++++++++++++++++++++| manifest-sha256:c0d488a800e4127c334ad20d61d7bc21b4097540327217dfab52262adc02380c: waiting |--------------------------------------| config-sha256:49176f190c7e9cdb51ac85ab6c6d5e4512352218190cd69b08e6fd803ffbf3da: done |++++++++++++++++++++++++++++++++++++++| layer-sha256:c158987b05517b6f2c5913f3acef1f2182a32345a304fe357e3ace5fadcad715: downloading |+++++++++++++++++++++++---------------| 2.0 MiB/3.2 MiB elapsed: 10.4s total: 2.0 Mi (197.1 KiB/s) FATA[0010] failed to extract layer sha256:ded7a220bb058e28ee3254fbba04ca90b679070424424761a53a043b93b612bf: mount callback failed on /var/lib/containerd/tmpmounts/containerd-mount762573051: failed to Lchown "/var/lib/containerd/tmpmounts/containerd-mount762573051/etc/shadow" for UID 0, GID 42: lchown /var/lib/containerd/tmpmounts/containerd-mount762573051/etc/shadow: value too large for defined data type: unknown ``` Signed-off-by: Akihiro Suda <[email protected]>
m.Options = strutil.DedupeStrSlice(append(m.Options, unpriv...)) | ||
} | ||
if err := m.Mount(tempDir); err != nil { | ||
if rmErr := s.Remove(ctx, tempDir); rmErr != nil && !errdefs.IsNotFound(rmErr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure! but why not appending the layerID to the root as done before.
cc @AkihiroSuda
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC it was never appended for linux
Fix #2056
Note: in addition to this PR, the subid ranges in
/etc/subuid
and/etc/subgid
have to begin from 524288e.g.,
Otherwise running most images will fail with
value too large for defined data type