microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.46k stars 822 forks source link

VS Code won't open in Windows Bash #1233

Closed MaximoTrinidad closed 7 years ago

MaximoTrinidad commented 8 years ago

Please use the following bug reporting template to help produce actionable and reproducible issues. Please try to ensure that the reproduction is minimal so that the team can go through more bugs!

maxt@MTrinidadLT2:/mnt/c/Users/mtrinidad/Downloads$ sudo dpkg -i code_1.6.1-1476373175_amd64.deb [sudo] password for maxt: (Reading database ... 46508 files and directories currently installed.) Preparing to unpack code_1.6.1-1476373175_amd64.deb ... Unpacking code (1.6.1-1476373175) over (1.6.1-1476373175) ... Setting up code (1.6.1-1476373175) ... Processing triggers for mime-support (3.54ubuntu1.1) ... maxt@MTrinidadLT2:/mnt/c/Users/mtrinidad/Downloads$ code /usr/share/code/bin/../code: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory maxt@MTrinidadLT2:/mnt/c/Users/mtrinidad/Downloads$

winbashcodeerr_2016-10-20_11-21-45

See our contributing instructions for assistance.

fpqc commented 8 years ago

I haven't tried vcXsrv for vscode, but you will need at least that, and to export DISPLAY=:0

qazwsxedcrfvtg14 commented 8 years ago

In Build 14951 You can try to add alias code="\"/mnt/c/Program Files (x86)/Microsoft VS Code/Code.exe\"" in ~/.bashrc (You need to install VS Code in windows first.) Then you can type "code FILENAME" to open file. (but this only work fine in windows directory(/mnt/c/, /mnt/d/) )

MaximoTrinidad commented 8 years ago

I'm way ahead! I've been using vcXsrv for a while.

As I mention before, vs code is loaded. I'm just still getting the same error message when its trying to load:

"/usr/share/code/code: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory"

And, I don't want to run it from Windows Program files as is already loaded under the Linux subsystem.

See images Windows 10, BASH, and vcXsrv as I created some Linux batch to run some Linux apps. It's so close for VS Code work!

winbashcodeerr2_2016-10-20_11-21-45

winbashcodeerr3_2016-10-20_11-21-45

MaximoTrinidad commented 8 years ago

Hum! As I posted the previous code, I realized the code for VS Code, I found the "standard install location". It has to be something in BASH because this VS Code work in Linux perfect.

vscode_code_2016-10-20_13-35-38

therealkenc commented 8 years ago

"It's so close for VSCode to work". Electron apps are based on a large body of software not currently supported by WSL. See #648.

Weird you don't have libXss though, given that you've made it this far. That's the Screen Saver extension library, which should have come along for the ride with your other X11 stuff. You can install it with sudo apt-get install libxss1, but that isn't going to help your cause much. Sublime Text works well, for what it's worth.

MaximoTrinidad commented 8 years ago

Awesome!

Now the error message changes to: maxt@MTrinidadLT2:/mnt/c/Windows/System32$ code /usr/share/code/bin/../code: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory

:)

fpqc commented 8 years ago

Sounds like the next thing you need is gtk?

therealkenc commented 8 years ago

Do sudo apt-get install ubuntu-desktop so at least you have the bits and pieces needed to run graphic apps, including firefox. All of which is unsupported by WSL at the moment, but like the man said if it works you can go and have fun. ;)

MaximoTrinidad commented 8 years ago

@therealkenc

Found it missing library: http://stackoverflow.com/questions/37624225/shared-libraries-libgconf-2-so-4-is-missing

So I ran: sudo apt-get install Gconf2

Now, when executing "code". No errors but is not showing on the screen.
But, I'm use the cmd "top" to list all services running and it showing three "code" running.

I'm almost there!

Any ideas are Welcome!!

bash_code_2016-10-21_9-57-01

therealkenc commented 8 years ago

From here mostly my idea would be to recompile libchromiumcontent and figure out why glibc's pthread implementation is setting FUTEX_CMP_REQUEUE_PRIVATE on futex() even though no special flags seem to be set anywhere in the source. That's where I got last time I looked, anyway.

MaximoTrinidad commented 8 years ago

After installing xubuntu-desktop, and running the "code" from "nautilus" I can see a message pop out:

Home directory not accessible: Permission denied Assertion 'pthread_mutex_unlock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:108, function pa_mutex_unlock(). Aborting. libGL error: failed to load driver: swrast [75:1021/104943:FATAL:thread_helpers.cc(44)] Check failed: 3UL <= task_stat.st_nlink (3 vs. 1)

0 0x000001e0962e

1 0x000001e1f23b

2 0x000001261765

3 0x00000258737f

4 0x000002586d16

5 0x0000012711f8

6 0x000001270672

7 0x000001203e97

8 0x000001202970

9 0x0000033a9313 main

10 0x7fa3b30e1f45 __libc_start_main

11 0x000000574d79

bash_code2_2016-10-21_9-57-01

therealkenc commented 8 years ago

Yes that's (3) in the list here. You might want to take the rest of this over to that thread.

MaximoTrinidad commented 8 years ago

Ah! I'm guessing I'm running into a dead-end route. I'm finally getting a grip on Linux but I reach my limit now. Only I could make the code to come up. :P

I'm will follow the other thread then.

Thanks @therealkenc!

benhillis commented 8 years ago

@MaximoTrinidad Shameless plug for running the Windows version of VSCode with our new interop feature :)

MaximoTrinidad commented 8 years ago

Just to be clear! I know I can run Windows VS Code and point to the Linux subsystem folder where my scripts are stored. I just wanted to be able to install the debian version of Code and run it separate from the Windows version. Just for demo purpose!

I think it would be nice if is possible. :)

:)

therealkenc commented 8 years ago

VS Code works beautifully with the new interop. Really fantastic work. Prepare for the flood of "VS Code can't edit .bashrc in my home directory" issues though, because it's going to be nonobv to the uninitiated why that doesn't work.

benhillis commented 8 years ago

@therealkenc Thank you sir! Yeah I'm prepared for it. FYI: The limitation of current working directory not propagating along and not being able to launch .exe files out of LxFs ("/", "/home", etc) directories isn't a technical limitation - it's to avoid our old friend NT binaries stomping over extended attributes.

Cwd propagation for virtual directories (procfs, sysfs) doesn't work for obvious reasons.

fpqc commented 8 years ago

@benhillis By the way, Xilun's cbwin had one feature that you don't quite have in the new interop:

If you ran wrun chrome, it would execute chrome from the Windows Runline (Win+R), which was sometimes convenient. I guess with the current solution, you can manually set your aliases directly to executables, but say I wanted to use edge to open a link or something.

With Xilun's thing, I could execute edge on a link %L with wrun microsoft-edge:%L. I don't know of a way to execute modern Windows apps without a runline like that.

benhillis commented 8 years ago

@fpqc I didn't realize he had that functionality, that's awesome.

benhillis commented 8 years ago

@Manouchehri yep my bad!

ConAntonakos commented 7 years ago

I've been following this thread, and installing all the extra packages that were missing. Now when I execute code in the command line, it appears to just do nothing.

therealkenc commented 7 years ago

I put up straces for VSCode on WSL and native here. I tried to track it down with node debug, but it blackholes down vscode-loader never to return. Or, possibly, never to return from something vscode-loader is trying to load. Atom and electron-quick-start light up, so it is something specific to VS Code. I do not know what.

Here is one diverge. Notable mostly because I haven't seen ERESTARTNOHAND value before:

[edit - nah that is just an artefact of the ctrl-c]

MaximoTrinidad commented 7 years ago

Hi @therealkenc ,

Question: What's the Windows 10 build you're on WSL?

I'm glad someone is trying to get this resolved. I on the latest Windows 10 Insider Build 15048 but haven't try to reinstalled code yet. I know WSL has some improvements which clears some issues with PowerShell 6 to work as expected.

I'm to try it today and see if we still having the issue.

:)

MaximoTrinidad commented 7 years ago

Ah! It still doesn't work.
:(

So, the only work around is to create your script files (Python, PowerShell...) using your Windows Editors apps and then run the code on either your WSL Bash console or, if you have it installed, on your Ubuntu Desktop.

I know it will be just a matter of time when this issue get fixed.

:)

felocru commented 7 years ago

Something new? I have the same problem

MaximoTrinidad commented 7 years ago

I think... the reality is that WSL wasn't meant to work with the GUI Ubuntu Desktop although it possible. But trying to load the debian version of VS Code won't work (yet).

So, my option is to build my cross-platform code using the Windows Editors then later I can execute then under WSL Bash subsystem. The only GUI editor I can run in my WSL Ubuntu Desktop is Gedit and I can run terminal and PowerShell with no issues (yet). At least for testing demo purpose, it doable now!

Again, installing Ubuntu Desktop is not certified to run under WSL but for me is pretty functional.

:)

therealkenc commented 7 years ago

A VSCode team member chimed in #2293 so it is probably going to be most practical to track further developments regarding VSCode native there since he's subscribed. The OP here was a missing libxss1 followed by a dupe of #1267.

nityansuman commented 6 years ago

I'm trying to install vs code under WSL , but even after installation is successful the editor is not running at all. Now when I execute code in the command line, it appears to just do nothing.

MaximoTrinidad commented 6 years ago

@nityansuman

But, the only way to run VS Code under WSL is to install Windows X Server in Windows 10, and in WSL install the Ubuntu Desktop.

So, Yes! Installing the Ubuntu Desktop you can use VS Code in WSL.

Unfortunately, the Ubuntu Desktop is not supported in Windows 10. But, I've been using it for the last few years!

:)

wsl_code_2018-05-19_8-38-02

therealkenc commented 6 years ago

it appears to just do nothing.

code --verbose will "do something". Likely pointing out that you don't have $DISPLAY set.

MaximoTrinidad commented 6 years ago

@therealkenc

Yes! If you installed VS Code in WSL console, then it won't open in Windows 10. It need to the Ubuntu Desktop GUI to open VS Code Linux version.

therealkenc commented 6 years ago

It need to the Ubuntu Desktop GUI

No, you don't. Which is why no one should read #637.

MaximoTrinidad commented 6 years ago

@therealkenc

It will be nice to know if you got a workaround. But, this got me thinking. I've been using this for about two years now.

I got a VM with the latest Windows 10 Insider Version 10.0.17672.1000 and only WSL Ubuntu install (no GUI). I installed the latest VS Code stable edition... And ... Yes!!

It's working without installing VSCode in WSL. You can run "Code" from the WSL console and it will open the Windows VS Code version.

There's nothing wrong experimenting with installing GUI in WSL.

So, if you have installed the Ubuntu GUI in WSL then you lose the ability to call the VS Code Windows app.

And, if you still want to install the VS Code Linux version in WSL, then you need to install Ubuntu Desktop to run it.

Interesting findings! Just pick the right environment for your work.

:)

Below image showing calling VS Code Windows App from the WSL console (no Ubuntu Desktop installed). wsl_wincode_2018-05-19_19-46-02

therealkenc commented 6 years ago

There's nothing wrong experimenting with installing GUI in WSL.

Correct. There is, rather, something not right with installing the Ubuntu Desktop; which is neither necessary nor desirable to run native Linux VS Code on WSL.

So, if you have installed the Ubuntu GUI in WSL then you lose the ability to call the VS Code Windows app.

alias winvscode='/mnt/c/Program\ Files/Microsoft\ VS\ Code/bin/code'
winvscode
MaximoTrinidad commented 6 years ago

@therealkenc

Awesome!! Thanks for sharing. I love learning stuff.

Thank You!! :)