puppeteer: ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported
Steps to reproduce
Tell us about your environment:
- Puppeteer version: 1.11.0
- Platform / OS version: Chrome version: 71.0.3578.98-1 Channel: stable OS Version: Debian GNU/Linux 8 (jessie) Flash Version:
- URLs (if applicable):
- Node.js version: 6.4.1
What steps will reproduce the problem?
Steps to reproduce the problem:
- When I am trying to launch the headless browser in puppeteer i am seeing the error message as . 15:40:19 Error: Failed to launch chrome! 15:40:19 [1220/234018.696360:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180. 15:40:19 15:40:19 15:40:19 TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md 15:40:19
The code snippet:
const puppeteer = require(‘puppeteer’);
describe(’ SC Station Test’, () => {
test(Station Scan Test
, async () => {
browser = await puppeteer.launch({args: [‘–no-sandbox’]});
page = await browser.newPage();
await page.goto(“https://www.google.com/”)
await browser.close();
}, 20000);
});
What is the expected behavior? It should able launch the headless browser and able ot execute the tests
What went wrong?
Did this work before? It didn’t
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 39
- Comments: 29 (1 by maintainers)
@ststeiger so which are the
launch
options? LikeOr do I need to add args:
['--no-sandbox', '--disable-setuid-sandbox']
as well?This worked for me RUN apt-get update && apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
@aslushnikov: You (graphically) login as root, and try starting chrome or chromium. If anything uses Chrome/Chromium/ChromiumEmbedded, it needs to check for uid 0, and if so, add --no-sandbox to the command-line when it’s starting the headless-browser, or instanciates a CEF-application.
Happens when you use Chrome/Chromium or libQt5WebEngineCore, or anything else based on Chromium Embedded in an application.
vs.
but only if the logged-in user is root (uid 0).
–no-sandbox is sufficient, AFAIK.
[UPDATE] So I have added all the following deps
(taken from https://hub.docker.com/r/browserless/chrome/)
But I’m now getting the Running as root without --no-sandbox is not supported
Got this error when running
Ubuntu 20.04.3 LTS
. I had to install the dependencies mentioned by @sabin-bhattarai-cko but with one extra one calledlibgbm1
, which gives the following command for installing the dependencies:apt-get update && apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm1
To fix the sandbox error I used this line in my script:
UPDATE: the full list of dependencies for Ubuntu is here and apparently you can get it by running
ldd chrome | grep not
after navigating to the folder where Chrome is installed (e.g.[...]/.local-chromium/Linux-884014/chrome-linux
)I have a problem
[6479:0324/204738.124259:FATAL:atom_main_delegate.cc(210)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180. Trace/breakpoint trap
If there was a way to set --no-sandbox through an environment variable, that would provide a solution to https://github.com/shakiba/svgexport/issues/76 ; that, or an automatic check for root/docker and adding this to the default set of arguments.
I heed help!!!
/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241 reject(new Error([ ^ Error: Failed to launch the browser process! [1016/153339.514860:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180. TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md at onClose (/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241:20) at Interface.<anonymous> (/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:231:68) at Interface.emit (node:events:525:35) at Interface.close (node:readline:590:8) at Socket.onend (node:readline:280:10) at Socket.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1358:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)
https://unix.stackexchange.com/questions/175967/how-to-run-google-chrome-as-root-in-linux
It’s not supported running it as root.
On Tue, Mar 24, 2020, 7:49 PM Hemershon Silva notifications@github.com wrote: