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

can't run puppeteer in centos7 #391

Closed
rlog opened this Issue Aug 19, 2017 · 57 comments

Comments

Projects
None yet
@rlog
Copy link

rlog commented Aug 19, 2017

Server Info:
CUP: Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
MemTotal: 1016396 kB
OS:CentOS Linux release 7.3.1611 (Core)
Node:v8.4.0

when I try to run my app in this server, there have an error throw:

(node:29208) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to connect to chrome!

I want run Chromium which download by puppeteer manual,there have some log output:

robin@eve ~/project/memostickyserver/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux (master*) $ chrome
robin@eve ~/project/memostickyserver/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux (master*) $ ./chrome
[28268:28268:0819/223159.486750: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 0x7fd4bc6d6657 base::debug::StackTrace::StackTrace()
#1 0x7fd4bc6ea311 logging::LogMessage::~LogMessage()
#2 0x7fd4bb8db1f1 content::ZygoteHostImpl::Init()
#3 0x7fd4bb575da0 content::BrowserMainLoop::EarlyInitialization()
#4 0x7fd4bb57c4c3 content::BrowserMainRunnerImpl::Initialize()
#5 0x7fd4bb575532 content::BrowserMain()
#6 0x7fd4bc3e17fd content::ContentMainRunnerImpl::Run()
#7 0x7fd4bc3e9314 service_manager::Main()
#8 0x7fd4bc3e0462 content::ContentMain()
#9 0x7fd4bb020b74 ChromeMain
#10 0x7fd4b3da2b35 __libc_start_main
#11 0x7fd4bb0209d0

Received signal 6
#0 0x7fd4bc6d6657 base::debug::StackTrace::StackTrace()
#1 0x7fd4bc6d61cf base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7fd4ba04d370
#3 0x7fd4b3db61d7 __GI_raise
#4 0x7fd4b3db78c8 __GI_abort
#5 0x7fd4bc6d5202 base::debug::BreakDebugger()
#6 0x7fd4bc6ea7cc logging::LogMessage::~LogMessage()
#7 0x7fd4bb8db1f1 content::ZygoteHostImpl::Init()
#8 0x7fd4bb575da0 content::BrowserMainLoop::EarlyInitialization()
#9 0x7fd4bb57c4c3 content::BrowserMainRunnerImpl::Initialize()
#10 0x7fd4bb575532 content::BrowserMain()
#11 0x7fd4bc3e17fd content::ContentMainRunnerImpl::Run()
#12 0x7fd4bc3e9314 service_manager::Main()
#13 0x7fd4bc3e0462 content::ContentMain()
#14 0x7fd4bb020b74 ChromeMain
#15 0x7fd4b3da2b35 __libc_start_main
#16 0x7fd4bb0209d0
r8: 00007fff21b42080 r9: 0000000000000395 r10: 0000000000000008 r11: 0000000000000206
r12: 00007fff21b424e0 r13: 000000000000016d r14: 00007fff21b424d8 r15: 00007fff21b424d0
di: 0000000000006e6c si: 0000000000006e6c bp: 00007fff21b42080 bx: 00007fff21b42080
dx: 0000000000000006 ax: 0000000000000000 cx: ffffffffffffffff sp: 00007fff21b41ed8
ip: 00007fd4b3db61d7 efl: 0000000000000206 cgf: 0000000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
robin@eve ~/project/memostickyserver/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux (master*) $ ./chrome --no-sandbox
[0819/223234.158902:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly

pls help,how to fix this ?

@Garbee

This comment has been minimized.

Copy link
Contributor

Garbee commented Aug 19, 2017

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.

Right in the error output. Did you go to the referenced page and read what it says about the problem and how to address it?

@rlog

This comment has been minimized.

Copy link

rlog commented Aug 20, 2017

@Garbee Thanks to replay

yes,I read that page and try:

sudo chown root:root chrome_sandbox && sudo chmod 4755 chrome_sandbox && \
    export CHROME_DEVEL_SANDBOX="$PWD/chrome_sandbox"

get some other error:

DevTools listening on ws://127.0.0.1:45565/devtools/browser/8b502ff1-9ad6-40c7-a335-ec9221e1d914
[0820/113237.953713:ERROR:devtools_http_handler.cc(245)] Error writing DevTools active port to file
[0820/113237.923530:FATAL:platform_font_linux.cc(83)] Check failed: InitDefaultFont(). Could not find the default font
#0 0x7f6fc457d657 base::debug::StackTrace::StackTrace()
#1 0x7f6fc4591311 logging::LogMessage::~LogMessage()
#2 0x7f6fc4aad472 gfx::PlatformFontLinux::PlatformFontLinux()
#3 0x7f6fc4aae436 gfx::PlatformFont::CreateDefault()
#4 0x7f6fc4aa68c9 gfx::Font::Font()
#5 0x7f6fc3688004 content::RenderViewHostImpl::CreateRenderView()
#6 0x7f6fc376c4b2 content::WebContentsImpl::CreateRenderViewForRenderManager()
#7 0x7f6fc3531b5d content::RenderFrameHostManager::ReinitializeRenderFrame()
#8 0x7f6fc3531247 content::RenderFrameHostManager::Navigate()
#9 0x7f6fc3510e15 content::NavigatorImpl::NavigateToEntry()
#10 0x7f6fc35117b5 content::NavigatorImpl::NavigateToPendingEntry()
#11 0x7f6fc3501eb7 content::NavigationControllerImpl::NavigateToPendingEntryInternal()
#12 0x7f6fc34fe0f2 content::NavigationControllerImpl::NavigateToPendingEntry()
#13 0x7f6fc34fedc4 content::NavigationControllerImpl::LoadURLWithParams()
#14 0x7f6fc6d293a8 headless::HeadlessWebContentsImpl::Create()
#15 0x7f6fc6d2c134 headless::HeadlessBrowserContextImpl::CreateWebContents()
#16 0x7f6fc428a40a headless::HeadlessShell::OnStart()
#17 0x7f6fc6d2d862 headless::HeadlessBrowserImpl::RunOnStartCallback()
#18 0x7f6fc7f807b1 headless::HeadlessContentMainDelegate::RunProcess()
#19 0x7f6fc4287ec7 content::RunNamedProcessTypeMain()
#20 0x7f6fc42887fd content::ContentMainRunnerImpl::Run()
#21 0x7f6fc4290314 service_manager::Main()
#22 0x7f6fc4287462 content::ContentMain()
#23 0x7f6fc6d2e325 headless::(anonymous namespace)::RunContentMain()
#24 0x7f6fc6d2e39c headless::HeadlessBrowserMain()
#25 0x7f6fc428e0e2 headless::HeadlessShellMain()
#26 0x7f6fc2ec7b6d ChromeMain
#27 0x7f6fbbc49b35 __libc_start_main
#28 0x7f6fc2ec79d0

Received signal 6
#0 0x7f6fc457d657 base::debug::StackTrace::StackTrace()
#1 0x7f6fc457d1cf base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7f6fc1ef4370
#3 0x7f6fbbc5d1d7 __GI_raise
#4 0x7f6fbbc5e8c8 __GI_abort
#5 0x7f6fc457c202 base::debug::BreakDebugger()
#6 0x7f6fc45917cc logging::LogMessage::~LogMessage()
#7 0x7f6fc4aad472 gfx::PlatformFontLinux::PlatformFontLinux()
#8 0x7f6fc4aae436 gfx::PlatformFont::CreateDefault()
#9 0x7f6fc4aa68c9 gfx::Font::Font()
#10 0x7f6fc3688004 content::RenderViewHostImpl::CreateRenderView()
#11 0x7f6fc376c4b2 content::WebContentsImpl::CreateRenderViewForRenderManager()
#12 0x7f6fc3531b5d content::RenderFrameHostManager::ReinitializeRenderFrame()
#13 0x7f6fc3531247 content::RenderFrameHostManager::Navigate()
#14 0x7f6fc3510e15 content::NavigatorImpl::NavigateToEntry()
#15 0x7f6fc35117b5 content::NavigatorImpl::NavigateToPendingEntry()
#16 0x7f6fc3501eb7 content::NavigationControllerImpl::NavigateToPendingEntryInternal()
#17 0x7f6fc34fe0f2 content::NavigationControllerImpl::NavigateToPendingEntry()
#18 0x7f6fc34fedc4 content::NavigationControllerImpl::LoadURLWithParams()
#19 0x7f6fc6d293a8 headless::HeadlessWebContentsImpl::Create()
#20 0x7f6fc6d2c134 headless::HeadlessBrowserContextImpl::CreateWebContents()
#21 0x7f6fc428a40a headless::HeadlessShell::OnStart()
#22 0x7f6fc6d2d862 headless::HeadlessBrowserImpl::RunOnStartCallback()
#23 0x7f6fc7f807b1 headless::HeadlessContentMainDelegate::RunProcess()
#24 0x7f6fc4287ec7 content::RunNamedProcessTypeMain()
#25 0x7f6fc42887fd content::ContentMainRunnerImpl::Run()
#26 0x7f6fc4290314 service_manager::Main()
#27 0x7f6fc4287462 content::ContentMain()
#28 0x7f6fc6d2e325 headless::(anonymous namespace)::RunContentMain()
#29 0x7f6fc6d2e39c headless::HeadlessBrowserMain()
#30 0x7f6fc428e0e2 headless::HeadlessShellMain()
#31 0x7f6fc2ec7b6d ChromeMain
#32 0x7f6fbbc49b35 __libc_start_main
#33 0x7f6fc2ec79d0
r8: 00007ffd2a1a1030 r9: 0000000000000000 r10: 0000000000000008 r11: 0000000000000202
r12: 00007ffd2a1a1090 r13: 0000000000000076 r14: 00007ffd2a1a1088 r15: 00007ffd2a1a1080
di: 0000000000006e38 si: 0000000000006e38 bp: 00007ffd2a1a0c40 bx: 00007ffd2a1a0c40
dx: 0000000000000006 ax: 0000000000000000 cx: ffffffffffffffff sp: 00007ffd2a1a0a98
ip: 00007f6fbbc5d1d7 efl: 0000000000000202 cgf: 0000000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
(node:28112) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: socket hang up
[0100/000000.311368:ERROR:broker_posix.cc(43)] Invalid node channel message

@paambaati

This comment has been minimized.

Copy link

paambaati commented Aug 20, 2017

Check failed: InitDefaultFont(). Could not find the default font

@rlog Looks like a missing dependency. Are you sure you've installed all the dependencies listed here?

@rlog

This comment has been minimized.

Copy link

rlog commented Aug 20, 2017

@paambaati I'm trying to install all this dependencies on centos 7, but nothing new install:

robin@eve ~ $ sudo yum install 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
[sudo] password for robin:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
No package gconf-service available.
No package libasound2 available.
No package libatk1.0-0 available.
No package libc6 available.
No package libcairo2 available.
No package libcups2 available.
No package libdbus-1-3 available.
No package libexpat1 available.
No package libfontconfig1 available.
No package libgcc1 available.
No package libgconf-2-4 available.
No package libgdk-pixbuf2.0-0 available.
No package libglib2.0-0 available.
No package libgtk-3-0 available.
No package libnspr4 available.
No package libpango-1.0-0 available.
No package libpangocairo-1.0-0 available.
No package libstdc++6 available.
No package libx11-6 available.
No package libx11-xcb1 available.
No package libxcb1 available.
No package libxcomposite1 available.
No package libxcursor1 available.
No package libxdamage1 available.
No package libxext6 available.
No package libxfixes3 available.
No package libxi6 available.
No package libxrandr2 available.
No package libxrender1 available.
No package libxss1 available.
No package libxtst6 available.
Package ca-certificates-2017.2.14-70.1.el7_3.noarch already installed and latest version
No package fonts-liberation available.
No package libappindicator1 available.
No package libnss3 available.
No package lsb-release available.
Package xdg-utils-1.1.0-0.17.20120809git.el7.noarch already installed and latest version
Package wget-1.14-13.el7.x86_64 already installed and latest version
Nothing to do

@aslushnikov aslushnikov added the host label Aug 20, 2017

@Garbee

This comment has been minimized.

Copy link
Contributor

Garbee commented Aug 21, 2017

You need to convert the package names to be RHEL names. Those are only the Debian names.

@rlog

This comment has been minimized.

Copy link

rlog commented Aug 21, 2017

@Garbee I don't know how to convert, google them one by one ...?

@Garbee

This comment has been minimized.

Copy link
Contributor

Garbee commented Aug 21, 2017

That or grab an RPM copy of the installer and use software management tools to look at what the dependencies of the package are.

@theoutlander

This comment has been minimized.

Copy link

theoutlander commented Aug 23, 2017

Having a similar issue. Here's what I discovered:

[root@li583-175 chrome-linux]# ldd chrome | more
linux-vdso.so.1 => (0x00007ffcd3ee4000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f55baf90000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f55bad8c000)
librt.so.1 => /lib64/librt.so.1 (0x00007f55bab83000)
libpangocairo-1.0.so.0 => not found
libpango-1.0.so.0 => not found
libcairo.so.2 => not found
libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007f55ba932000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f55ba5fb000)
libX11.so.6 => /lib64/libX11.so.6 (0x00007f55ba2bc000)
libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x00007f55ba0ba000)
libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f55b9e98000)
libXcomposite.so.1 => not found
libXcursor.so.1 => not found
libXdamage.so.1 => not found
libXext.so.6 => not found
libXfixes.so.3 => not found
libXi.so.6 => not found
libXrender.so.1 => not found
libXtst.so.6 => not found
libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00007f55b9c91000)
libnss3.so => /lib64/libnss3.so (0x00007f55b9966000)
libnssutil3.so => /lib64/libnssutil3.so (0x00007f55b9739000)
libsmime3.so => /lib64/libsmime3.so (0x00007f55b9512000)
libnspr4.so => /lib64/libnspr4.so (0x00007f55b92d3000)
libcups.so.2 => not found
libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f55b90a9000)
libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007f55b8e6b000)
libdbus-1.so.3 => /lib64/libdbus-1.so.3 (0x00007f55b8c23000)
libXss.so.1 => not found
libXrandr.so.2 => not found
libgconf-2.so.4 => not found
libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x00007f55b88a2000)
libasound.so.2 => /lib64/libasound.so.2 (0x00007f55b85a9000)
libm.so.6 => /lib64/libm.so.6 (0x00007f55b82a7000)
libatk-1.0.so.0 => not found
libgtk-3.so.0 => not found
libgdk-3.so.0 => not found
libgdk_pixbuf-2.0.so.0 => not found
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f55b808f000)
libc.so.6 => /lib64/libc.so.6 (0x00007f55b7cce000)
/lib64/ld-linux-x86-64.so.2 (0x000055a8c8793000)
libffi.so.6 => /lib64/libffi.so.6 (0x00007f55b7ac6000)
libXau.so.6 => /lib64/libXau.so.6 (0x00007f55b78c1000)
libplc4.so => /lib64/libplc4.so (0x00007f55b76bc000)
libplds4.so => /lib64/libplds4.so (0x00007f55b74b8000)
libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007f55b7211000)
libz.so.1 => /lib64/libz.so.1 (0x00007f55b6ffb000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f55b6dd3000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f55b6bb9000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f55b6957000)

I had installed one of the missing packages manually, but it still doesn't find it. I can see that particular package under /usr/lib/libpangocairo-1.0.so.0.

@historylife

This comment has been minimized.

Copy link

historylife commented Aug 24, 2017

So bottom of line , puppeteer can not work on centos !

@theoutlander

This comment has been minimized.

Copy link

theoutlander commented Aug 24, 2017

Here's another issue I'm running into when trying on Docker Centos7:

[root@3dd3c09a9d40 opt]# npm install -g puppeteer

puppeteer@0.9.0 install /usr/lib/node_modules/puppeteer
node install.js

Download failed: EACCES: permission denied, mkdir '/usr/lib/node_modules/puppeteer/.local-chromium'

  • puppeteer@0.9.0
    added 36 packages in 2.437s

I'm running as root. Not sure if that's the issue. I've changed ownership on that folder path. Even tried to create that folder manually and tried with sudo, yet I get that same error repeatedly.

@liulangyu90316

This comment has been minimized.

Copy link

liulangyu90316 commented Aug 24, 2017

@rlog try install fonts?

yum install ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc -y

@theoutlander

This comment has been minimized.

Copy link

theoutlander commented Aug 24, 2017

Tried it in Ubuntu on Docker and got a similar message:

root@6c5ca63ee50a:/opt/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux# ./chrome
./chrome: error while loading shared libraries: libpangocairo-1.0.so.0: cannot open shared object file: No such file or directory

root@6c5ca63ee50a:/opt/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux# ldd ./chrome
linux-vdso.so.1 => (0x00007fffd9a6f000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f74809c4000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f74807c0000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f74805b8000)
libpangocairo-1.0.so.0 => not found
libpango-1.0.so.0 => not found
libcairo.so.2 => not found
libgobject-2.0.so.0 => not found
libglib-2.0.so.0 => not found
libX11.so.6 => not found
libX11-xcb.so.1 => not found
libxcb.so.1 => not found
libXcomposite.so.1 => not found
libXcursor.so.1 => not found
libXdamage.so.1 => not found
libXext.so.6 => not found
libXfixes.so.3 => not found
libXi.so.6 => not found
libXrender.so.1 => not found
libXtst.so.6 => not found
libgmodule-2.0.so.0 => not found
libnss3.so => not found
libnssutil3.so => not found
libsmime3.so => not found
libnspr4.so => not found
libcups.so.2 => not found
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f748038f000)
libfontconfig.so.1 => not found
libdbus-1.so.3 => not found
libXss.so.1 => not found
libXrandr.so.2 => not found
libgconf-2.so.4 => not found
libgio-2.0.so.0 => not found
libasound.so.2 => not found
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7480086000)
libatk-1.0.so.0 => not found
libgtk-3.so.0 => not found
libgdk-3.so.0 => not found
libgdk_pixbuf-2.0.so.0 => not found
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f747fe70000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f747faa6000)
/lib64/ld-linux-x86-64.so.2 (0x00007f74887de000)
root@6c5ca63ee50a:/opt/node_modules/puppeteer/.local-chromium/linux-494755/chrome-linux#

@historylife

This comment has been minimized.

Copy link

historylife commented Aug 24, 2017

I am using centos 6.9 , is there any step by step guide to install "puppeteer" on ?

node : v8.4.0
npm : 5.3.0
uname -a
Linux server 2.6.32-673.26.1.lve1.4.24.el6.x86_64 #1 SMP Wed Mar 29 17:09:57 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
@theoutlander

This comment has been minimized.

Copy link

theoutlander commented Aug 24, 2017

The best solution at this point is to use Ubuntu and follow these instructions #290 (comment).

I started development on OSX and didn't realize about this issue until we decided to go into production 😮.

@Garbee

This comment has been minimized.

Copy link
Contributor

Garbee commented Aug 24, 2017

@theoutlander Why install puppeteer globally in the first place? When installing globally and you're going into a non-user folder (as you are) you need to run as root. Hence why it is not recommended.

@theoutlander

This comment has been minimized.

Copy link

theoutlander commented Aug 24, 2017

@Garbee you're right! I was running into other installation issues and overlooked that I was installing globally. (I recall seeing it, but was thinking I need to install it globally)

@historylife

This comment has been minimized.

Copy link

historylife commented Aug 24, 2017

@Garbee kindly may you advice step by step for centos 6.X , i am very confused how to install ...

@Garbee

This comment has been minimized.

Copy link
Contributor

Garbee commented Aug 25, 2017

@historylife Upgrade to CentOS 7. 6 is no longer supported.

@historylife

This comment has been minimized.

Copy link

historylife commented Aug 26, 2017

@Garbee i dont follow you , do you advise me to upgrade to CentOS 7. 6

@zhuyingda

This comment has been minimized.

Copy link

zhuyingda commented Aug 27, 2017

@liulangyu90316 I have the same problem, centos7.3, I installed all the dependency but got socket hang up, and I can run ./chrome -v --no-sandbox --disable-setuid-sandbox but can not run puppeteer. After install your font dependency, everything got right. Thank you!

@rlog

This comment has been minimized.

Copy link

rlog commented Aug 28, 2017

which OS is recommend? I can change my OS (except macOS and Windows)

@zhuyingda

This comment has been minimized.

Copy link

zhuyingda commented Aug 28, 2017

@rlog you can take centos 7.3, same with me, and see this

@SeanSanker

This comment has been minimized.

Copy link

SeanSanker commented Aug 28, 2017

@zhuyingda 's notes above will allow you to run puppeteer with --no-sandbox, but this is insecure as the sandbox is intended to isolate the process from the system.

The error message itself ('No usable sandbox!'), states If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox..

Running without a sandbox should be considered bad practice and potentially harmful.

Then again, if it works, it works.

In recap:
Install the deps by running:
yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc -y
... and in the source file, when you launch the browser itself specify:
const browser = await puppeteer.launch({ args: ['--no-sandbox']})

With that you'll be good to go (or should hopefully be), but it's playing a risky game, especially if this is a production system.

(Out of curiosity I checked, and thankfully; you can't run chrome --no-sandbox as root. ref. Running as root without --no-sandbox is not supported. See https://crbug.com/638180)

@SeanSanker

This comment has been minimized.

Copy link

SeanSanker commented Aug 28, 2017

If you're a lunatic you can spend a few days trying to compile chromium from source, then compile the sandbox from source, and attempt to monkey-patch them together.
Build Chromium
Build Sandbox

Although if you look at the top of the Build Sandbox link, it appears they'll be dumping support for the SUID sandbox in favor User namespaces sandbox (sandbox list). Here's the thing, it looks like the chromium issue for replacing SUID has been open since 2013 so I wouldn't bank on that fixing this.

@JustinYi922

This comment has been minimized.

Copy link

JustinYi922 commented Aug 29, 2017

I have the same problem,too。

node:v8.4.0
centos:centos-release-7-2.1511.el7.centos.2.10.x86_64

(node:21521) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to connect to chrome!
(node:21521) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@zhuyingda

This comment has been minimized.

Copy link

zhuyingda commented Aug 29, 2017

@JustinYi922 You can try the font requirements which I mentioned

@CatsMiaow

This comment has been minimized.

Copy link

CatsMiaow commented Jan 11, 2018

Resolved without --no-sandbox

OS: CentOS Linux release 7.4.1708 (Core)
Kernel: 3.10.0-693.11.6.el7.x86_64

Dependencies

yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc

Download Chromium

Install separately as root permissions issue

cd /home/chromium
git clone https://github.com/scheib/chromium-latest-linux .
./update.sh

Sandbox Issue

#391 (comment)
https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md

cd /home/chromium/latest
chown yourID:yourID *
# Need root permission
chown root:root chrome_sandbox && chmod 4755 chrome_sandbox
export CHROME_DEVEL_SANDBOX="/home/chromium/latest/chrome_sandbox"

Installation

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
npm install --save puppeteer

PM2 Environment

{
  "env": {
    "NODE_ENV": "production",
    "CHROME_DEVEL_SANDBOX": "/home/chromium/latest/chrome_sandbox"
  }
}

Run

const browser = await puppeteer.launch({ executablePath: '/home/chromium/latest/chrome' });

Clear.

@arganzheng

This comment has been minimized.

Copy link

arganzheng commented Feb 1, 2018

After trying install, I got this error:

node_modules/puppeteer/.local-chromium/linux-526987/chrome-linux/chrome: error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory

My OS System is CentOS6.4, has anybody got this error too?

@arganzheng

This comment has been minimized.

Copy link

arganzheng commented Feb 1, 2018

Everything went well after switching to centos7... puppeteer required chromium, chromium required gtk3, and centos6 has only gtk2... DO NOT try to install puppeteer/chromium in CentOS6.. I've been struggled for one day...

@zhuyingda

This comment has been minimized.

Copy link

zhuyingda commented Feb 1, 2018

@arganzheng I will not attempt to run puppeteer on low version centos any more, I think docker is the right way to run puppeteer and headless chrome if you can not update your system to centos7.
There has been a lot of ubantu headless chromium docker images in the docker hub, and I create a centos headless chromium docker image. Also, anyone can run this puppeteer crawler demo with my another docker image.

@junlintianxiazhifulinzhongguo

This comment has been minimized.

Copy link

junlintianxiazhifulinzhongguo commented Feb 7, 2018

@arganzheng
要安装一些依赖才行
#依赖库
yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 -y

#字体
yum install ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc -y
可以去看下下面的这个网址
https://segmentfault.com/a/1190000011382062

@lijialiang

This comment has been minimized.

Copy link

lijialiang commented Feb 9, 2018

I tried to install a lot of things, but still get a mistake.

/root/test/node_modules/_puppeteer@1.0.0@puppeteer/.local-chromium/linux-526987/chrome-linux/chrome: error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory

CentOS release 6.4 (Final)

@xiaojue

This comment has been minimized.

Copy link

xiaojue commented Feb 26, 2018

libatk-bridge-2.0.so.0 error centos 6.5

@imdoge

This comment has been minimized.

Copy link

imdoge commented Mar 7, 2018

@lilijialiang @xiaojue
do you fix it in centos 6?
I install all CentOS Dependencies but it doesn't work
the same error

error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory
@mathieuferraris

This comment has been minimized.

Copy link

mathieuferraris commented Mar 16, 2018

Hello,

Before I start, here is my server config:

 hardware: x86_64 (x86_64)
 os: CentOS Linux release 7.2.1511 (Core) running kernel 3.10.0-693.17.1.el7.x86_64
 memory: 5.52 GB
 cpu: 2x Intel(R) Xeon(R) CPU E5-2697A v4 @ 2.60GHz
 selinux enabled: false
 server type: vmware

I'm a newbie with Linux commands, but I still have libraries missing for chrome:

libXss.so.1 => not found
libatk-bridge-2.0.so.0 => not found
libgtk-3.so.0 => not found
libgdk-3.so.0 => not found

Those libraries are installed in my OS but are located in another directory.
I ran "ldd chrome" and except those 4, every library is located in /usr/lib64
The "not found" libraries are located in /usr/lib
I think that chrome is always looking for dependencies in /usr/lib64
As i don't have the writing permissions on those folders, I can't create a symlink of the requested libraries in /usr/lib64

Is it possible to change the path for these missing dependencies ?

Or maybe I'm totally wrong, I'm lost ^^

Thanks for your help !

@546425049

This comment has been minimized.

Copy link

546425049 commented Mar 21, 2018

@JustinYi922 I have the same question , it works but the picture is not all right , some charts can't be showed. so you resolve it now?

@Ivan-Perez

This comment has been minimized.

Copy link

Ivan-Perez commented Apr 24, 2018

I'm getting another error when executing the node script (which runs puppeteer) through a PHP script.

(node:14405) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
[0424/163839.393626:ERROR:icu_util.cc(133)] Invalid file descriptor to ICU data received.
[0424/163839.393877:FATAL:content_main_delegate.cc(53)] Check failed: false. 
#0 0x55992b730b0c base::debug::StackTrace::StackTrace()
#1 0x55992b749780 logging::LogMessage::~LogMessage()
#2 0x559929ad2d23 content::ContentMainDelegate::TerminateForFatalInitializationError()
#3 0x55992b46bdeb content::ContentMainRunnerImpl::Initialize()
#4 0x55992b475b72 service_manager::Main()
#5 0x55992b46af14 content::ContentMain()
#6 0x55992f57a9b9 headless::(anonymous namespace)::RunContentMain()
#7 0x55992f57aa42 headless::HeadlessBrowserMain()
#8 0x55992b472f9d headless::HeadlessShellMain()
#9 0x559929ad11ac ChromeMain
#10 0x7f0b4d6f9c05 __libc_start_main
#11 0x559929ad102a _start

If I run the script with my user, it completes successfully. So maybe its a permission problem, but I can't figure out what is failing.

@leem32

This comment has been minimized.

Copy link

leem32 commented May 2, 2018

I managed to get Puppeteer taking screenshots without the --no-sandbox flag arg by setting a Linux kernel parameter to enable namespacing (on CentOS Linux release 7.4.1708).

As root user run:
echo "user.max_user_namespaces=15000" >> /etc/sysctl.conf
Check it worked with:
sudo sysctl -a | grep user.max_user_namespaces

Now reboot your system and run a script without using --no-sandbox e.g const browser = await puppeteer.launch();

If it still doesn't work you might be using an older Linux Kernel and will require a couple of extra args set in the Kernel.

As root user run:
grubby --args="user_namespace.enable=1 namespace.unpriv_enable=1" --update-kernel="$(grubby --default-kernel)"

Now reboot your system and check the Kernel command line for the 2 params you just added
cat /proc/cmdline

If they are in the command line run a script without using --no-sandbox again e.g const browser = await puppeteer.launch();

It should work now. If it doesn't you might be using an old kernel which doesn't support namespacing.

You can check your kernel version with:
uname -a
This is my kernel version which I've got Puppeteer running without --no-sandbox arg.
Linux centos7 3.10.0-693.21.1.el7.x86_64

Hope this helps :)

@diamont1001

This comment has been minimized.

Copy link

diamont1001 commented May 17, 2018

mark

1 similar comment
@beliefgp

This comment has been minimized.

Copy link

beliefgp commented May 23, 2018

mark

@jony89

This comment has been minimized.

Copy link

jony89 commented Jun 3, 2018

Anyone made it through with centos 6 - 6.9 ?

@s-sebastian

This comment has been minimized.

Copy link

s-sebastian commented Jun 11, 2018

The following pkgs solved the issue for me on CentOS 7:

# cat /etc/redhat-release 
CentOS Linux release 7.5.1804 (Core)

# sudo ldd chrome | grep not
	libXtst.so.6 => not found
	libXss.so.1 => not found
	libatk-bridge-2.0.so.0 => not found
	libgtk-3.so.0 => not found
	libgdk-3.so.0 => not found

# yum install libXtst libXScrnSaver gtk3 -y
@matrey

This comment has been minimized.

Copy link

matrey commented Jun 20, 2018

From a minimal CentOS 7 setup, I had to install the following packages to get it to work:

yum -y install libX11 libXcomposite libXcursor libXdamage libXext libXi libXtst cups-libs libXScrnSaver libXrandr alsa-lib pango atk at-spi2-atk gtk3 
@carlos-algms

This comment has been minimized.

Copy link

carlos-algms commented Jun 21, 2018

@matrey Suggestion Worked for me. Thanks.

@premek

This comment has been minimized.

Copy link

premek commented Jul 11, 2018

nanhaiyufu's solution helped me on Debian.

@shellar1990

This comment has been minimized.

Copy link

shellar1990 commented Jul 17, 2018

@JustinYi922 I have the same problem,and I have found that the reason is the system lacks the fonts,you should install the font,just like this.

@JustinYi922

This comment has been minimized.

Copy link

JustinYi922 commented Jul 19, 2018

@shellar1990 2017年提出这个问题的时候,我就知道是这个原因,只是我没有到git上同步一下这个状态。谢谢你哈。

@fengmiaosen

This comment has been minimized.

Copy link

fengmiaosen commented Dec 13, 2018

libatk-bridge-2.0.so.0 error centos 6.5
centos 6.5 not support,you need centos7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment