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

Adding WSL in Visual Studio fails with "Failed to archive sysroot [...]" #284

Closed
patrikhuber opened this issue Apr 24, 2018 · 18 comments
Closed
Assignees
Labels

Comments

@patrikhuber
Copy link

patrikhuber commented Apr 24, 2018

Hi!

I've filed this over at microsoft/WSL/issues/3124 because I wasn't aware of this repository - but I just found it, and I think the issue is a better fit here!

I'm following the instructions here: https://blogs.msdn.microsoft.com/vcblog/2017/02/08/targeting-windows-subsystem-for-linux-from-visual-studio/ to the point.
When going to "Tools > Options > Cross Platform > Connection Manager", entering the details, and clicking "Connect", it results in the following error:
image

The log file contains the following:

liblinux.ExceptionBase: Failed to archive sysroot, command used: 'zip -r /var/tmp/sysroot_bd10b29c-e9ef-409f-94da-ad87165daa75.zip '.
at liblinux.Services.RemoteCompiler.CreateSysrootArchive()
at liblinux.Services.RemoteCompiler.DownloadSysroot()
at liblinux.Services.RemoteCompiler.CreateSysroot()
at liblinux.Services.RemoteCompiler.CreateLocalSysroot()
at Microsoft.VisualStudio.Linux.Package.Dialogs.HeaderUpdateDialog.<>c__DisplayClass17_0.b__0(Object _)

My system:

@lukka
Copy link
Member

lukka commented Apr 26, 2018

@patrikhuber could you ensure you have the zip tool on your Ubuntu? Just install it with apt if it is missing. Then report back if the problem persists.

@patrikhuber
Copy link
Author

Hi @lukka, I can confirm that zip is installed in WSL.

@patrikhuber
Copy link
Author

patrikhuber commented Apr 28, 2018

Okay, this is something very sneaky: The instructions tell you to start the ssh daemon in WSL, on the default port. And it starts, without any warning or error. But: Windows 10 has actually already an ssh daemon running (and on port 22)! This caught me by surprise. So when you (or VS) tries to do "ssh localhost", it connects to the ssh daemon running on Windows 10 (!!!), and not the one running in WSL.

The solution is to run the ssh daemon inside WSL on a different port, and then use that port in the VS configuration dialog. Then, everything works.

This is not trivial to find out (who would have guessed that Windows runs an ssh daemon by default, and on port 22?). And the VS error message is also very bad and tells you not much about what's going on.

I would suggest that Microsoft improves the error messages and documentation on this. Pretty sure I wouldn't be the only one to run into this.

I would also question the fact that Windows 10 runs an ssh daemon by default on the system. I am not a security expert, but this smells to me like something one shouldn't be doing.

@stanthomas
Copy link

It's discussed in the comments to the original blog and if you follow the links you'll see that this workaround has been required for quite some time.

@patrikhuber
Copy link
Author

@stanthomas Forgive me for not reading all the comments in that blog post, there are quite a number of them (and most of them irrelevant). In my opinion this "gotcha" deserves a strong mentioning somewhere in the documentation/blog post - as you can see I am not the only one running into this.

Sure, the SU post describes exactly the issue & the solution - hindsight is always 20/20. :-)

@stanthomas
Copy link

@patrikhuber Hey, I'm not sniping. Just joining you in suggesting Marc updates his blog.

@patrikhuber
Copy link
Author

@stanthomas Ok cool! :-) 👍

@itodirel
Copy link
Member

itodirel commented May 2, 2018

@patrikhuber unfortunately it's difficult to provide diagnostics because there's not much information available, we can get the identity of the SSH server but that does not say much, and in the end it is presented to us as authentication failure, which is correct. We could see if port 22 is used locally and maybe find the process or service owning it, but that would be hacky

@patrikhuber
Copy link
Author

patrikhuber commented May 2, 2018

@itodirel "An error has occured. Failed to archive sysroot [...]" is not an authentication failure though. In hindsight the error is obvious - VSLinux has logged into Windows 10 ssh and executed its "zip" command there, which obviously fails (instead of connecting to the WSL bash, where that command would work). Deducing from this error message that another SSH client is running (from Windows 10, running by default, which I as a user never set up or heard about before!) is quite a stretch. A huge stretch in my opinion. That is why I am saying if it's not possible to improve the situation, then at least the documentation should mention this big gotcha clearly (in a prominent place in my opinion). You know, I've painfully found out and fixed it, so at this point I don't care anymore - I just care for the poor users that come after me and have to figure this out on their own too.
:-)

@itodirel
Copy link
Member

itodirel commented May 3, 2018

If the case for when the connection failed or if zip is missing, we already made a fix to tell you exactly why, that one is done, but not yet in one of the currently published Previews

@xwxbug
Copy link

xwxbug commented May 31, 2018

same issue in centos 6/7.
zip command exist.
vs version: vs 2017 15.8.0 pre 1.1/vs 2017 15.7.2

@Berrysoft
Copy link

It succeed in Ubuntu 16.04, but after upgraded to 18.04 it failed.

Zip exists.

vs version: 15.7.6

@itodirel
Copy link
Member

itodirel commented Aug 8, 2018

can you attach the log?

@Berrysoft
Copy link

liblinux.ExceptionBase: Failed to archive sysroot, command used: 'zip -r /var/tmp/sysroot_de9194f5-7c7a-4a32-8e82-a83e7e05f153.zip '.
   at liblinux.Services.RemoteCompiler.CreateSysrootArchive()
   at liblinux.Services.RemoteCompiler.DownloadSysroot()
   at liblinux.Services.RemoteCompiler.CreateSysroot()
   at liblinux.Services.RemoteCompiler.CreateLocalSysroot()
   at Microsoft.VisualStudio.Linux.Package.Dialogs.HeaderUpdateDialog.<>c__DisplayClass17_0.<DownloadUpdate>b__0(Object _)

@itodirel

@itodirel
Copy link
Member

Hi, I believe this should be now fixed in the latest release, can you try it?

@Berrysoft
Copy link

I'm now using VS 2019 Preview 1.1. It doesn't report this error anymore, but now it sometimes synchronizes the wrong headers... Maybe it's a new issue.

@itodirel
Copy link
Member

@Berrysoft could you provide us with a repro? please open a separate issue for the problem you are seeing

@Berrysoft
Copy link

Seems that it works now, and I needn't open a new issue.

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

No branches or pull requests

7 participants