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

Mount / as Shared by default? #7477

Closed
1 of 2 tasks
mangkoran opened this issue Sep 28, 2021 · 7 comments
Closed
1 of 2 tasks

Mount / as Shared by default? #7477

mangkoran opened this issue Sep 28, 2021 · 7 comments

Comments

@mangkoran
Copy link

Windows Build Number

Microsoft Windows [Version 10.0.22000.194]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.55-xanmod1-microsoft-standard-WSL2

Distro Version

ArchWSL

Other Software

  • podman 3.3.1-1

Repro Steps

  1. Install podman
  2. Configure podman to use rootful mode (Reference)
  3. Run any container, for convenience I exec podman run docker.io/hello-world

Expected Behavior

Container run successfully without warning.

Actual Behavior

Container run successfully with warning:

> podman run hello-world
WARN[0000] "/" is not a shared mount, this could cause issues or missing mounts with rootless containers

Diagnostic Logs

No response

@Biswa96
Copy link

Biswa96 commented Sep 28, 2021

I think you are looking for cross distro mount which can be enabled in /etc/wsl.conf file by adding this

[automount]
crossDistro = true

More here https://docs.microsoft.com/en-us/windows/wsl/release-notes#build-18970

@mangkoran
Copy link
Author

Thank you, but I didn't found /etc/wsl.conf in my distro. Is it supposed to be there? Also I think this release note is also related to my issue.

Add support for mount propagation flags [GH 2911].

@Biswa96
Copy link

Biswa96 commented Sep 28, 2021

That /etc/wsl.conf file has to be created manually.

@mangkoran
Copy link
Author

I have created and added lines to /etc/wsl.conf and done wsl --shutdown, but it still showing / propagation is private:

~
> cat /etc/wsl.conf
[automount]
crossDistro = true


~
> findmnt / -o PROPAGATION,TARGET
PROPAGATION TARGET
private     /

@mangkoran
Copy link
Author

I found this on the web. Seems like the default mount propagation is indeed "private", but in systemd-ful OS systemd will change the mount propagation to "shared" (Reference). I think we could use bash script to do this instead, but I'm not too proficient in shell scripting.

@KnairWang
Copy link

I find a way to solve this issue, by adding a boot command "mount --make-rshared /" into wsl.conf
(reference Build 21286)

~
❯ podman ps
CONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES

~
❯ cat /etc/wsl.conf
[boot]
command="mount --make-rshared /"

I suppose after updating the /etc/wsl.conf, you may need run wsl --shutdown on Windows side to make the change work in WSL.

@mangkoran
Copy link
Author

mangkoran commented Sep 29, 2022

@KnairWang I have tried your solution (or workaround?) and it works!. Thank you very much.

However, this solution (or workaround?) is might be the best we could have for systemd-less WSL distro. As WSL recently added native systemd support, I found that this issue still persist.

Closing this ticket and moving the issue for systemd-ful WSL distro to #8922.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants