Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upChrome Headless doesn't launch on Debian #290
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
This is working fine here on Elementary OS. I'm downloading a Debian installer now to try this out in a VM.
This is working fine here on Elementary OS. I'm downloading a Debian installer now to try this out in a VM. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
aslushnikov
on Aug 16, 2017
Contributor
That's interesting. Could you please:
- try launching chromium manually (chromium is downloaded at
node_modules/puppeteer/.local-chromium
) - if chromium launches for you, run the following (notice the added
dumpio
flag to thepuppeteer.launch
) and check what's in the stderr:
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch({dumpio: true});
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({path: 'example.png'});
browser.close();
})();
That's interesting. Could you please:
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch({dumpio: true});
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({path: 'example.png'});
browser.close();
})(); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
fortes
on Aug 16, 2017
Can't launch the local chrome:
% ~/p /home/fortes/p/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux/chrome --help
/home/fortes/p/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory
I should have mentioned that this is a headless machine that I'm ssh'd into. Given that this is for headless Chrome, I assume that scenario is still supported?
fortes
commented
on Aug 16, 2017
Can't launch the local chrome:
I should have mentioned that this is a headless machine that I'm ssh'd into. Given that this is for headless Chrome, I assume that scenario is still supported? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
I think in the case of Debian systems you still need https://packages.debian.org/sid/libx11-xcb1 to run headless. That way the system has some of the API calls it needs to to do the rendering calculations.
I think in the case of Debian systems you still need https://packages.debian.org/sid/libx11-xcb1 to run headless. That way the system has some of the API calls it needs to to do the rendering calculations. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
The action to resolve this (which I'm working on now) is getting a list of all the required dependencies to run Chromium. Straight from the Debian the requirements are below. Documenting this for a PR shortly.
Dependencies for debian
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
The action to resolve this (which I'm working on now) is getting a list of all the required dependencies to run Chromium. Straight from the Debian the requirements are below. Documenting this for a PR shortly. Dependencies for debian
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
fortes
on Aug 16, 2017
Already have that installed, perhaps a different package is needed?
% ~/p sudo apt-get install libx11-xcb1
Reading package lists... Done
Building dependency tree
Reading state information... Done
libx11-xcb1 is already the newest version (2:1.6.4-3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
fortes
commented
on Aug 16, 2017
Already have that installed, perhaps a different package is needed?
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
@fortes so do dependencies from #290 (comment) help? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
fortes
on Aug 16, 2017
I've installed those and can now run chrome --help
. However, if I try to run chrome -v
, I get the following:
febian:~/p /home/fortes/p/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux/chrome -v
[11104:11104:0816/105455.434188:FATAL:zygote_host_impl_linux.cc(123)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x556f97804657 base::debug::StackTrace::StackTrace()
#1 0x556f97818311 logging::LogMessage::~LogMessage()
#2 0x556f96a091f1 content::ZygoteHostImpl::Init()
#3 0x556f966a3da0 content::BrowserMainLoop::EarlyInitialization()
#4 0x556f966aa4c3 content::BrowserMainRunnerImpl::Initialize()
#5 0x556f966a3532 content::BrowserMain()
#6 0x556f9750f7fd content::ContentMainRunnerImpl::Run()
#7 0x556f97517314 service_manager::Main()
#8 0x556f9750e462 content::ContentMain()
#9 0x556f9614eb74 ChromeMain
#10 0x7fa1f27c92b1 __libc_start_main
#11 0x556f9614e9d0 <unknown>
Received signal 6
#0 0x556f97804657 base::debug::StackTrace::StackTrace()
#1 0x556f978041cf base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7fa1f8b690c0 <unknown>
#3 0x7fa1f27dbfcf gsignal
#4 0x7fa1f27dd3fa abort
#5 0x556f97803202 base::debug::BreakDebugger()
#6 0x556f978187cc logging::LogMessage::~LogMessage()
#7 0x556f96a091f1 content::ZygoteHostImpl::Init()
#8 0x556f966a3da0 content::BrowserMainLoop::EarlyInitialization()
#9 0x556f966aa4c3 content::BrowserMainRunnerImpl::Initialize()
#10 0x556f966a3532 content::BrowserMain()
#11 0x556f9750f7fd content::ContentMainRunnerImpl::Run()
#12 0x556f97517314 service_manager::Main()
#13 0x556f9750e462 content::ContentMain()
#14 0x556f9614eb74 ChromeMain
#15 0x7fa1f27c92b1 __libc_start_main
#16 0x556f9614e9d0 <unknown>
r8: 0000000000000000 r9: 00007fff8e2bda50 r10: 0000000000000008 r11: 0000000000000246
r12: 00007fff8e2be160 r13: 000000000000016d r14: 00007fff8e2be158 r15: 00007fff8e2be150
di: 0000000000000002 si: 00007fff8e2bda50 bp: 00007fff8e2bdd00 bx: 0000000000000006
dx: 0000000000000000 ax: 0000000000000000 cx: 00007fa1f27dbfcf sp: 00007fff8e2bdac8
ip: 00007fa1f27dbfcf efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
fortes
commented
on Aug 16, 2017
I've installed those and can now run
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
Check the sandbox docs linked to in that error and see if they can help you get it working. Either the security sandbox is messed up on Debian right now or something funky is happening to trigger it to need a non-kernel one. I'm looking into this once this VM server gets installed.
Check the sandbox docs linked to in that error and see if they can help you get it working. Either the security sandbox is messed up on Debian right now or something funky is happening to trigger it to need a non-kernel one. I'm looking into this once this VM server gets installed. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
aslushnikov
on Aug 16, 2017
Contributor
This should be solved with the '--no-sandbox' flag:
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch({args: ['--no-sandbox']});
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({path: 'example.png'});
browser.close();
})();
This should be solved with the '--no-sandbox' flag: const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch({args: ['--no-sandbox']});
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({path: 'example.png'});
browser.close();
})(); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
paulirish
on Aug 16, 2017
Member
It's worth considering adding both --no-sandbox --disable-setuid-sandbox
to the default flags on linux.
In chrome-launcher/lighthouse we're already including --disable-setuid-sandbox
and plan to add --no-sandbox
soon for this reason.
It's worth considering adding both In chrome-launcher/lighthouse we're already including |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
I have always strongly urged people to never turn off the sandbox without a good cause, even in tests. It is a major part of the security system from what I understand.
I'm setting up a squeaky clean and fresh Debian VM to run some install steps in. We should be able to have it well documented how to get it operating without compromising system security.
I recall PHPStorm for example having an issue where it was serving on localhost, so a remote code execution exploit was opened up for any site including code that would look for the port in use and take advantage of a flaw in that server. Let's not open people up to security issues by disabling the sandbox here. Where they could be visiting any number of sites including code that looks for exploits to abuse.
I have always strongly urged people to never turn off the sandbox without a good cause, even in tests. It is a major part of the security system from what I understand. I'm setting up a squeaky clean and fresh Debian VM to run some install steps in. We should be able to have it well documented how to get it operating without compromising system security. I recall PHPStorm for example having an issue where it was serving on localhost, so a remote code execution exploit was opened up for any site including code that would look for the port in use and take advantage of a flaw in that server. Let's not open people up to security issues by disabling the sandbox here. Where they could be visiting any number of sites including code that looks for exploits to abuse. |
aslushnikov
changed the title from
Unhandled Promise Rejection
to
Chrome Headless doesn't launch on Debian
on Aug 16, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
fortes
on Aug 16, 2017
Still no luck w/ those two flags:
febian:~/p /home/fortes/p/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux/chrome --no-sandbox --disable-setuid-sandbox
(chrome:12521): Gtk-WARNING **: cannot open display:
[0816/111850.260959:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
Same warning when just with --no-sandbox
fortes
commented
on Aug 16, 2017
•
Still no luck w/ those two flags:
Same warning when just with |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
Just as a quick update, I'm like 20-40ish minutes out from starting on testing the install procedure. Downloading packages now for a fresh net install of Debian 9. So, I should get back to you shortly with exact steps to reproduce. It just won't be as fast as something that doesn't require a full OS install.
Just as a quick update, I'm like 20-40ish minutes out from starting on testing the install procedure. Downloading packages now for a fresh net install of Debian 9. So, I should get back to you shortly with exact steps to reproduce. It just won't be as fast as something that doesn't require a full OS install. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
fortes
on Aug 16, 2017
Thanks for going through effort @Garbee! Will you be testing a headless Debian install, or using via ssh?
fortes
commented
on Aug 16, 2017
Thanks for going through effort @Garbee! Will you be testing a headless Debian install, or using via ssh? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
SSH is not relevant to the problem. Only a Debian server without any X/wayland system pre-installed (like any remote web server) will be enough to fully recreate the problem and steps to reproduce. So, that's what I'll be working with locally in a VM.
SSH is not relevant to the problem. Only a Debian server without any X/wayland system pre-installed (like any remote web server) will be enough to fully recreate the problem and steps to reproduce. So, that's what I'll be working with locally in a VM. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
maxschmeling
on Aug 16, 2017
This may or may not be helpful...
I run Electron in a Docker instance on Docker Cloud.
I run this command:
xvfb-run -a --server-args="-screen 0 1024x1024x24" ./node_modules/.bin/electron ./index.js
and my Dockerfile contains the following commands to install dependencies:
RUN apt-get update -y -q
RUN apt-get install -y -q xvfb libgtk2.0-0 libxtst6 libxss1 libgconf-2-4 libnss3 libasound2
maxschmeling
commented
on Aug 16, 2017
This may or may not be helpful... I run Electron in a Docker instance on Docker Cloud. I run this command:
and my Dockerfile contains the following commands to install dependencies:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
headless exists to not need xvfb
to virtualize the X instance for Chrome. Since it is all done in software internally.
headless exists to not need |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
maxschmeling
on Aug 16, 2017
@Garbee awesome. This stuff isn't my strong suit.
I'm going to attempt to replace the Electron usage with puppeteer, so hopefully this will simplify our environment.
maxschmeling
commented
on Aug 16, 2017
@Garbee awesome. This stuff isn't my strong suit. I'm going to attempt to replace the Electron usage with puppeteer, so hopefully this will simplify our environment. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
@fortes Are you running this as root by chance? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
If you're running as root (after having all the required deps installed as listed earlier) you need to run without a sandbox since Chromium requires that (no clue why exactly yet.) If running as a normal user, then it should run just fine on a fresh debian install with the required dependencies.
If you're running as root (after having all the required deps installed as listed earlier) you need to run without a sandbox since Chromium requires that (no clue why exactly yet.) If running as a normal user, then it should run just fine on a fresh debian install with the required dependencies. |
Garbee
referenced this issue
on Aug 16, 2017
Closed
docs: FAQ on setting up debian server to run Chromium #300
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
fortes
commented
on Aug 16, 2017
Not running as root |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
That's interesting. I setup a fresh Linode box on Debian 9. Installed the packages listed above, then setup nodesource to install node 8. Then the yarn repository. New folder, yarn add puppeteer
and then created the index.js
and ran it. Everything works perfectly fine without a sandbox error.
Is the box you're running on under you complete control or is it someone else's like a VPS/shared host? If it is a remote host could you share the provider so I can look into if they do anything funny with their kernel configurations.
That's interesting. I setup a fresh Linode box on Debian 9. Installed the packages listed above, then setup nodesource to install node 8. Then the yarn repository. New folder, Is the box you're running on under you complete control or is it someone else's like a VPS/shared host? If it is a remote host could you share the provider so I can look into if they do anything funny with their kernel configurations. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
Ah yea, that's it. Your box host is messing you up. It has a very old Kernel. Debian 9 ships with 4.9.0-3
and you're running 3.14.0
. So the security features of the kernel are extremely different. So, you may be in a case where you need to fallback to using the older file-based sandbox to have some level of security.
Although, in all honesty... Upgrade the kernel or get a host that doesn't keep you back. It's very important that the kernel gets updated for the best security and you're being left vulnerable.
Ah yea, that's it. Your box host is messing you up. It has a very old Kernel. Debian 9 ships with Although, in all honesty... Upgrade the kernel or get a host that doesn't keep you back. It's very important that the kernel gets updated for the best security and you're being left vulnerable. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 16, 2017
Contributor
@fortes If you could, please try running this script on your server to see if you have user namespacing enabled. https://gist.githubusercontent.com/Garbee/dfd33ba0a62f1cbc023b8d57de18efca/raw/f82ed513014062554a3536980a67390b57f1f858/user-namespace-check-linux.sh
@fortes If you could, please try running this script on your server to see if you have user namespacing enabled. https://gist.githubusercontent.com/Garbee/dfd33ba0a62f1cbc023b8d57de18efca/raw/f82ed513014062554a3536980a67390b57f1f858/user-namespace-check-linux.sh |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mrbar42
on Aug 17, 2017
for the dockerisers amongst us - i've launched successfully with this setup:
FROM node:8
RUN apt-get update && \
apt-get install -yq 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
RUN npm i puppeteer
RUN echo "\
const puppeteer = require('puppeteer');\n\
(async () => {\n\
const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});\n\
const page = await browser.newPage();\n\
await page.goto('https://example.com');\n\
await page.screenshot({path: 'example.png'});\n\
browser.close();\n\
})();\
" > index.js
CMD ["node", "index.js"]
mrbar42
commented
on Aug 17, 2017
•
for the dockerisers amongst us - i've launched successfully with this setup:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 17, 2017
Contributor
PR #311 is open to start looking at expanding the install script to make it much more interactive and friendly to help catch installation problems. You can check the code out from that PR and give it a spin. Please report on the PR of any problems you face or things you think could improve the flow.
PR #311 is open to start looking at expanding the install script to make it much more interactive and friendly to help catch installation problems. You can check the code out from that PR and give it a spin. Please report on the PR of any problems you face or things you think could improve the flow. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thesandlord
on Aug 17, 2017
Running into the problem using Windows Subsystem for Linux (WSL), as the "emulated" kernel doesn't support namespacing, and its not possible to upgrade the kernel. No combination of flags seemed to work, I switched to native Node.js on Windows and everything works fine.
thesandlord
commented
on Aug 17, 2017
Running into the problem using Windows Subsystem for Linux (WSL), as the "emulated" kernel doesn't support namespacing, and its not possible to upgrade the kernel. No combination of flags seemed to work, I switched to native Node.js on Windows and everything works fine. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
danielsantiago
commented
on Aug 17, 2017
I run into this problem trying to use puppeteer in Heroku |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
orangecms
on Aug 17, 2017
Don't use untrusted, prebuilt binaries. Use the trusted package from your distro:
https://packages.debian.org/stretch/chromium
Install it and then you can run chromium --headless
. Puppeteer should also use it instead of bloating your home directory.
orangecms
commented
on Aug 17, 2017
Don't use untrusted, prebuilt binaries. Use the trusted package from your distro: Install it and then you can run |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
JoelEinbinder
on Aug 17, 2017
Collaborator
@orangecms currently puppeteer only runs with bleeding edge Chromium. Running against stable won't work at the moment.
@orangecms currently puppeteer only runs with bleeding edge Chromium. Running against stable won't work at the moment. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
orangecms
on Aug 17, 2017
Hmm that is unfortunate.
How about providing a Docker image or something like that with the correct libs preinstalled? Would that be feasible?
Addendum: Thanks a lot for the info @JoelEinbinder - I couldn't run it on my machine, either, so I installed =www-client/google-chrome-unstable-62.0.3178.0
(on Gentoo GNU/Linux). I am running a grsec kernel, which is known to break the Chrome sandbox.
So I pass options
to launch()
:
const options = { executablePath: '/usr/bin/google-chrome-unstable' };
const browser = await puppeteer.launch(options);
I would add this to the docs, but I'm unsure where to put it. I just signed up for the CLA. Can anyone guide me there?
orangecms
commented
on Aug 17, 2017
•
Hmm that is unfortunate. How about providing a Docker image or something like that with the correct libs preinstalled? Would that be feasible? Addendum: Thanks a lot for the info @JoelEinbinder - I couldn't run it on my machine, either, so I installed So I pass
I would add this to the docs, but I'm unsure where to put it. I just signed up for the CLA. Can anyone guide me there? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
on Aug 17, 2017
Contributor
Using an external build is already detailed in the api docs and in the main README under Default Runtime Settings. I don't think we need to go adding that anywhere else for the time being.
How about providing a Docker image or something like that with the correct libs preinstalled? Would that be feasible?
IMO a Docker image while nice, should be something internally waited on until after a stable tag. Right now we should focus on the issues with getting it running directly on machines. Improve this experience. And then once we are stable, we can assess how to best provide a docker image for people to use.
Using an external build is already detailed in the api docs and in the main README under Default Runtime Settings. I don't think we need to go adding that anywhere else for the time being.
IMO a Docker image while nice, should be something internally waited on until after a stable tag. Right now we should focus on the issues with getting it running directly on machines. Improve this experience. And then once we are stable, we can assess how to best provide a docker image for people to use. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
paambaati
on Aug 17, 2017
currently puppeteer only runs with bleeding edge Chromium. Running against stable won't work at the moment.
@JoelEinbinder Do you plan to switch to stable builds once Chrome 62 lands?
paambaati
commented
on Aug 17, 2017
@JoelEinbinder Do you plan to switch to stable builds once Chrome 62 lands? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
fortes
on Aug 17, 2017
Ah yea, that's it. Your box host is messing you up. It has a very old Kernel. Debian 9 ships with 4.9.0-3 and you're running 3.14.0. So the security features of the kernel are extremely different. So, you may be in a case where you need to fallback to using the older file-based sandbox to have some level of security.
On the latest kernel:
febian:~/p uname -a
Linux febian 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26) x86_64 GNU/Linux
febian:~/p node --version
v8.1.1
febian:~/p lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.1 (stretch)
Release: 9.1
Codename: stretch
Still get this warning:
febian:~/p /home/fortes/p/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux/chrome --no-sandbox --disable-setuid-sandbox
(chrome:23907): Gtk-WARNING **: cannot open display:
[0817/080600.484767:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
@Garbee I ran your bash script and got the following:
febian:~/p ./test.sh
You have user namespacing in the kernel. You should be good to go.
fortes
commented
on Aug 17, 2017
•
On the latest kernel:
Still get this warning:
@Garbee I ran your bash script and got the following:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
fortes
on Aug 17, 2017
FYI, I ran this script: https://raw.githubusercontent.com/Garbee/puppeteer/cd00f7d936c942f8f378a332401024e501b186ce/utils/linux/debian-check.sh -- there are no missing dependencies.
fortes
commented
on Aug 17, 2017
FYI, I ran this script: https://raw.githubusercontent.com/Garbee/puppeteer/cd00f7d936c942f8f378a332401024e501b186ce/utils/linux/debian-check.sh -- there are no missing dependencies. |
cgoldberg
referenced this issue
in SeleniumHQ/selenium
on Feb 7
Closed
The HTTP request to the remote WebDriver server for URL http://localhost:42607/session timed out after 60 seconds. #5457
1natsu172
referenced this issue
in dideler/toggle-youtube-comments
on Feb 8
Open
Introduce acceptance tests #9
Hypnosphi
referenced this issue
in storybooks/storybook
on Feb 22
Merged
Remove integration tests #3052
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
voordev
on Feb 27
I have also an issue with Ubuntu
(node:10215) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to launch chrome!
Now when I run it manually:
/srv/app/puppeteer/linux-515411/chrome-linux$ ./chrome --no-sandbox --disable-setuid-sandbox
avalon@dev:/srv/app/puppeteer/linux-515411/chrome-linux$ [0227/104848.849621:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
Now when I run it just 'as is' there is no output in the terminal:
/srv/app/puppeteer/linux-515411/chrome-linux$ ./chrome
< no output >
Im using chromium with puppeteer and PKG ( https://github.com/zeit/pkg ) to pack all the modules and node into a single binary. Using latest versions as of now.
Initialization code in my nodejs application is :
const browser = await puppeteer.launch({
args: ['--no-sandbox','--disable-setuid-sandbox'],
ignoreHTTPSErrors: true,
headless: true
});
System version:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
Cannot get the headless to run, it seems that the chromium is not starting at all, when adding the no sandbox flags it throws the errors above.
I tried to install all the required apt-get packages like listed in the several issues. To no resolve, most of them where already installed
I have also an issue with Ubuntu
Now when I run it manually:
Now when I run it just 'as is' there is no output in the terminal:
Im using chromium with puppeteer and PKG ( https://github.com/zeit/pkg ) to pack all the modules and node into a single binary. Using latest versions as of now. Initialization code in my nodejs application is :
System version:
Cannot get the headless to run, it seems that the chromium is not starting at all, when adding the no sandbox flags it throws the errors above. I tried to install all the required apt-get packages like listed in the several issues. To no resolve, most of them where already installed |
yomed
referenced this issue
in marko-js/marko-util
on Mar 3
Closed
support launching puppeteer with options #7
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kaycebasques
on Mar 3
I got this while setting up basic CI support on my code sample repo: https://github.com/kaycebasques/puppeteer-by-example/tree/16c7f2bd0d2a79d062a6d8e3d022e75c47897733
Setting os: osx
in my .travis.yml
seemed to fix it.
kaycebasques
commented
on Mar 3
•
I got this while setting up basic CI support on my code sample repo: https://github.com/kaycebasques/puppeteer-by-example/tree/16c7f2bd0d2a79d062a6d8e3d022e75c47897733 Setting |
added a commit
to BrunoScheufler/github-spy-cli
that referenced
this issue
on Mar 11
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bpolaszek
on Mar 13
Hello there,
I'm still struggling in trying to make things work on Ubuntu 16.04 Server. I have installed all @coldner 's dependencies and here's the result:
Running as root:
google-chrome --headless --dump-dom http://www.perdu.com/
[0313/102503.396335:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
google-chrome --headless --dump-dom --no-sandbox http://www.perdu.com/
[0313/102635.889632:ERROR:gpu_process_transport_factory.cc(1019)] Lost UI shared context.
<html><head><title>Vous Etes Perdu ?</title></head><body><h1>Perdu sur l'Internet ?</h1><h2>Pas de panique, on va vous aider</h2><strong><pre> * <----- vous êtes ici</pre></strong>
</body></html>
Running as non-root:
google-chrome --headless --dump-dom http://www.perdu.com/
[0313/102832.114783:ERROR:gpu_process_transport_factory.cc(1019)] Lost UI shared context.
<html><head></head><body></body></html>
google-chrome --headless --dump-dom --no-sandbox http://www.perdu.com/
[0313/102914.693612:ERROR:gpu_process_transport_factory.cc(1019)] Lost UI shared context.
<html><head></head><body></body></html>
As you can see, it will only work as root, with the --no-sandbox flag. I have also tried with chromium-browser
, same result.
Any ideas?
Thank you,
Ben
Hello there, I'm still struggling in trying to make things work on Ubuntu 16.04 Server. I have installed all @coldner 's dependencies and here's the result: Running as root:google-chrome --headless --dump-dom http://www.perdu.com/
google-chrome --headless --dump-dom --no-sandbox http://www.perdu.com/
Running as non-root:google-chrome --headless --dump-dom http://www.perdu.com/
google-chrome --headless --dump-dom --no-sandbox http://www.perdu.com/
As you can see, it will only work as root, with the --no-sandbox flag. I have also tried with Any ideas? Thank you, |
AndreyBelym
referenced this issue
in DevExpress/testcafe
on Mar 15
Closed
Testcafe can't establish connection with headless browser when running in CI (Jenkins) #2218
ston3o
referenced this issue
in sindresorhus/fast-cli
on Mar 31
Merged
Fix Puppeteer launch bug Linux #23
theholiday
referenced this issue
in cucumber/cucumber-js
on Apr 4
Closed
NoSuchSessionError: no such session when this.driver.close() used in After hook #1060
AndreyBelym
referenced this issue
in DevExpress/testcafe
on Apr 19
Closed
Unable to Run tests Headless (using Nightmare) #2323
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Hi guys, I have this error when using puppeteer.
Any ideas? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jeremejevs
on May 7
Here's a neat alternative to copy-pasting the dependency list:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
apt-get install $( \
dpkg -I google-chrome-stable_current_amd64.deb | \
awk '/^ Depends: / { gsub(/Depends:|,|\([^\)]*\)/, ""); print }' \
)
Probably doesn't cover all edge cases, but at least removes the hardcoding. Tested on node:10
image.
Just in case, Chromium's dependencies don't cut it, unfortunately, so can't get by with apt-cache
.
jeremejevs
commented
on May 7
•
Here's a neat alternative to copy-pasting the dependency list: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
apt-get install $( \
dpkg -I google-chrome-stable_current_amd64.deb | \
awk '/^ Depends: / { gsub(/Depends:|,|\([^\)]*\)/, ""); print }' \
) Probably doesn't cover all edge cases, but at least removes the hardcoding. Tested on Just in case, Chromium's dependencies don't cut it, unfortunately, so can't get by with |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
slominskir
on May 21
If it helps, I followed the advice found in the URL given in the error message (https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md) and changed the file "chrome_sandbox" so that it was owned by root and had setuid set. Now the sandbox error is gone and chrome launches. To summarize:
chown root:root chrome_sandbox
chmod 4755 chrome_sandbox
setenv CHROME_DEVEL_SANDBOX <path>/node_modules/puppeteer/.local-chromium/linux-555668/chrome-linux/chrome_sandbox
# Or use export CHROME_DEVEL_SANDBOX=... if bash
slominskir
commented
on May 21
•
If it helps, I followed the advice found in the URL given in the error message (https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md) and changed the file "chrome_sandbox" so that it was owned by root and had setuid set. Now the sandbox error is gone and chrome launches. To summarize:
|
amra
referenced this issue
in amra/DocumentationAsCode
on May 24
Open
Puppeteer: Failed to launch chrome #5
tylerlong
referenced this issue
in mermaidjs/mermaid.cli
on May 29
Closed
Error: Failed to launch Chrome #37
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
wuno
26 days ago
I am deploying to a Cloud Foundry environment that is running debian. I believe this is a CF linux distro. My app runs fine locally and in the CF env but not when I hit an end point that uses Puppeteer. I am pretty sure my issue is the missing libs in this issue but I do not have root access to install them all. I would have to use a buildpack.
Is there anywhere these missing packages are bundled up in a way that I could use to install them into my environment?
wuno
commented
26 days ago
I am deploying to a Cloud Foundry environment that is running debian. I believe this is a CF linux distro. My app runs fine locally and in the CF env but not when I hit an end point that uses Puppeteer. I am pretty sure my issue is the missing libs in this issue but I do not have root access to install them all. I would have to use a buildpack. Is there anywhere these missing packages are bundled up in a way that I could use to install them into my environment? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
allandequeiroz
commented
26 days ago
@mrbar42 for president!! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
joelgriffith
26 days ago
Contributor
If docker is an option (and I'd highly recommend it), I maintain a repo here that adds a lot of features over "just running Chrome" located: here.
If docker is an option (and I'd highly recommend it), I maintain a repo here that adds a lot of features over "just running Chrome" located: here. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
wuno
26 days ago
@joelgriffith I actually did see that earlier. Thanks though. I actually ran it earlier today and was thinking of trying to use it. I am currently using a Nuxt.js application and I am not really sure how I would convert your repo into my application. I tried copying the Docker file only and ran that in my project but it would not load the home screen.
If you could tell me what it would take to put my project into your repo, I would be grateful to use it.
This is my current situation,
https://stackoverflow.com/questions/50662388/running-headless-chrome-puppeteer-with-no-sandbox
I have the application running in Docker. But, when I try and Docker run with the suggested Docker config I found on line, it throws a few different errors depending on if I run as root or not.
https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
wuno
commented
26 days ago
@joelgriffith I actually did see that earlier. Thanks though. I actually ran it earlier today and was thinking of trying to use it. I am currently using a Nuxt.js application and I am not really sure how I would convert your repo into my application. I tried copying the Docker file only and ran that in my project but it would not load the home screen. If you could tell me what it would take to put my project into your repo, I would be grateful to use it. This is my current situation, https://stackoverflow.com/questions/50662388/running-headless-chrome-puppeteer-with-no-sandbox I have the application running in Docker. But, when I try and Docker run with the suggested Docker config I found on line, it throws a few different errors depending on if I run as root or not. https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md |
added a commit
to jakub300/generator-chisel
that referenced
this issue
21 days ago
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jeff3dx
20 days ago
Error message:
Screenshot failed Error: Failed to launch chrome!
puppeteer/.local-chromium/linux-
/chrome-linux/chrome: error while loading shared libraries: libX11 : cannot open shared object file: No such file or directory
Solution:
To get Chromium screenshots working on Ubuntu 16.04 I had to install the missing libx11 package plus several others which I determined by trail and error. Ultimately installed all these:
(command line: sudo apt install <name>
)
- libx11-xcb1
- libx11composite1
- libx11cursor1
- libx11damage1
- libcups2
- libxss1
- libxrandr2
- libpangocairo-1.0-0
- libatk1.0-0
- libatk-bridge2.0-0
- libgtk-3-0
jeff3dx
commented
20 days ago
Error message: Solution:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Garbee
20 days ago
Contributor
No need for "trial and error" here, the required dependencies were listed a while back in this thread and are in the troubleshooting guide.
No need for "trial and error" here, the required dependencies were listed a while back in this thread and are in the troubleshooting guide. |
lexieheinle
referenced this issue
in thebuffalonews/chart-tool
17 days ago
Closed
Missing puppeteer dependencies #15
omachala
referenced this issue
in gruntjs/grunt-contrib-jasmine
14 days ago
Open
Create new optional 'noSandbox' option. #279
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
dkommineni
13 days ago
@wuno were you able to fix the issue in cloud foundry environment. I am also facing the same issue. I tried --no-sandbox --disable-setuid-sandbox
and no luck.
dkommineni
commented
13 days ago
•
@wuno were you able to fix the issue in cloud foundry environment. I am also facing the same issue. I tried |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
wuno
13 days ago
@dkommineni Yes, I have the issue resolved.
Basically you are missing dependencies when you are using CF. Then you will face a second issue once you install the dependencies. That issue is that Puppeteer needs to be ran with options passed to it.
There is a solution you could use if you have control over the CF environment you are deploying to. I was deploying to a large company and did not have control.
If you have control, you could install the missing dependencies into your CF environment with this,
If you are like me and do not have control, you can take 3 steps to solve this issue.
-
Put the project in a Docker image.
-
Update the code to pass options to Puppeteer
-
Deploy the Docker image to CF
You will find 100 examples of Dockerfiles on line and none of them worked for me. The way I finally got the Dockerfile right was using this,
FROM node:8
ENV HOST 0.0.0.0
EXPOSE 8080
RUN apt-get update
# for https
RUN apt-get install -yyq ca-certificates
# install libraries
RUN apt-get install -yyq libappindicator1 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 libnss3 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
# tools
RUN apt-get install -yyq gconf-service lsb-release wget xdg-utils
# and fonts
RUN apt-get install -yyq fonts-liberation
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN mkdir -p /usr/src/app/views
# install the necessary packages
RUN npm install
CMD npm run start
You will need to make sure you update the Dockerfile to have the correct values for port, host and start command. That is up to you and your deployment.
The second thing I had to do was change puppeteer to launch like this,
const browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'], ignoreHTTPSErrors: true, dumpio: false });
Originally I was launching it like this which will not work on Debian using the Dockerfile mentioned above,
const browser = await puppeteer.launch();
At that point I was able to create the Docker Image and test that Puppeteer was working on my localhost inside of the Docker Image. Once I could see that it was working, I deployed the Docker Image to CF and it worked like a charm on my first try.
This took me 3 or 4 days to figure out AFTER I had failed for a week to get it to work in CF without Docker. I truly hope this helps a ton of people.
wuno
commented
13 days ago
•
@dkommineni Yes, I have the issue resolved. Basically you are missing dependencies when you are using CF. Then you will face a second issue once you install the dependencies. That issue is that Puppeteer needs to be ran with options passed to it. There is a solution you could use if you have control over the CF environment you are deploying to. I was deploying to a large company and did not have control. If you have control, you could install the missing dependencies into your CF environment with this, If you are like me and do not have control, you can take 3 steps to solve this issue.
You will find 100 examples of Dockerfiles on line and none of them worked for me. The way I finally got the Dockerfile right was using this,
You will need to make sure you update the Dockerfile to have the correct values for port, host and start command. That is up to you and your deployment. The second thing I had to do was change puppeteer to launch like this,
Originally I was launching it like this which will not work on Debian using the Dockerfile mentioned above,
At that point I was able to create the Docker Image and test that Puppeteer was working on my localhost inside of the Docker Image. Once I could see that it was working, I deployed the Docker Image to CF and it worked like a charm on my first try. This took me 3 or 4 days to figure out AFTER I had failed for a week to get it to work in CF without Docker. I truly hope this helps a ton of people. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
dkommineni
9 days ago
Thanks @wuno , I ended up using cloud foundry multi buildpack (https://github.com/cloudfoundry/multi-buildpack), as my organization API is not allowing to use main and supplement build pack (https://github.com/cloudfoundry/apt-buildpack) with cf push. With this multi build pack, we can mention all required buildpacks in a file. One drawback is I have to use buildpacks with URL based and not local buildpacks with this approach.
dkommineni
commented
9 days ago
Thanks @wuno , I ended up using cloud foundry multi buildpack (https://github.com/cloudfoundry/multi-buildpack), as my organization API is not allowing to use main and supplement build pack (https://github.com/cloudfoundry/apt-buildpack) with cf push. With this multi build pack, we can mention all required buildpacks in a file. One drawback is I have to use buildpacks with URL based and not local buildpacks with this approach. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
wuno
9 days ago
@dkommineni I also like to use multi-buildpack. But, I do not see how that solves your problem of having missing dependencies when you try to run the application. That is the reason I had to use Docker but suggested the alternative of using apt-buildpack.
apt-buildpack allows you to add a bunch of dependencies that need to be installed with apt-get. If you were able to find a way around that, than that is great. But, if you are still having problems I assume it is for the reason mentioned above.
If you do have a working build file for CF not using Docker but can run Puppeteer, I would be grateful to see it.
wuno
commented
9 days ago
@dkommineni I also like to use multi-buildpack. But, I do not see how that solves your problem of having missing dependencies when you try to run the application. That is the reason I had to use Docker but suggested the alternative of using apt-buildpack. apt-buildpack allows you to add a bunch of dependencies that need to be installed with apt-get. If you were able to find a way around that, than that is great. But, if you are still having problems I assume it is for the reason mentioned above. If you do have a working build file for CF not using Docker but can run Puppeteer, I would be grateful to see it. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
dkommineni
9 days ago
@wuno my apology for mis communication. I still use apt-buildpack, as one of the buildpacks configured in (https://github.com/cloudfoundry/multi-buildpack)
dkommineni
commented
9 days ago
@wuno my apology for mis communication. I still use apt-buildpack, as one of the buildpacks configured in (https://github.com/cloudfoundry/multi-buildpack) |
fortes commentedon Aug 16, 2017
•
edited
Edited 1 time
-
fortes
edited on Aug 16, 2017 (most recent)
Running this example code from the README:
I get the following error output:
Platform info: