public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Access WSL files from cygwin
@ 2021-02-07 14:40 Cary Lewis
  2021-02-07 18:08 ` Eliot Moss
  2021-03-04 19:44 ` Oleksandr Gavenko
  0 siblings, 2 replies; 3+ messages in thread
From: Cary Lewis @ 2021-02-07 14:40 UTC (permalink / raw)
  To: cygwin

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Access WSL files from cygwin
  2021-02-07 14:40 Access WSL files from cygwin Cary Lewis
@ 2021-02-07 18:08 ` Eliot Moss
  2021-03-04 19:44 ` Oleksandr Gavenko
  1 sibling, 0 replies; 3+ messages in thread
From: Eliot Moss @ 2021-02-07 18:08 UTC (permalink / raw)
  To: Cary Lewis, cygwin

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Access WSL files from cygwin
  2021-02-07 14:40 Access WSL files from cygwin Cary Lewis
  2021-02-07 18:08 ` Eliot Moss
@ 2021-03-04 19:44 ` Oleksandr Gavenko
  1 sibling, 0 replies; 3+ messages in thread
From: Oleksandr Gavenko @ 2021-03-04 19:44 UTC (permalink / raw)
  To: cygwin

On 2021-02-07, 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\$

I use following fstab to get access to WSL 1:

//wsl$/debian /wsl/debian      ntfs binary,posix=0,user,noacl,notexec 0 0
//wsl$/ubuntu /wsl/ubuntu      ntfs binary,posix=0,user,noacl,notexec 0 0
//wsl$/alpine /wsl/alpine      ntfs binary,posix=0,user,noacl,notexec 0 0

There are problems to access some files (their attributes) but they are
special like /dev...

I have never tried WSL 2. I believe it uses P9 network fs.

Probably you have to use full distro names as reported by:

  wslconfig.exe /list

not just '//wsl$'.

See following:

https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/
  Announce of P9 server for WSL compatible with UNC.

Cygwin works with UNC according to the doc, that's why I tried it with fstab.

-- 
http://defun.work/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-04 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-07 14:40 Access WSL files from cygwin Cary Lewis
2021-02-07 18:08 ` Eliot Moss
2021-03-04 19:44 ` Oleksandr Gavenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).