DamionGans / ubuntu-wsl2-systemd-script

[Does not work anymore!] Script to enable systemd support on current Ubuntu WSL2 images
1.56k stars 382 forks source link

Linux binds aren't seen in Windows/Docker #53

Open zeidoo opened 3 years ago

zeidoo commented 3 years ago

Hi,

After installing this script bind mounts aren't visible in windows and docker/kubernetes anymore.

sudo mkdir /mnt/wsl/somedir
sudo mount --bind /some/folder/withfiles/ /mnt/wsl/somedir
ls /mnt/wsl/somedir
<shows files>

Windows explorer: \\wsl$\<distro>\mnt\wsl\somedir
<no files shown>

In bash.bashrc comment out:

# Start or enter a PID namespace in WSL2
#source /usr/sbin/start-systemd-namespace <-- this line

Restart WSL:

powershell: wsl --shutdown

Repeat these steps:

sudo mkdir /mnt/wsl/somedir
sudo mount --bind /some/folder/withfiles/ /mnt/wsl/somedir
ls /mnt/wsl/somedir
<shows files>

Windows explorer: \\wsl$\<distro>\mnt\wsl\somedir
<shows files> <-- this now works

Any ideas?