FATAL: Running as root without --no-sandbox is not supported using Electron 7.1.3. on Debian 8, 9
Asked Answered
G

3

19

I installed Electron 7.1.3, when I try to run the app this error appears:

FATAL:atom_main_delegate.cc(211)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180

This happens when I use Debian 8 or 9. I used it on Windows and this runs with no problem. I was searching info about this problem but I didn't find something concrete with Electron and Debian, only run: electron --no-sandbox

If someone knows how to solve this, I wanna use Debian here.

Goer answered 5/12, 2019 at 20:52 Comment(3)
Hi Oscar, we don't have enough info about your problem to answer your question. Does Electron still function just fine? Or does the error message crash Electron? Are you running Electron as root? What command are you using to start Electron?Cryptograph
hi Mike, when I try to run in terminal: root@user:/electron_App# npm start appears this message: /home/user/Documentos/electronApp/node_modules/electron/dist/electron: /lib/i386-linux-gnu/libdbus-1.so.3: no version information available (required by /home/user/Documentos/electronApp/node_modules/electron/dist/electron) [2575:1205/181412.296020:FATAL:atom_main_delegate.cc(211)] Running as root without --no-sandbox is not supported. See crbug.com/638180. I can't run the app for this reason, I'm trying to run as root user.Goer
Thanks for that extra info, is there a reason to run it as root user? If there is then could you just modify your npm script to have --no-sandbox on the end?Cryptograph
D
20

I had a similar issue when I run my electron app with sudo:

sudo ./MyElectronApp

[5612:0301/101026.813638:FATAL:electron_main_delegate.cc(211)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

so In order to add --no-sandbox parameter I did:

sudo ./MyElectronApp --no-sandbox

and it worked!! :)

I thought I had to build my app with parameter but it does not work.

Divergency answered 1/3, 2020 at 3:21 Comment(2)
ffs it helped! have same error electron_main_delegate.cc(264) when starting electron in docker container. I'm add inside electron app app.commandLine.appendArgument('no-sandbox'); but didn't worked. But somehow your solution helped.Dissepiment
How can I permanently add the --no-sandbox parameter?Ause
A
5

For me i was using nestjs and docker to build by app image . All i did was add args: ['--no-sandbox'] to puppeteer launch like this

const browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox'], });

and it solved the issue

Apopemptic answered 9/11, 2023 at 8:30 Comment(1)
I use C# and it works when I pass "--no-sandbox" in string[] into Lunch() method. ThanksDivisor
L
4

Quote from Process Sandboxing to explain what a sandbox does:

One key security feature in Chromium is that processes can be executed within a sandbox. The sandbox limits the harm that malicious code can cause by limiting access to most system resources — sandboxed processes can only freely use CPU cycles and memory. To perform operations requiring additional privilege, sandboxed processes use dedicated communication channels to delegate tasks to more privileged processes.

In Chromium, sandboxing is applied to most processes other than the main process. This includes renderer processes, as well as utility processes such as the audio service, the GPU service, and the network service.

And quote from Disabling Chromium's sandbox (testing only):

You can also disable Chromium's sandbox entirely with the --no-sandbox CLI flag, which will disable the sandbox for all processes (including utility processes). We highly recommend that you only use this flag for testing purposes, and never in production.

To disable it, run <your-app-name> --no-sandbox.

Lheureux answered 6/9, 2021 at 6:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.