code
VS code starts
VS code does not start
Name Value
---- -----
PSVersion 6.0.3
PSEdition Core
GitCommitId v6.0.3
OS Linux 4.15.0-29-generic #31-Ubuntu SMP Tue Ju...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
I can launch VS code from bash, but not from powershell. When trying to start from powershell, no error is shown, it just returns to the prompt. Bash gives the same experience, except vs code actually starts. I verified code is in path for powershell:
```powershell
PS /home/markind/Projects> Get-Command code
CommandType Name Version Source
----------- ---- ------- ------
Application code 0.0.0.0 /usr/bin/code
PS /home/markind/Projects> which code
/usr/bin/code
Hi @mark-inderhees, what Ubuntu version are you on? I'm currently using PowerShell 6.1.0-preview.4 on Ubuntu 18.04 and code seems to work -- which suggests that this bug might be fixed in the preview release. Do you want to install the preview and try that? (Should be available with sudo apt install powershell-preview if you have the repositories installed)
I'm on Ubuntu 18.04.1 LTS. I just tried pwsh-preview and that has the same problem.
PS /home/markind> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.0-preview.4
PSEdition Core
GitCommitId 6.1.0-preview.4
OS Linux 4.15.0-30-generic #32-Ubuntu SMP Thu Ju...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PS /home/markind> code .
PS /home/markind> code
The above both result in nothing happening. I validated launching from bash still works. I also just happened to clean isntall this version of ubuntu, so it was not something specific to my OS setup.
Hmmmm, that's annoying. I'm running two different machines with Ubuntu 18.04.1 LTS and can't reproduce this issue on either.
A few possibilities to check:
code --version)code --verbosecode -ncode --wait --verbose to see if VSCode blocks or notI know those are all VSCode things and clearly this is working in bash, but easy enough to check.
The other question I suppose is whether your PowerShell can launch other GUI apps, like:
Also, I'm assuming so far that you're using the Ubuntu GNOME 3 shell, rather than KDE or MATE or i3 or something else.
Looks like code is crashing. Is this a code problem or a pwsh environment issue?
PS > code --verbose
Gtk-Message: 11:41:03.358: Failed to load module "canberra-gtk-module"
[3182:0808/114103.715054:ERROR:sandbox_linux.cc(343)] InitializeSandbox() called with multiple threads in process gpu-process.
[main 11:41:03 AM] Error: listen EACCES /run/user/1000/snap.powershell-preview/vscode-50fc40ed-1.25.1-main.sock
at Object.exports._errnoException (util.js:1050:11)
at exports._exceptionWithHostPort (util.js:1073:20)
at Server.setupListenHandle [as _listen2] (net.js:1247:19)
at listenInCluster (net.js:1304:12)
at Server.listen (net.js:1413:5)
at /usr/share/code/resources/app/out/vs/code/electron-main/main.js:166:570
at new n.Class.derive._oncancel (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:90:378)
at Object.t.serve (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:166:500)
at n (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:519:985)
at J (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:522:235)
at e.invokeFunction (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:203:400)
at /usr/share/code/resources/app/out/vs/code/electron-main/main.js:523:392
at Object.enter (/usr/share/code/resources/app/out/vs/code/electron-main/mai at n.Class.derive._oncancel._run (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:88:719)
at n.Class.derive._oncancel._completed (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:88:160)
at u (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:91:654)
at H.then.o.(anonymous function) (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:91:868)
at Object.v [as _notify] (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:83:572)
at Object.enter (/usr/share/code/resources/app/out/vs/code/electron-main/mai at n.Class.derive._oncancel._run (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:88:719)
at n.Class.derive._oncancel._completed (/usr/share/code/resources/app/out/vs/code/electron-main/main.js:88:160)
at /usr/share/code/resources/app/out/vs/code/electron-main/main.js:119:295
at FSReqWrap.oncomplete (fs.js:114:15)
[main 11:41:03 AM] Lifecycle#kill()
Ah! You're running the PowerShell Snap it looks like. This looks like a socket access issue -- Snap's containerised sockets make that tricky. So this is probably either a PowerShell issue or a Snap issue (still possibly a VSCode issue, but less likely). /cc @TravisEz13
https://github.com/Microsoft/vscode/issues/44758 may be relevant
Here's the fix commit: https://github.com/Microsoft/vscode/commit/9d75305b7f721ec22eb186dc1041477c79c8eece
@mark-inderhees Try mkdir -p /run/user/1000/snap.powershell-preview/ as a workaround. Otherwise, this shouldn't be an issue for a non-snap PowerShell installation.
I think fixing this should be as simple ensuring a directory exists in the Snap file?
That did the trick, vs code starts now that I have:
mkdir -p /run/user/1000/snap.powershell-preview/
How can this be fixed automatically for other snap users?
I'll port this over to the PowerShell snap repo. Looks like it should be just a matter of a line that ensures that dir is created in the snap setup.
@mark-inderhees This has just been fixed in the PowerShell snap, so should work when the next snap is released.