this post was submitted on 31 Mar 2025
8 points (100.0% liked)

VS Code

905 readers
1 users here now

founded 2 years ago
MODERATORS
 

If I open a text file that needs root privileges to modify, I get this error:

Failed to save 'this_file': Insufficient permissions. Select 'Retry as Sudo' to retry as superuser.

That's fine, that's expected.

But when I click on "Retry as Sudo", I get this error:

Failed to save 'this_file': Unable to find pkexec or kdesudo.

This happens though pkexec is installed on my machine, at /usr/bin/pkexec; and I granted VSCodium access to it through Flatseal. How do I fix this?

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 1 points 5 days ago (1 children)

Running as root is a forceful workaround, not the solution to my problem. I want to open this lock, not break it.

I don't want to run as root because...

  • It's bad for security. Think of running sudoedit vs sudo nano or sudo vim. If you run the editor as root directly, you can access the shell as root. This is a feature, not a bug! But if you run sudoedit, it stays at low privilege level until it actually saves the file.
  • The "Retry as Sudo" feature exists. If it's there, why not use it instead of circumventing it?
  • At this point, editing the file is irrelevant. This is not an XY problem. I want to stop getting the second error.

The "Retry as Sudo" dialog is supposed to appear, and when I click on the button, I am supposed to get a password prompt. That's what happens in the Apt version; that's what happens in the Snap version; and in the NixPKG version, they had the same problem, but they fixed it.

How do I fix it in my flatpak version?

[โ€“] [email protected] 1 points 5 days ago

Hmmm I am not sure. Might be worth asking in one of the mainline linux communities. At a minimum they might be able to point to a more active community instance for asking questions. As it is, this is not really a VSC issue per say.