Exercism CLI commands fail to run within the VS Code integrated terminal, resulting in the error message “need to run as root or suid.” This behavior occurs in recent VS Code versions and likely extends to other environments with stricter privilege controls.
Expected Behavior:
Exercism commands should function normally within the VS Code terminal without requiring root or suid privileges.
Actual Behavior:
Any Exercism CLI command executed in the VS Code terminal throws the “need to run as root or suid” error. This behavior persists even when opening new terminal instances from within VS Code.
Steps to Reproduce:
Open a project in VS Code.
Access the integrated terminal.
Attempt to run an Exercism command (e.g., exercism submit ).
Additional Information:
This issue likely relates to recent changes in VS Code as it enforces no-new-privileges for itself and child processes, for security reasons, according to them.
Users should not need root access for basic Exercism functionality.
I’m pretty sure the exercism command hasn’t had any significant recent changes. What happens if you run the command from a terminal independent of VSCode?
For the record, I have the exact same version of VSCode and the latest Exercism CLI version. I tried to reproduce this both in Windows and Ubuntu and couldn’t; running exercism submit works as expected.
Is it possible that your exercism binary is under a different user? I don’t really know why this would matter though. (I would probably be at the end of my Linux knowledge there so maybe someone else has an idea.)
You might want to try logging off and back on and trying again. If exercism works in the terminal, then exercism is working. Any issues might be VSCode issues.
How do I know it has to do with privilege restrictions? When I run from VSCode:
$ sudo
sudo: The "no new privileges" flag is set, which prevents sudo from running as root.
sudo: If sudo is running in a container, you may need to adjust the container configuration to disable the flag.
Not really. I just noticed it when I tried submitting 2th iteration on an exercise I did. Googling led me to sudo being restricted, which is what I tested just to make sure…
Sudo used to work fine, well, it still works well enough from code-server… Vut code itself hasn’t given me this issue, since using Exercism again…
Worth noting that we have always seen lots of problems with snap which is why we don’t officially recommend it any more. Not sure if that’s related here, but just FYI.