public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: "Henry S. Thompson" <ht@inf.ed.ac.uk>
Cc: cygwin@cygwin.com, Oleksandr Gavenko <gavenkoa@gmail.com>
Subject: Re: Help with setting Cygwin's Emacs W32 TRAMP to WSL 1
Date: Thu, 26 Nov 2020 21:22:08 +0200	[thread overview]
Message-ID: <CAFNJpnifghu=f65dRmXZtieEanNowYzA8FMFbD0x75qk-0Q=PQ@mail.gmail.com> (raw)
In-Reply-To: <f5bblfkdkos.fsf@ecclerig.inf.ed.ac.uk>

On Thu, Nov 26, 2020 at 8:42 PM Henry S. Thompson <ht@inf.ed.ac.uk> wrote:
>
> Oleksandr Gavenko via Cygwin writes:
>
> > ...
> > WSL1 files are "hidden" for regular access.
>
> I probably misunderstand, but I can see my WSL/Ubuntu files via this
> path from Cygwin:
>
>  /c/Users/ht/AppData/Local/Packages/CanonicalGroupLimited.../LocalState/rootfs
>
You are not allowed to edit them from the "Windows" process. Only from LXSS:

https://devblogs.microsoft.com/commandline/do-not-change-linux-files-using-windows-apps-and-tools/

> DO NOT, under ANY circumstances, access, create, and/or modify Linux files inside
> of your `%LOCALAPPDATA%` folder using Windows apps, tools, scripts, consoles, etc.

You'll face:

https://github.com/microsoft/WSL/issues/1524
changes made in Windows File System - not seen in Bash

Though I forgot about their announce of P9 fileserver (dated May 2019
Windows 10 version 1903):

> WSL hosts a new 9P fileserver, which exposes distro filesystems to Windows apps and tools via \\wsl$\<DistroName>\!

Details are here:

https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/

I tried in elevated cmd:

cmd# cd \\wsl$\debian\
'\\wsl$\debian\'
CMD does not support UNC paths as current directories.

cmd# net use x: \\wsl$\debian\
System error 67 has occurred.
The network name cannot be found.

It is only available in Explorer and some "cool" editors, like Code.

I do not know if Cygwin allows to "mount" that P9 fileserver...

There is an example of network mounting:
https://cygwin.com/cygwin-ug-net/mount.html

so I tried it:

bash# mount '//wsl$/debian' /mnt
mount: defaulting to 'notexec' mount option for speed since native path
       references a remote share.  Use '-f' option to override.

bash# ls /mnt
ls: cannot access '/mnt/initrd.img': Input/output error
ls: cannot access '/mnt/initrd.img.old': Input/output error
ls: cannot access '/mnt/vmlinuz': Input/output error
ls: cannot access '/mnt/vmlinuz.old': Input/output error
bin  boot  c  d  dev  etc  home  init  initrd.img  initrd.img.old  lib
 lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr
var  vmlinuz  vmlinuz.old

Cool! Let's make it permanent.

$ cat /etc/fstab

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

$ mkdir -p /wsl/{ubuntu,debian,alpine}
$ mount /wsl/debian
$ mount /wsl/ubuntu
$ mount /wsl/wsl

And the final step it testing with Cygwin's Emacs W32:

I can read files, but on save I've got:

Saving file /wsl/debian/opt/sa-batch-am-dbsync/run.env...
basic-save-buffer-2: Unlocking file: Invalid argument,
/wsl/debian/opt/sa-batch-am-dbsync/run.env

Trying in Cygwin's bash:

bash# cd /wsl/debian/home/user/
bash# touch test.txt
bash# ls -l test.txt
-rw-r--r-- 1 user user 0 2020-11-26 21:18 test.txt

bash# echo 123 >test.txt
bash# echo 456 >>test.txt
bash# cat test.txt
123
456

So Emacs tries to make some "smart" locking on dumb FS... Need to
waste another few hours to make Emacs work.

At least I have something!

  reply	other threads:[~2020-11-26 19:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 15:18 Oleksandr Gavenko
2020-11-26 15:24 ` Eliot Moss
2020-11-26 20:38   ` Oleksandr Gavenko
2020-11-27 18:12     ` Eliot Moss
2020-11-28 14:07       ` Oleksandr Gavenko
2020-11-26 18:42 ` Henry S. Thompson
2020-11-26 19:22   ` Oleksandr Gavenko [this message]
2020-11-26 20:02     ` Oleksandr Gavenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFNJpnifghu=f65dRmXZtieEanNowYzA8FMFbD0x75qk-0Q=PQ@mail.gmail.com' \
    --to=gavenkoa@gmail.com \
    --cc=cygwin@cygwin.com \
    --cc=ht@inf.ed.ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).