maintainer-feedback requested: [Bug 219188] www/chromium support for --headless flag

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed May 10 10:18:04 UTC 2017


Reshad Patuck <reshadpatuck1 at gmail.com> has reassigned Bugzilla Automation
<bugzilla at FreeBSD.org>'s request for maintainer-feedback to
chromium at FreeBSD.org:
Bug 219188: www/chromium support for --headless flag
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219188



--- Description ---
I want to use chrome with the --headless flag on a server without an X server
running to get screenshots and/or print-to-pdf of a page.

Without running a display server, chrome errors out immediately because GTK can
not open the display.

root at FreeBSD:~ # echo $DISPLAY
DISPLAY: Undefined variable.
root at FreeBSD:~ # chrome --headless --disable-gpu --no-sandbox --screenshot
--verbose http://example.com
[81628:457269248:0510/101444.736930:ERROR:browser_main_loop.cc(284)] Gtk:
cannot open display: 

---

When I try running it with xvfb.

root at FreeBSD:~ # service dbus onestart
root at FreeBSD:~ # Xvfb :0 -screen 0 1024x768x24 &
root at FreeBSD:~ # setenv DISPLAY :0
root at FreeBSD:~ # chrome --version
Chromium 58.0.3029.81 
root at FreeBSD:~ # chrome --headless --disable-gpu --no-sandbox --screenshot
--verbose http://example.com

This seems to just hang (runs on the command line without any output).
My guess is that chrome is droping the --headless flag and going ahead and
initializing as if it were running on an actual system

---

On a debian system with chromium (57.0.2987) installed from the package
repository, the command seems to run without an X sever (even xvfb) running
beforehand.

root at debian:~# apt-get install chromium
...
root at debian:~# chromium --version
Chromium 57.0.2987.98 Built on 8.7, running on Debian 8.7
root at debian:~# chromium  --headless --disable-gpu --screenshot --verbose
http://example.com
[0507/071136.814541:WARNING:audio_manager.cc(321)] Multiple instances of
AudioManager detected
[0507/071136.814714:WARNING:audio_manager.cc(278)] Multiple instances of
AudioManager detected
[0507/071137.002908:INFO:headless_shell.cc(378)] Screenshot written to file
screenshot.png.


The command exits without error and the screenshot.png file is in the folder
where the command ran from.

---

Some reference links:
- https://developers.google.com/web/updates/2017/04/headless-chrome
- https://chromium.googlesource.com/chromium/src/+/master/headless/README.md
- https://chromium.googlesource.com/chromium/src/+/58.0.3029.81/headless/


More information about the freebsd-chromium mailing list