conda-forge / podman-feedstock

A conda-smithy repository for podman.
BSD 3-Clause "New" or "Revised" License
1 stars 7 forks source link

`WARN[0000]` "/" is not a shared mount, this could cause issues or missing mounts with rootless containers #25

Open dhirschfeld opened 2 years ago

dhirschfeld commented 2 years ago

Solution to issue cannot be found in the documentation.

Issue

I see the above error after installing podman and trying to run any command

Installed packages

-

Environment info

-
dhirschfeld commented 2 years ago

It appears this is to do with PROPAGATION not being set to shared: https://github.com/containers/buildah/issues/3726#issuecomment-1018544246

On my WSL2 distro it seems to be set to private:

$ findmnt -o PROPAGATION /
PROPAGATION
private
$ uname -r
5.10.16.3-microsoft-standard-WSL2
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy

The solution mount --make-rshared / (as root) seemed to fix the problem for me: https://github.com/containers/podman/issues/12136#issuecomment-954580443

manics commented 2 years ago

I've hit this warning before, in my case I solved it by installing buildah https://github.com/containers/podman/issues/11666#issuecomment-938411310 I have no idea how that fixes it

dhirschfeld commented 2 years ago

I have buildah installed (via conda-forge!) and I'm still seeing it :(

From https://github.com/containers/buildah/issues/3726#issuecomment-1171149174 I can "fix" it for my setup by running sudo mount --make-rshared / but I'm just trying to figure out how to get that config to stick for my WSL distribution.

dhirschfeld commented 2 years ago

It's a bit painful to debug as it only prints the first time I run a command. To test it again I have to wsl --shutdown to get a clean environment to re-test any changes.

manics commented 2 years ago

I found this https://superuser.com/questions/1701348/how-best-to-mount-a-drive-in-wsl-as-a-shared-drive Worth trying with rshared?

dhirschfeld commented 2 years ago

I found that one too and tried using the entry from /etc/mtab with the addition of shared. Unfortunately it didn't seem to have any effect :/

On Win11 the easy solution is to add a [boot] entry. Since I'm on Win10, I ended up using the wsl.exe trick from that post.

xref: https://github.com/containers/buildah/issues/3726#issuecomment-1171946342

lindhe commented 2 years ago

The solution mount --make-rshared / (as root) seemed to fix the problem for me: containers/podman#12136 (comment)

Does anyone know what kind of side-effects or security issues that may cause in WSL? Is there "a good reason" for it being private by default?

dhirschfeld commented 2 years ago

I've copied the best explanations from that thread below. As I'm not a linux expert, I couldn't comment on the security implications. If anyone has any insight in regards to that I'd be interested too :eyes:

https://github.com/containers/buildah/issues/3726#issuecomment-1171154875

Kernel default is Private. Systemd modifies the system to rshared by default. Since WSL is not using systemd, you don't get the change. (I am not a WSL expert, but I believe that is the issue).

https://github.com/containers/buildah/issues/3726#issuecomment-1172593342

The way WSL works is that it shares the kernel between all "distros". This is accomplished through namespaces, so each distro gets a private mount namespace. If you are using podman machine for windows, we create a nested namespace to be able to run systemd, and that namespace is created with a shared mount namespace. So if you use podman machine this is handled for you. Alternatively you can remount like you are doing for something custom.

shvchk commented 1 year ago

After sudo mount --make-rshared / I also had to do podman system migrate for podman to pick up the change, as suggested here: https://github.com/containers/podman/issues/18240#issuecomment-1513339255