Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported #3698

Closed
arkreddy opened this issue Dec 21, 2018 · 29 comments

Comments

@arkreddy
Copy link

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:

  1. 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

@aslushnikov
Copy link
Contributor

@arkreddy I'm not sure what's going on here. How do I reproduce this? Also, I'd strongly recommend against running Chrome as root. If you're inside docker, I'd recommend using a non-root user instead.

@ststeiger
Copy link

ststeiger commented Apr 30, 2019

@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.

./google-chrome-stable
[16075:16075:0430/092527.937550:ERROR:zygote_host_impl_linux.cc(90)]
Running as root without --no-sandbox is not supported. 

vs.

./google-chrome-stable --no-sandbox
[browser opens]

but only if the logged-in user is root (uid 0).

@loretoparisi
Copy link

loretoparisi commented Jun 22, 2019

@ststeiger so which are the launch options? Like

puppetteer.launch({
   headless: true,
   args: ['--no-sandbox']
})

Or do I need to add args: ['--no-sandbox', '--disable-setuid-sandbox'] as well?

@ststeiger
Copy link

--no-sandbox is sufficient, AFAIK.

@loretoparisi
Copy link

loretoparisi commented Jun 24, 2019

@ststeiger I'm still getting the launch error on Ubuntu 18.09 when only using '--no-sandbox'. Any idea why I'm getting cannot open shared object file: No such file or directory

The full stack trace is

Master 1 error Error: Failed to launch chrome!
/node_modules/puppeteer/.local-chromium/linux-662092/chrome-linux/chrome: error while loading shared libraries: libXcomposite.so.1: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (/node_modules/puppeteer/lib/Launcher.js:342:14)
    at Interface.helper.addEventListener (/node_modules/puppeteer/lib/Launcher.js:331:50)
    at Interface.emit (events.js:203:15)
    at Interface.EventEmitter.emit (domain.js:448:20)
    at Interface.close (readline.js:397:8)
    at Socket.onend (readline.js:173:10)
    at Socket.emit (events.js:203:15)
    at Socket.EventEmitter.emit (domain.js:448:20)
    at endReadableNT (_stream_readable.js:1129:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

@loretoparisi
Copy link

loretoparisi commented Jun 24, 2019

[UPDATE]
So I have added all the following deps

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

(taken from https://hub.docker.com/r/browserless/chrome/)

But I'm now getting the Running as root without --no-sandbox is not supported

[0624/141307.628655:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (/node_modules/puppeteer/lib/Launcher.js:342:14)
    at Interface.helper.addEventListener (/node_modules/puppeteer/lib/Launcher.js:331:50)
    at Interface.emit (events.js:203:15)
    at Interface.EventEmitter.emit (domain.js:448:20)
    at Interface.close (readline.js:397:8)
    at Socket.onend (readline.js:173:10)
    at Socket.emit (events.js:203:15)
    at Socket.EventEmitter.emit (domain.js:448:20)
    at endReadableNT (_stream_readable.js:1129:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

@sabin-bhattarai-cko
Copy link

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

@ststeiger
Copy link

A i see, dependency problem.

@Keskebeu
Copy link

Keskebeu commented Feb 2, 2020

I have all the dependency problems and still get the error
[28096:28096:0202/000646.772390:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

@breakdom
Copy link

breakdom commented Mar 2, 2020

thanks for the advice, check and let you know

@rehans90
Copy link

I am still getting below error even after setting up the sandbox by following instructions in the troubleshooting page: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

(node:5910) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): Error: Failed to launch chrome!
[0310/130931.966653:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

OS details

AME="Ubuntu"
VERSION="16.04.4 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.4 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

Waiting for a quick response

Thanks

@henryiii
Copy link

If there was a way to set --no-sandbox through an environment variable, that would provide a solution to piqnt/svgexport#76 ; that, or an automatic check for root/docker and adding this to the default set of arguments.

@hemershon
Copy link

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

@Keskebeu
Copy link

Keskebeu commented Mar 25, 2020 via email

@Keskebeu
Copy link

Keskebeu commented Mar 25, 2020 via email

@Keskebeu
Copy link

Keskebeu commented Mar 25, 2020 via email

@rashi40
Copy link

rashi40 commented Jul 6, 2020

When i am putting headless: true, it is working perfectly fine.
But when I put headless: false, it shows -
(node:679) ExperimentalWarning: The fs.promises API is experimental
(node:679) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
[691:691:0706/141515.927321:ERROR:zygote_host_impl_linux.cc(89)] 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 (/workspace/Scraping/linkedin/node_modules/puppeteer/lib/launcher/BrowserRunner.js:189:20)
at Interface.helper_1.helper.addEventListener (/workspace/Scraping/linkedin/node_modules/puppeteer/lib/launcher/BrowserRunner

.js:179:65)
at Interface.emit (events.js:203:15)

@gouthamagv
Copy link

I got the same problem after upgrading my ubuntu from 18.04.5 to 20.04.1 on chromium(default browser). Chrome is working fine but chromium is not opening.

[7198:7198:1025/235938.366870:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

@rashi40
Copy link

rashi40 commented Oct 25, 2020

I got the same problem after upgrading my ubuntu from 18.04.5 to 20.04.1 on chromium(default browser). Chrome is working fine but chromium is not opening.

[7198:7198:1025/235938.366870:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

Hii, thanks. The problem is now fixed. I also upgraded my ubuntu to fix it. 😊

@OmarKhattab
Copy link

no sandbox solved this issue for me in amazon ec2 linux instance

@sba6300
Copy link

sba6300 commented Aug 9, 2021

use this it worked for me

new Client({puppeteer: { headless: true ,args: ['--no-sandbox','--disable-setuid-sandbox'] }});

@ericmutta
Copy link

ericmutta commented Nov 30, 2021

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 called libgbm1, 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:

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

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)

@ngscripts
Copy link

args: ['--no-sandbox']

This worked for me by adding args

@engrabdu
Copy link

Switch to Simple User and then run the command

@Imranyy
Copy link

Imranyy commented Oct 16, 2022

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. (/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)

@reinaldomml
Copy link

The problem continue in Digital Ocean Apps.

Ideas?

2023-03-14T00:58:13.600251260Z [0314/005813.589004:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

2023-03-14T00:58:09.778701105Z 
2023-03-14T00:58:09.778739678Z > roomfi@1.0.0 start
2023-03-14T00:58:09.778744443Z > node app.js
2023-03-14T00:58:09.778748108Z 
2023-03-14T00:58:13.347827906Z 🤖 Robot Notify is running...
2023-03-14T00:58:13.436591310Z ✅ Server listening on port 3000 - production environment
2023-03-14T00:58:13.436774657Z 🌍 Navigate on url http://localhost:3000
2023-03-14T00:58:13.600180825Z /app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241
2023-03-14T00:58:13.600233329Z             reject(new Error([
2023-03-14T00:58:13.600238602Z                    ^
2023-03-14T00:58:13.600243036Z 
2023-03-14T00:58:13.600246929Z Error: Failed to launch the browser process!
2023-03-14T00:58:13.600251260Z [0314/005813.589004:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
2023-03-14T00:58:13.600256252Z 
2023-03-14T00:58:13.600258904Z 
2023-03-14T00:58:13.600306531Z TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
2023-03-14T00:58:13.600310703Z 
2023-03-14T00:58:13.600315427Z     at onClose (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241:20)
2023-03-14T00:58:13.600319624Z     at Interface.<anonymous> (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:231:68)
2023-03-14T00:58:13.600324916Z     at Interface.emit (node:events:524:35)
2023-03-14T00:58:13.600328541Z     at Interface.close (node:internal/readline/interface:534:10)
2023-03-14T00:58:13.600332401Z     at Socket.onend (node:internal/readline/interface:260:10)
2023-03-14T00:58:13.600335818Z     at Socket.emit (node:events:524:35)
2023-03-14T00:58:13.600360250Z     at endReadableNT (node:internal/streams/readable:1359:12)
2023-03-14T00:58:13.600363869Z     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
2023-03-14T00:58:13.600368190Z 
2023-03-14T00:58:13.600371672Z Node.js v19.7.0

@David-young99
Copy link

In my case i was trying to use a R Studio library that uses Google Chrome during the code running, so I tried uninstalling completely Google Chrome, restarting my Virtual Machine and running it again, and installing Chrome again following these steps:
https://www.cyberithub.com/how-to-install-google-chrome-on-ubuntu-22-04-lts-jammy-jellyfish/

Hope this helps someone in a similar situation like me.

@hardikranpariya
Copy link

Error: Unable to launch browser, error message: Failed to launch the browser process!
1|index-server | [0704/043240.795845:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
1|index-server | TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
1|index-server | at Cluster. (/var/node_modules/puppeteer-cluster/dist/Cluster.js:119:23)
1|index-server | at Generator.throw ()
1|index-server | at rejected (/var/node_modules/puppeteer-cluster/dist/Cluster.js:6:65)
1|index-server | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
1|index-server | data>> {
1|index-server | ReturnCode: 500,
1|index-server | err: 1,
1|index-server | Data: Error: Unable to launch browser, error message: Failed to launch the browser process!
1|index-server | [0704/043240.795845:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
1|index-server |
1|index-server |
1|index-server | TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
1|index-server |
1|index-server | at Cluster. (/var/node_modules/puppeteer-cluster/dist/Cluster.js:119:23)
1|index-server | at Generator.throw ()
1|index-server | at rejected (/var/node_modules/puppeteer-cluster/dist/Cluster.js:6:65)
1|index-server | at process.processTicksAndRejections (node:internal/process/task_queues:95:5),
1|index-server | ReturnMsg: 'Something went wrong!'
1|index-server | }

Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-1031-aws x86_64)

@TheoOliveira
Copy link

Even with the flag no-sandbox still says the same error. I saw another issue with that flagged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests