Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running WSL from Non-System Drive Fails with 0x80070057 #55

Closed
nh905 opened this issue Aug 6, 2018 · 27 comments
Closed

Running WSL from Non-System Drive Fails with 0x80070057 #55

nh905 opened this issue Aug 6, 2018 · 27 comments

Comments

@nh905
Copy link

nh905 commented Aug 6, 2018

I am running windows 10 Home (version 1803, build 17134.167) on an Intel Cherry Trail system with 64GB EMMC flash. I am trying to move WSL onto a 32GB microSD card but so far have not had any success. I may not be following the instructions properly.

I initially enabled WSL and installed Debian Stretch from the Windows Store. I then installed LxRunOffline 3.0.01 and duplicated the existing WSL setup using "LxRunOffline.exe duplicate -n Debian -d e:\WSL -N Debian2". This worked: I could launch Debian from the Debian icon in the taskbar, but was not sure which instance it was running. Running "bash" or "wsl" failed with 0x80070057.

I uninstalled the duplicated WSL using "xRunOffline.exe uninstall -n Debian2" and then moved Debian using "LxRunOffline.exe move -n Debian -d e:\WSL". Although there were no errors, attempts to launch Debian using bash, wsl, or the Debian icon in the taskbar failed. "LxRunOffline.exe get-default" returned "[ERROR] Couldn't get the value "DistributionName" of the registry key Software\Microsoft\Windows\CurrentVersion\Lxss{73E56EF3-4FFF-4A94-9EF2-D54D6C805192}". Reason: The system cannot find the file specified."

In case I corrupted something, I uninstalled Debian using LxRunOffline, disabled WSL, rebooted, enabled WSL, rebooted, downloaded Debian from https://lxrunoffline.apphb.com/download/Debian/Stretch and installed with "LxRunOffline.exe install -n Debian -d e:\wsl -f ..\rootfs.tar.xz". Again, there were no errors. However, running bash, wsl, or "LxRunOffline.exe run -n Debian" all failed with 0x80070057.

Other issues suggested launching WSL from an admin prompt. I first had to register Debian using "LxRunOffline.exe register -n Debian -d e:\wsl". Running bash or wsl fail with "Windows Subsystem for Linux has no installed distributions.". Running "LxRunOffline.exe run -n Debian" fails with 0x80070057.

I am at a loss as to what to try next. I do not see any relevant entries in Event Viewer (Application or System). Any suggestions?

Thanks, Norbert

@DDoSolitary
Copy link
Owner

Could you please try rebooting after install/register and then launch the distro?

@DDoSolitary
Copy link
Owner

DDoSolitary commented Aug 7, 2018

And please use the dev releases for duplicate/move, v3.0.1's implementation has several known bugs, which probably caused most of your problems.

@nh905
Copy link
Author

nh905 commented Aug 7, 2018

@DDoSolitary , I did a reboot and tried starting Debian from an Admin command shell. "LxRunOffline.exe run -n Debian" fails with error 0x80070057, bash/wsl fail with "Windows Subsystem for Linux has no installed distributions." I also tried from a standard command shell - all three fail with 0x80070057.

I had a look at https://ci.appveyor.com/project/DDoSolitary/lxrunoffline but do not see a Windows binary. I will upgrade to version 3.1.0, remove the current Debian install, install Debian from the Windows Store, then test moving the Debian WSL.

Thanks, Norbert

@DDoSolitary
Copy link
Owner

DDoSolitary commented Aug 7, 2018

You have to click the first job (USE_MSYS2=false) and then click "ARTIFACTS" to see the binaries. Anyway, v3.1.0 should work either as I just released it several hours ago so it is compiled from the latest code.

@nh905
Copy link
Author

nh905 commented Aug 7, 2018

Got it.

I disabled/enabled WSL, installed Debian GNU/Linux from the Microsoft store and went through Debian initialisation. Just in case, I rebooted and then moved Debian.

E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe move -n Debian -d e:\WSL
E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe run -n Debian
Error: 0x80070057

E:\Norbert\Downloads\LxRunOffline-v3.1.0>wsl
Error: 0x80070057
Press any key to continue...

E:\Norbert\Downloads\LxRunOffline-v3.1.0>bash
Error: 0x80070057
Press any key to continue...

I also tried from an Admin prompt - no need to register Debian this time, , but still no joy,

C:\WINDOWS\system32>e:
E:\>cd \wsl
E:\WSL>wsl                                   same with 'bash'
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
Press any key to continue...

E:\WSL>cd \norbert\downloads\LxRunOffline-v3.1.0
E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe run -n Debian
Error: 0x80070057

E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe get-dir -n Debian
e:\wsl

E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe get-default
[ERROR] Couldn't get the value "DefaultDistribution" of the registry key "Software\Microsoft\Windows\CurrentVersion\Lxss\".
Reason: The system cannot find the file specified.

Thanks, Norbert

@DDoSolitary
Copy link
Owner

DDoSolitary commented Aug 8, 2018

You need to run the set-default command before running the distro via bash or wsl. However, it's pretty weird that the run command doesn't work too. Please try to install Debian from store and move/duplicate it to somewhere else in C: rather than E:

@DDoSolitary
Copy link
Owner

DDoSolitary commented Aug 8, 2018

And please try the methods mentioned in microsoft/WSL#3054 and microsoft/WSL#7 like checking LxssManager service and console legacy mode

@JaimeChavarriaga
Copy link

JaimeChavarriaga commented Aug 8, 2018

I was able to duplicate a distribution installed from the Windows Store. I must mention that I had set some permissions to the directory used to install the copy.

I assigned permissions (some days ago) using icacls <dir> /grant "<user>:(OI)(CI)(F)":

C:\> whoami
test\jaime

C:\> icacls D:\wsl /grant "jaime:(OI)(CI)(F)"

Today, I made a copy of an Ubuntu 18 distro installed from the Store. Its directory is located in %LOCALAPPDATA%\Packages. The resulting copy was installed in D:\WSL and worked.

C:\> lxrunoffline version
LxRunOffline v3.1.0

C:\> lxrunoffline get-dir -n Ubuntu-18.04
C:\Users\nnn\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState

C:\> lxrunoffline duplicate -n Ubuntu-18.04 -d d:\wsl\installed\ubuntu-copy -N ubuntu-copy

C:\> lxrunoffline run -n ubuntu-copy -w
user@test:~$ exit
logout

C:\> lxrunoffline get-dir -n ubuntu-copy
d:\wsl\installed\ubuntu-copy

@nh905
Copy link
Author

nh905 commented Aug 8, 2018

I tried setting Debian as the default using wslconfig and LxRunOffline. "LxRunOffline get-default" is now working. Unfortunately, I still cannot launch Debian.

E:\Norbert\Downloads\LxRunOffline-v3.1.0>wsl
Error: 0x80070057
Press any key to continue...

E:\Norbert\Downloads\LxRunOffline-v3.1.0>wslconfig /s Debian

E:\Norbert\Downloads\LxRunOffline-v3.1.0>wsl
Error: 0x80070057
Press any key to continue...

E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe set-default -n Debian

E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe get-default
Debian

E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe run -n Debian
Error: 0x80070057

E:\Norbert\Downloads\LxRunOffline-v3.1.0>wsl
Error: 0x80070057
Press any key to continue...

Legacy mode is disabled in my standard and Admin command prompts. microsoft/WSL#3054 appears to be specific to the Kali distribution. I am able to install and launch Debian successfully, but cannot launch it after moving Debian to another partition.

To narrow down the problem, would it be worth:

  • moving Debian back to the systems drive, to see if move operation itself works
  • uninstalling Debian and using LxRunOffline to install it directly to E:\WSL
  • running an ETL trace while reproducing the problem

Thanks, Norbert

@nh905
Copy link
Author

nh905 commented Aug 8, 2018

@JaimeChavarriaga , were you able to uninstall the Ubuntu instance on the system drive and still launched the duplicated instance? I had tried duplicating Debian earlier but at the time did not understand how to ensure I was running the duplicated instance, so I tried a move operation which led to this thread.

Thanks, Norbert

@JaimeChavarriaga
Copy link

JaimeChavarriaga commented Aug 8, 2018

@nh905 , Yes. I was able to move the Ubuntu instance. I ran the resulting copy using lxrunoffline and the wsl/ bash commands.

  • Had you set the permissions to the parent folder of the location where you wanna move your installation?
C:\wsl> lxrunoffline get-dir -n Ubuntu-18.04
C:\Users\nnn\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState

C:\wsl> lxrunoffline move -n Ubuntu-18.04 -d d:\wsl\installed\Ubuntu-18.04

C:\wsl> lxrunoffline run -n Ubuntu-18.04 -w
user@test:~$ exit
logout

C:\wsl> lxrunoffline get-dir -n Ubuntu-18.04
d:\wsl\installed\Ubuntu-18.04

C:\wsl>lxrunoffline get-default
Ubuntu-18.04

C:\wsl>wsl
user@test:/mnt/c/wsl$ exit
logout

To identify which distribution I am running, I am setting a WSL_DISTRO environment variable in each distribution. You can use lxrunoffline to set the variable doing something like the following:

C:\wsl> lxrunoffline get-env -n Ubuntu-18.04
HOSTTYPE=x86_64
LANG=en_US.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
TERM=xterm-256color

C:\wsl> lxrunoffline set-env -n Ubuntu-18.04 -v "WSL_DISTRO=Ubuntu-18.04" -v "HOSTTYPE=x86_64" -v "LANG=en_US.UTF-8" -v "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" -v "TERM=xterm-256color"

C:\wsl> lxrunoffline get-env -n Ubuntu-18.04
WSL_DISTRO=Ubuntu-18.04
HOSTTYPE=x86_64
LANG=en_US.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
TERM=xterm-256color

C:\wsl> lxrunoffline run -n Ubuntu-18.04 -w -c "echo $WSL_DISTRO"
Ubuntu-18.04

@nh905
Copy link
Author

nh905 commented Aug 9, 2018

@JaimeChavarriaga , thanks for the details. I hadn't set permissions for e:\wsl because LxRunOffline creates the folder. I will check the permissions on the existing folder to see if they are different.

I will follow your procedure. If it works, then I will use it as a base to determine what I was doing differently.

Thanks, Norbert

@nh905
Copy link
Author

nh905 commented Aug 10, 2018

@JaimeChavarriaga , I think I followed your steps accurately, but am still not able to launch the moved Ubuntu system. All the options and flags are identical to those for the initial installation from the Microsoft Store, with the exception of the directory. The icacls output looks similar to yours - the additional (I) indicates that the permissions were inherited from E:.

E:\Norbert\Downloads\LxRunOffline-v3.1.0>lxrunoffline move -n Ubuntu-18.04 -d e:\wsl\Ubuntu-18.04
E:\Norbert\Downloads\LxRunOffline-v3.1.0>icacls e:\wsl
	e:\wsl Everyone:(I)(OI)(CI)(F)
E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe get-default
	Ubuntu-18.04
E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe get-dir -n Ubuntu-18.04
	e:\wsl\Ubuntu-18.04
E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe get-env -n Ubuntu-18.04
	HOSTTYPE=x86_64
	LANG=en_US.UTF-8
	PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
	TERM=xterm-256color
E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe get-uid -n Ubuntu-18.04
	1000
E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe get-kernelcmd -n Ubuntu-18.04
	BOOT_IMAGE=/kernel init=/init ro
E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe get-flags -n Ubuntu-18.04
	7
E:\Norbert\Downloads\LxRunOffline-v3.1.0>lxrunoffline set-env -n Ubuntu-18.04 -v "WSL_DISTRO=Ubuntu-18.04" -v "HOSTTYPE=x86_64" -v "LANG=en_US.UTF-8" -v "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" -v "TERM=xterm-256color"

E:\Norbert\Downloads\LxRunOffline-v3.1.0>lxrunoffline run -n Ubuntu-18.04 -w -c "echo $WSL_DISTRO"
	Error: 0x80070057

I moved Ubuntu back to its original location on the system drive - LxRunOffline now launches Ubuntu just fine. That suggests the move operation itself is not the issue, but that we are back to WSL restricting instances to the system drive.

I just did another move to the E:\ drive after running icacls against the e:\wsl folder - still not working.

E:\Norbert\Downloads\LxRunOffline-v3.1.0>icacls e:\wsl /grant "Norbert:(OI)(CI)(F)"
	processed file: e:\wsl
	Successfully processed 1 files; Failed processing 0 files

E:\Norbert\Downloads\LxRunOffline-v3.1.0>lxrunoffline move -n Ubuntu-18.04 -d e:\wsl\Ubuntu-18.04

E:\Norbert\Downloads\LxRunOffline-v3.1.0>LxRunOffline.exe run -n Ubuntu-18.04
	Error: 0x80070057

What version of Windows are you running? I am on Version 1803 Build 17134.167.

Thanks, Norbert

@nh905
Copy link
Author

nh905 commented Aug 10, 2018

@DDoSolitary , I generated ETL files using the procedure at https://docs.microsoft.com/en-us/windows/wsl/troubleshooting#starting-bash-gives-an-error-code. I tried reading them with Network Monitor and Event Viewer but cannot make sense of the output. I can upload them if they would be useful to you.

Thanks, Norbert

@DDoSolitary
Copy link
Owner

Ofc they would be useful. You can also send it to the email address of my account.

@Biswa96
Copy link

Biswa96 commented Aug 12, 2018

@nh905 You can try Windows Performance Analyzer or TraceView in Windows Driver Kit to read ETL files.
I've no that big SD card so I can't try. But I've a workaround. You can install any distro in a Virtual Hard Disk file e.g. VHD or VMDK. Then copy/move that to SD card.

@nh905
Copy link
Author

nh905 commented Aug 13, 2018

@Biswa96 , can you point me to instructions? I recall seeing something about using VHD(X) but thought a subsequent release of Windows had blocked this.

Thanks, Norbert

@Biswa96
Copy link

Biswa96 commented Aug 13, 2018

@nh905 I mention that VHD as an alternative and this isn't related with your real issue. Once I tried install wsl in a sdcard. Though bsdtar (from LxssManager.dll) can extract tar.gz in sdcard wsl can't execute Lx binary. I'll try with newer Windows insider.

You can try this procedure from @voskrese repository CentOSWSL. WSL fixed the file permission in newer Windows insider 17723 or above.

@MVoz
Copy link

MVoz commented Aug 13, 2018

@nh905
#42 (comment)

Everyone

icacls "E:\" /grant Everyone:(OI)(CI)(F) - e: = vhd\vhdx

@nh905
Copy link
Author

nh905 commented Aug 13, 2018

@Biswa96 and @voskrese , thanks for the information. The instructions seem fairly complex - I will wait to see if DDoSolitary can update LxRunOffline or Microsoft removes the restriction on running WSL from the system drive.

@DDoSolitary
Copy link
Owner

DDoSolitary commented Aug 23, 2018

@nh905 Sorry for the delay. According to your comments after moving back the distro to C: the distro works. Could you please check what file system is used for E: and there are some special features enabled (like compression/encryption). Thanks.

@nh905
Copy link
Author

nh905 commented Aug 24, 2018

@DDoSolitary the E: drive is on a 32GB Samsing EVO+ microSD card, formatted NTFS with no compression or encryption. 'Everyone' has full control except for Special permissions. "Allows files on this drive to have contents indexed" is enabled.
Thanks, Norbert

@DDoSolitary
Copy link
Owner

DDoSolitary commented Aug 25, 2018

Well, I'm sorry but I have to say that there's little thing I can do to help you. Neither I nor other users can reproduce this problem, and I have shared every possible causes I came up with, but in vain. I have also tried to read the ETL files you sent to me, but it turned out that they only contain opaque error numbers that I can't understand.

Maybe you could open an issue in https://github.com/Microsoft/WSL and share your ETL files with MS folks there to see if they can extract some useful information. Note that they will be a bit unhappy if you upload your logs directly to an issue. The CONTRIBUTING.md file in that repo mentions an email address to send logs.

@DDoSolitary
Copy link
Owner

DDoSolitary commented Aug 25, 2018

@Biswa96 Sorry, I didn't see your previous comment. So the problem is with SD cards? I think we should file an issue in the WSL repo... PS: logs have been sent.

@nh905
Copy link
Author

nh905 commented Aug 26, 2018

@DDoSolitary and @Biswa96 , thanks for all of your work on this. Please let me know if there are any developments or I can help provide additional information.

Thanks, Norbert

@DDoSolitary
Copy link
Owner

@nh59 Microsoft has officially said that it's impossible to directly use an SD card: microsoft/WSL#3519 (comment). You can still use the vhdx method described by @Biswa96, or talk to MS staff in microsoft/WSL#3519. I'm closing this issue because it's not something that I can fix.

@nh905
Copy link
Author

nh905 commented Sep 14, 2018

@DDoSolitary and @Biswa96 , thanks for all of your work in trying to get this resolved.

Norbert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants