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

xvfb-run issue - Cannot start browser #263

Closed
tymej opened this issue Sep 29, 2021 · 3 comments
Closed

xvfb-run issue - Cannot start browser #263

tymej opened this issue Sep 29, 2021 · 3 comments

Comments

@tymej
Copy link

tymej commented Sep 29, 2021

Hello,

I'm trying to run chromium with xvfb and it keep throwing error:

[2021-09-29 09:18:55] DEBUG process: initializing
[2021-09-29 09:18:55] DEBUG process: using directory: /tmp/chromium-php-FRpkRz
[2021-09-29 09:18:55] DEBUG process: starting process: '/bin/chromium.sh' '--remote-debugging-port=0' '--disable-background-networking' '--disable-background-timer-throttling' '--disable-client-side-phishing-detection' '--disable-default-apps' '--disable-extensions' '--disable-hang-monitor' '--disable-popup-blocking' '--disable-prompt-on-repost' '--disable-sync' '--disable-translate' '--metrics-recording-only' '--no-first-run' '--safebrowsing-disable-auto-update' '--enable-automation' '--password-store=basic' '--use-mock-keychain' '--blink-settings=imagesEnabled=false' '--window-size=1280,900' '--no-sandbox' '--user-data-dir=/tmp/chromium-php-FRpkRz'
[2021-09-29 09:18:55] DEBUG process: waiting for 30 seconds for startup

   RuntimeException 

  Cannot start browser

  at vendor/chrome-php/chrome/src/Browser/BrowserProcess.php:439
    435▕             };
    436▕ 
    437▕             return Utils::tryWithTimeout($timeout, $generator($process));
    438▕         } catch (OperationTimedOut $e) {
  ➜ 439▕             throw new \RuntimeException('Cannot start browser', 0, $e);
    440▕         }
    441▕     }
    442▕ 
    443▕     /**

      +4 vendor frames 
  5   app/BrowserFactory::createBrowser()

  6   app\ChromeBrowserBuilder::build()
[2021-09-29 09:19:25] DEBUG process: killing chrome
[2021-09-29 09:19:25] DEBUG process: stopping process
[2021-09-29 09:19:25] DEBUG process: process stopped with exit code 143
[2021-09-29 09:19:25] DEBUG process: cleaning temporary resources:/tmp/chromium-php-FRpkRz

The browser process looks like is not returning any output for php script.

Below command run says that the browser is listening.

/bin/chromium.sh --remote-debugging-port=0 --disable-background-networking --disable-background-timer-throttling --disable-client-side-phishing-detection --disable-default-apps --disable-extensions --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-translate --metrics-recording-only --no-first-run --safebrowsing-disable-auto-update --enable-automation --password-store=basic --use-mock-keychain --blink-settings=imagesEnabled=false --window-size=1280,900 --no-sandbox --user-data-dir=/tmp/chromium-php-FRpkRz

(chrome:1401): Gtk-WARNING **: 09:26:22.646: Theme parsing error: gtk.css:1428:23: 'font-feature-settings' is not a valid property name

(chrome:1401): Gtk-WARNING **: 09:26:22.659: Theme parsing error: gtk.css:3318:25: 'font-feature-settings' is not a valid property name

(chrome:1401): Gtk-WARNING **: 09:26:22.661: Theme parsing error: gtk.css:3780:23: 'font-feature-settings' is not a valid property name
[1401:4377:0929/092623.745088:ERROR:object_proxy.cc(642)] Failed to call method: org.freedesktop.DBus.ListActivatableNames: object_path= /org/freedesktop/DBus: org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.46" (uid=1000 pid=1401 comm="/snap/chromium/1753/usr/lib/chromium-browser/chrom" label="snap.chromium.chromium (enforce)") interface="org.freedesktop.DBus" member="ListActivatableNames" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[4393:4393:0929/092628.310722:ERROR:viz_main_impl.cc(162)] Exiting GPU process due to errors during initialization

DevTools listening on ws://127.0.0.1:37769/devtools/browser/3d9a40ad-4fac-4dd0-9570-126a52a64810
[4424:4424:0929/092628.437427:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is swiftshader

Ubuntu 20.04.3 LTS, PHP 8.0.11 (cli)

/bin/chromium.sh script content

#!/bin/bash
xvfb-run -a --server-args="-screen 0, 1280x900x16" chromium-browser $@

chrome-php/chrome v1.1.0

Tested with browsers:

  • chromium stable - 93.0.4577.82
  • chromium edge - 96.0.4655.0
  • google-chrome - 94.0.4606.61

Thanks for any advices.

@tymej
Copy link
Author

tymej commented Sep 29, 2021

Works fine on raw debian 10 instead of ubuntu.

@tymej tymej closed this as completed Sep 29, 2021
@idem84
Copy link

idem84 commented May 4, 2022

Any news? Ubuntu 18, same here

Chrome process stopped before startup completed. Additional info: [8055:8055:0504/185004.260287:ERROR:ozone_platform_x11.cc(247)] Missing X server or $DISPLAY [8055:8055:0504/185004.260352:ERROR:env.cc(225)] The platform failed to initialize. Exiting.

@urinaldeuce
Copy link

This occurred for me when I was trying to run the php file as a crontab/job.
It appears to be an environment variable for the display.

To fix when using a chron job use: export DISPLAY=$HOST_IP:10.0 && execute php script

The issue happens with puppeteer: puppeteer/puppeteer#8148

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

No branches or pull requests

3 participants