You are not logged in.

#1 2022-12-23 00:40:53

cal237
Member
Registered: 2022-12-22
Posts: 1

VS Code saving as Sudo not working correctly

I am trying to edit a file that is stored in a directory outside my home, so I need root privileges to save the file.

When I go to hit save, it prompts with the usual "Failed to save 'index.html': Insufficient permissions. Select 'Retry as Sudo' to retry as superuser."
So I click Retry as Sudo and it prompts me for the password. This seems to work fine, but once I put in the password, VS Code displays the error:

"Failed to save 'index.html': Command failed: cd "/home/caleb"; "/usr/bin/pkexec" --disable-internal-agent /bin/bash -c "echo SUDOPROMPT; \"/usr/lib/electron19/bin/code-oss\" --file-write \"/home/caleb/.config/Code - OSS/code-elevated-JBakeENX\" \"/srv/http/secret-message/index.html\"" /bin/bash: line 1: /usr/lib/electron19/bin/code-oss: No such file or directory"

There's a lot in this error message and I'm not sure how to interpret it. It is true, there is no /bin folder inside /usr/lib/electron19/. How do I fix it?

Offline

#2 2022-12-23 04:05:33

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,132

Re: VS Code saving as Sudo not working correctly

See https://bugs.archlinux.org/task/61516. I believe you are out of luck. sad

See https://github.com/jorangreef/sudo-prompt/issues/113 for the other side.

There is a lot of this use-everything-our-way-or-be-damned about, it seems ....

Last edited by cfr (2022-12-23 04:07:05)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#3 2022-12-24 14:51:47

seth
Member
Registered: 2012-09-03
Posts: 50,983

Re: VS Code saving as Sudo not working correctly

vscode seems to try a semi-hardcoded path (edit: the path is actually provided by electron19 and where that binary resides. Still mickeysoft)
You could probably just

sudo mkdir -p /usr/lib/electron19/bin
sudo ln -s /usr/bin/code-oss /usr/lib/electron19/bin/code-oss

?

Last edited by seth (2022-12-24 14:54:27)

Offline

#4 2023-04-21 01:49:28

H3g3m0n
Member
Registered: 2009-02-01
Posts: 20

Re: VS Code saving as Sudo not working correctly

seth wrote:

vscode seems to try a semi-hardcoded path (edit: the path is actually provided by electron19 and where that binary resides. Still mickeysoft)
You could probably just

sudo mkdir -p /usr/lib/electron19/bin
sudo ln -s /usr/bin/code-oss /usr/lib/electron19/bin/code-oss

?

Doesn't work, /usr/lib/electron19 already exists but it is a shell script hmm

Offline

#5 2023-04-21 06:52:06

seth
Member
Registered: 2012-09-03
Posts: 50,983

Re: VS Code saving as Sudo not working correctly

Not in https://archlinux.org/packages/communit … lectron19/

pacman -Qo /usr/lib/electron19
pacman -Qikk electron19
cat /usr/lib/electron19

Offline

Board footer

Powered by FluxBB