3

I am trying to copy files from WSL2 Ubuntu 18.04 to Windows v21H1 using path \\wsl$\Ubuntu-18-04 so I can create a boot disk for a Yocto project I am working on, and can see, access, and navigate to the WSL files in Explorer. I can copy files no problem, but when trying to paste them into a Windows directory, I get:

Error 0x80070781: The name of the file cannot be resolved by the system.
  • I have searched a lot, but only found examples of errors going from Windows to WSL
  • I have reinstalled Windows and WSL, but am still the same error
  • I can copy and paste from WSL to Windows directories within WSL using the mnt process, but the files seem to be corrupted
  • I have done a clean install of Windows 10 and also upgraded to Windows 11
  • I have tried exactly the same copy and paste procedure within Windows Explorer and this time got the following error message:
Error 0x80004005: Unspecified error''
  • I have also tried to use mv and cp within WSL and got the following error:
mv: preserving times for '/mnt/c/Users/olive/Documents/b2qt-embedded-qt5-image-imx8mm-var-dart.wic': Operation not permitted
  • I can copy and paste other files from adjacent directories in WSL to Windows with no issue. It seems to be something related to these Yocto image files. THERE MUST BE SOMETHING TO THIS!!!! However, until WSL supports removable USB SD card readers (or USB devices at all) then I need to copy these files to Windows to be able to create an SD boot disc.
  • I have google drive set up on my computer (two set up, one for personal account another for business). Is there any change it could be causing issues? The google drive folder show up as mounted drives.
  • I have checked file permissions and they are all read/write/exe.
  • Have raised this on the WSL git thread https://github.com/microsoft/WSL/issues/7683

Proposed solutions that have been tried (all suggestions greatly appreciated):

  1. The proposed solution to review a previous post is helpful to work out how it should be working (I have already learned how to use Explorer for WSL), however something is preventing me from copying some files to a Windows folder and is not addressed in the suggested post.

  2. I tried to create the WLS.conf file with associated content and this did not solve the issue.

  3. to my knowledge none of the files or folders are junction points.

  4. I cleared everything I could from the temp folder (couldn't delete things that were in use) and again this didn't solve the issue. The temp folder isn't compressed either.

SOLTUION!!!: I haven't solved the issue but I have found a work around. As mention, I was ultimately trying to cerate a boot disk using a USBc external card reader. I tried this on win32 and rufus with no luck. They weren't allowing me to select the file from WSL and as you know I couldn't copy the file to put it in a windows directory. I recently came across Etcher. It worked a treat!!! I still don't know why I couldn't copy and past the files but I have a work around for my desired purpose.

Thank you all for your help.

  • Thanks for reposting this over here. Question -- I'm assuming that you are using the \\wsl$\<distroname> path, but can you confirm that in an edit to your question? Also, it may not matter, but could you also add your Windows release (e.g. Windows 10 21H1)? Thanks! – NotTheDr01ds Nov 11 '21 at 05:42
  • 1
  • Thanks for the responses. I've previously tried all the solutions in the link you provided but still no joy. I can successfully navigate the files in WSL from Explorer and copy them but when I paste them into a windows directory I get the error message. – HongKongFooey78 Nov 11 '21 at 06:07
  • With further testing it seems this problem is not for all file types. Its definitely a problem for all the file types I am trying to work with. I've also tried to select the image directly from within rufus and still the same problem. – HongKongFooey78 Nov 11 '21 at 07:08
  • I'm seeing a problem with accessing WSL files from Windows, with the error of "Access is denied", no matter if I Runs as Administrator or not. However, doing the copy (cp) from WSL to Windows (/mnt/c...), there's no problem. – harrymc Nov 11 '21 at 11:21
  • 1
    @HongKongFooey78 Please list the full path of the Windows directory you're trying to copy into, and if the resulting file path of the copied files is over 260 characters (not uncommon in non-Windows environments), please see this. – JW0914 Nov 11 '21 at 13:15
  • @JW0914 thanks for your responses. I have been trying to keep things as simple as possible and have tried to paste into the downloads and documents top folders. Therefore the path shouldn’t be long and also doesn’t include any spaces. I also wondered if the file name itself was too long and changed it to “test” with no improvement in the outcome. – HongKongFooey78 Nov 12 '21 at 01:08
  • @harrymc thanks for your response. I tried cp into the mnt/ directory and it worked but the file became red with an asterisk and was non-functional on the windows side. – HongKongFooey78 Nov 12 '21 at 01:10
  • I’m still in the process of finalising a clean install. I ran into problems with my pro upgrade from home and I wonder if that has had anything to do with the problem. Something around billing and the licence key (on a 2 week old machine). I know the WSL2 functionality is dependent on a pro licence so perhaps something broke with a download of an update???? It took me 2.5 hours with Microsoft at 1:30am my time to solve the license issue. I’m yet to recompile my project and test. – HongKongFooey78 Nov 12 '21 at 01:22
  • @JW0914 copy path was: \wsl.localhost\Ubuntu-18.04\home\oliver\var-b2qt\build-imx8mm-var-dart\tmp\deploy\images\imx8mm-var-dart\b2qt-embedded-qt5-image-imx8mm-var-dart.wic

    Paste path was: C:\Users\olive\Documents

    – HongKongFooey78 Nov 12 '21 at 07:29
  • While hopefully a reinstall took care of it for you, but I'd put that at about a 30% chance (especially since WSL2 runs just fine in the "Home" version. In case the reinstall doesn't help, see if you can copy the file using Linux, via mv ~/var-b2qt/build-imx8mm-var-dart/tmp/deploy/images/imx8mm-var-dart/b2qt-embedded-qt5-image-imx8mm-var-dart.wic /mnt/c/Users/olive/Documents/. – NotTheDr01ds Nov 12 '21 at 14:41
  • IMHO, you really deserve some more upvotes for this question. It's not something we normally run across. – NotTheDr01ds Nov 12 '21 at 14:42

3 Answers3

0

A few things to try that won't fit in comments:

  • WSL permission errors when dealing with the Windows filesystem are sometimes resolved by adding the metadata option to the mount. To do this, create (via sudo) /etc/wsl.conf with the following:

    [automount]
    options = "metadata,umask=22,fmask=11"
    

    The metadata option allows WSL to set (or at least "pretend" to set) permissions on Windows files. The umask/fmask set the default permissions that WSL will see for files/directories on the Windows filesystem.

  • Per this Github issue, the error can be caused if there is a Windows junction point in play. That particular thread is about an issue installing WSL, where the lxss folder was a junction point. There is also a comment from someone who had this issue with Windows Media Player. So it seems to be a potentially "general" issue.

    Is there any chance that any of the directories in the file path are junction points?

  • Also, some Googling says that the 0x80004005 error that you are seeing after reinstalling on Windows 11 can be caused by %temp% directory issues. Two things that I can think of to try there:

    • Delete all files in your %temp% directory.
    • Make sure your %temp% directory is not compressed or encrypted. This is known to cause issues with WSL networking. While I've never seen it manifest in this particular way, it would be possible since the WSL/Windows file integration is done via pseudo-network share (Plan9 filesystem protocol).
NotTheDr01ds
  • 21,923
  • Thank you NotTheDr01ds. I tried all your solutions with no joy I am afraid. the 0x80004005 seems to be a generic error code associated with a number of issues which makes this increasingly hard to solve. – HongKongFooey78 Nov 14 '21 at 13:55
  • @HongKongFooey78 Just in case, I did forget to mention that you need to do a wsl --shutdown after creating the wsl.conf file. But yes, this is a tough one. – NotTheDr01ds Nov 14 '21 at 20:38
  • thanks. I even restarted to be sure. – HongKongFooey78 Nov 15 '21 at 01:17
0

I used Etcher to create a boot disk that was able to select the file from with WSL. I was super simple to use. I haven't solved the copy and paste issue but I have found a workaround.

0

I encountered the same error codes (Error 0x80070781) when attempting to copy folders and files from WSL-2 directories to local windows directories or USB disks using "rsync -av" (errors such as /{Dirs/{copied files} failed: operation not permitted). After changing permissions using chmod (e.g., chmod -R 777), I had no luck; the issue persisted. However, simply adding sudo as "sudo rsync -av" resolved the errors. I'm sharing this information here for others who may experience similar issues.

7-x
  • 1