Skip to content
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

Count bind mount with overlay a folder that contains the overlay machinery (typically $HOME) #17932

Closed
Romain-Geissler-1A opened this issue Mar 26, 2023 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@Romain-Geissler-1A
Copy link
Contributor

Romain-Geissler-1A commented Mar 26, 2023

Issue Description

Hi,

I am trying basically to run images on a RHEL 9 machine, keeping my own user (so using --userns=keep-id, which for huge images brings issues like #16541 but that's another story), but I don't wish these images to modify my $HOME (while still having my existing $HOME files available). It seems the overlay machinery is unable to create an overlay when it the folder being bind mounted actually contains the internal podman storage files (so upper/lower/workdir/merged directories).

In other words, in a rootless configuration, this doesn't work:

[podman@11a9ab3e92cf ~]$ podman run -v "${HOME}:${HOME}:O" fedora
Error: OCI runtime error: crun: mount `/home/podman/.local/share/containers/storage/overlay-containers/f0cf1a3d50cd3a6ab58c81d98b69049b1cbc99e60ff2fce3c7e20f224cbb51d5/userdata/overlay/3517835219/merge` to `home/podman`: Invalid argument

But overlay bind-mounting any subfolder of $HOME which isn't doesn't contain ${HOME}/.local/share is fine. For example this works fine:

[podman@11a9ab3e92cf ~]$ podman run -v "${HOME}/.config:${HOME}/.config:O" fedora

I was wondering if this is expected ? In the end I would like to run something like:

podman run -t -i --rm --userns=keep-id -u "$(id -u)" -v "${HOME}:${HOME}:O" --pull=always some-internal-amadeus-image

and act "as if" my user inside the container was kind of the same than the user outside the container, but with no change of ${HOME} propagated back to my real ${HOME).

PS: I have heard about toolbox (https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/) but I didn't try yet and I don't know if it does more or less what I am trying to do directly with podman.

Cheers,
Romain

Steps to reproduce the issue

Steps to reproduce the issue

  1. Run such a container using a non root user (and make sure your storage is the default one, inside $HOME):
[podman@11a9ab3e92cf ~]$ podman run -v "${HOME}:${HOME}:O" fedora

Describe the results you received

Error: OCI runtime error: crun: mount `/home/podman/.local/share/containers/storage/overlay-containers/f0cf1a3d50cd3a6ab58c81d98b69049b1cbc99e60ff2fce3c7e20f224cbb51d5/userdata/overlay/3517835219/merge` to `home/podman`: Invalid argument

Describe the results you expected

It should work without error.

podman info output

I tried the above in the `quay.io/podman/upstream` image started in `--privileged` mode. I also tried this on my RHEL 9 VM, which currently has podman 4.2.

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

@Romain-Geissler-1A Romain-Geissler-1A added the kind/bug Categorizes issue or PR as related to a bug. label Mar 26, 2023
@Luap99
Copy link
Member

Luap99 commented Mar 27, 2023

@giuseppe PTAL

@giuseppe
Copy link
Member

Yes that is expected, the kernel driver refuses to mount overlay if the mount is in the lowerdir.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Aug 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

3 participants