Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Problems in ArchLinux with vscode #113

Open
kiprasmel opened this issue Oct 18, 2019 · 10 comments
Open

Problems in ArchLinux with vscode #113

kiprasmel opened this issue Oct 18, 2019 · 10 comments

Comments

@kiprasmel
Copy link

kiprasmel commented Oct 18, 2019

Hello,

This package is used in vscode.
In arch linux, we're unable to use the Save as sudo functionality through vscode.

Please see microsoft/vscode#82266 -- it's the original issue, providing other related issues, useful comments with specific details & possible candidates for a fix.

Thank you!

@jorangreef
Copy link
Owner

Thanks @sarpik, ArchLinux has been problematic compared to other distributions.

I have looked through microsoft/vscode#82266, and need to follow all those links. If you have time, would you mind summarizing here?

If not, it's fine, I will get to this, I just need some time.

@kiprasmel
Copy link
Author

kiprasmel commented Nov 2, 2019

No problem @jorangreef,

I've tried summarizing, but pretty much everything is documented in microsoft/vscode#82266. For a quick summary, I believe you can read through it without following the links - we tried providing context from them.

The summary I wrote that is pretty much the same, you'd be better off just going through https://github.com/microsoft/vscode/issues/82266 :D

I'll try my best to summarize (I'll provide links just in case):

It seems like the issue was first reported here: https://bugs.archlinux.org/task/61516

When trying to save a file with insufficient permissions, vscode pops up a notification.
You can now "retry with sudo".
However, this does not work.

And then later in microsoft/vscode#70403 and I see a few comments from you there.

The conclusion was reached that it's an upstream [arch linux] issue, and that installing the Microsoft's packaged binary version of vscode solves the issue: https://aur.archlinux.org/packages/visual-studio-code-bin/


Then I found all of this, because I had the same issue, and wanted it fixed.
I noticed that the vscode team blames upstream [arch linux], but arch linux then blames upstream [vscode].

This wouldn't get the issue fixed, so I created an issue to bring attention: microsoft/vscode#82266. There's useful information, including potential fixes for this package, and it's the latest issue related to this.

They recommended me to report the issue here, since this package is used for vscode's save as sudo feature, which is what we're having issues with.

Thanks for your time btw!

@jorangreef
Copy link
Owner

Thanks for your help with all of this @sarpik, I would also like to get this fixed, if it's something we can fix.

What I wanted to know in particular, was why installing the packaged binary version of VS Code solved the issue? If it did, that makes it seem like it's not VS Code or sudo-prompt, unless the packaged binary version of VS Code was a newer version with a different version of sudo-prompt. If you could confirm that the versions of VS Code were exactly the same between packaged binary and non-packaged that would help me alot!

The comment by ArchLinux does sound like a recipe for disaster:

We [arch linux] are sane people so we don't distribute a full copy of electron with VS Code, we use the electron already present on your system.

I will dig into everything and see what we can do!

@kiprasmel
Copy link
Author

kiprasmel commented Nov 2, 2019

Thanks Joran!

I think the problem might be with the packaging of electron, as seen in the comments from arch linux which you just quoted, but I'm just speculating.

I will try to install the packaged binary right now, and will update you soon.


Sorry to bother @FFY00, but I'm pretty sure you know the most out of us here. Any ideas?

@FFY00
Copy link

FFY00 commented Nov 2, 2019

Basically, we start vscode like this:

ELECTRON_RUN_AS_NODE=1 exec electron4 /usr/lib/code/out/cli.js /usr/lib/code/code.js "$@"

@kiprasmel
Copy link
Author

kiprasmel commented Nov 2, 2019

Alright, I've tried out 3 things:

  1. code (oss, not binary, official arch repos)
  2. vscodium-bin (oss, binary, AUR)
  3. visual-studio-code-bin (not oss (microsoft's release), binary, AUR)

(all versions identical)

TL;DR:

Save as sudo worked with both binaries. Non-binary package did not.


Fyi:

The binary for arch linux is provided here: https://aur.archlinux.org/packages/visual-studio-code-bin/

and from the FAQ comment:

What is the difference between this package and the one in the community repo [the official arch one]?

This is the official binary distribution from Microsoft. The one in the community repo is an unofficial build made from source. Beyond the license difference and branding, there are some proprietary features not available in the open source version.


  1. I'm trying this out with the oss vscode from arch linux (not the binary).

(see https://wiki.archlinux.org/index.php/Visual_Studio_Code#Installation for the different versions)

Version:

# code
$ code --version
1.39.2
6ab598523be7a800d7f3eb4d92d7ab9a66069390
x64

First attempt at editing a file without write permission:

Failed to save 'xorg.conf': No polkit authentication agent found.

I stumbled upon this balena-io/etcher#1179 (comment) and then, from the arch wiki page about Polkit, I installed mate-polkit.

I needed to run it:

$ /usr/lib/mate-polkit/polkit-mate-authentication-agent-1

and then tried to save the file without write permissions again:

I got the prompt for my password, but after authenticating successfully, I got this from vscode's pop-up:

Failed to save 'xorg.conf': Command failed: cd "/home/kipras"; "/usr/bin/pkexec" --disable-internal-agent /bin/bash -c "echo SUDOPROMPT; \"/usr/bin/code\" --file-write \"/tmp/code-elevated-rawbag\" \"/etc/X11/xorg.conf\"" Error using --file-write: EACCES: permission denied, open '/tmp/code-elevated-rawbag'

  1. I've just tried the same thing with vscodium (in arch, vscodium-bin from AUR) (I uninstalled code beforehand).

It IS a binary release, and everything WORKED!

# vscodium-bin
$ codium --version
1.39.2
6ab598523be7a800d7f3eb4d92d7ab9a66069390
x64

  1. Just tried out the same thing with microsoft's vscode binary.

The results are the same as with the vscodium binary - everything worked fine.

# visual-studio-code-bin
$ code --version
1.39.2
6ab598523be7a800d7f3eb4d92d7ab9a66069390
x64

Sorry to bother you too, @bpasero, but maybe you have any ideas about this?


One interesting observation I've made is that vscodium-bin is WAAAAY faster than the code from official arch repos.

I synchronize my settings with the vscode settings sync extension, so they were identical.
My settings gist is over here: https://gist.github.com/sarpik/de9160a0602463fb752f2d84d7aa4fd8

(fyi, if you're going to try, don't override your own settings - preferably back them up first with the extension, then reset extension's settings (F1 => >Sync: Reset extension settings) and then sync from my gist (F1, >Sync: Advanced settings => Open settings & configure)).

The startup time, responsiveness, less lag, smoothness, just usage in general -- everything is way better with vscodium-bin. Strange huh?

I don't know why this is the case, but the difference is huge. Holy moly, I think I'm sticking with vscodium-bin :D

@jorangreef
Copy link
Owner

Holy moly, I think I'm sticking with vscodium-bin :D

😄 Thanks @sarpik, that's a fantastic write-up.

Do you still think this is a sudo-prompt or VS Code issue then?

@jorangreef
Copy link
Owner

Maybe there's something we could do though to help ArchLinux out? Any ideas?

@kiprasmel
Copy link
Author

kiprasmel commented Nov 3, 2019

Holy moly, I think I'm sticking with vscodium-bin :D

Thanks @sarpik, that's a fantastic write-up.

lmao, thank you for being awesome, Joran 😄

Do you still think this is a sudo-prompt or VS Code issue then?

yeah I don't know, the only difference I see is whether vscode is packaged in binary form or not. This is probably to do with arch linux, but I'm not qualified to answer:D

I'd love to help arch linux out, but honestly, I have no clue how.
Any last thoughts, @FFY00? c:

@nova-nowiz
Copy link

I have the same problem on NixOS, I can't save files as sudo in vscode.
However, I can use pkexec code --file-write /path/to/source /path/to/target and it works fine, I'm confused...
Should I report this on vscode issue tracker?

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

No branches or pull requests

4 participants