Open kiprasmel opened 4 years ago
Thanks @sarpik, ArchLinux has been problematic compared to other distributions.
I have looked through https://github.com/microsoft/vscode/issues/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.
No problem @jorangreef,
I've tried summarizing, but pretty much everything is documented in https://github.com/microsoft/vscode/issues/82266. For a quick summary, I believe you can read through it without following the links - we tried providing context from them.
Thanks for your time btw!
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!
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?
Basically, we start vscode like this:
ELECTRON_RUN_AS_NODE=1 exec electron4 /usr/lib/code/out/cli.js /usr/lib/code/code.js "$@"
Alright, I've tried out 3 things:
(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.
(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 https://github.com/balena-io/etcher/issues/1179#issuecomment-285912149 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'
code
beforehand).It IS a binary release, and everything WORKED!
# vscodium-bin
$ codium --version
1.39.2
6ab598523be7a800d7f3eb4d92d7ab9a66069390
x64
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
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?
Maybe there's something we could do though to help ArchLinux out? Any ideas?
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:
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?
Hello,
This package is used in vscode. In arch linux, we're unable to use the
Save as sudo
functionality throughvscode
.Please see https://github.com/microsoft/vscode/issues/82266 -- it's the original issue, providing other related issues, useful comments with specific details & possible candidates for a fix.
Thank you!