Access WSL files from cygwin

Eliot Moss moss@cs.umass.edu
Sun Feb 7 18:08:14 GMT 2021


On 2/7/2021 9:40 AM, Cary Lewis via Cygwin wrote:
 > Is there a way to access files from a WSL 2 Linux distro from Cygwin?

 >>From Windows:

 > \\wsl$\Ubuntu is accessible from Windows Explorer, but cygwin does not seem
 > to recogonize:

 > //wsl\$

 > nor does it recognize //HOSTNAME/wsl\$

 > but //HOSTNAME/c\$ works.

 > Thanks for any help you can provide.

On my system it lives in:

/c/Users/moss/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs

(Yuck.)  There may be (probably is) a link somewhere.  //wsl is probably some
"magical" active link.

By searching for ubuntu in the registry I found:

Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\{d10ee784-05b0-4c00-be54-cba0d7e7a471}

Its key BasePath has to path to that rootfs.  I don;t know how stable that hex
package id is, or whether it matters which Linux you've installed, etc.  Also,
I am running WSL 1, not WSL 2.  I would think that WSL maintains a file
somewhere with the information about distros and where they are, but I am not
sure where that might be.

A StakcOverflow posting said to look in:

C:\Users\"yourusername">\AppData\Local\Packages\"xxxxx"\LocalState\root\fs

The xxxxx varies by specific Linux distro/version.

Naturally I would be careful *writing* anything down there, but I expect
reading would be ok.

HTH -- EM


More information about the Cygwin mailing list