How to I run Chromium-browser in headless mode on Ubuntu? Is it possible?

2,754 views
Skip to first unread message

joël maranhão

unread,
Apr 25, 2016, 6:38:39 AM4/25/16
to Chromium-discuss
I have been failing miserably to start Chromium in headless mode using Xvfb.

Hereafter the details 

# Ubuntu

    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 14.04.4 LTS
    Release: 14.04
    Codename: trusty

# Chromium

    chromium-browser --version
    Chromium 48.0.2564.116 Ubuntu 14.04

I am serving a Flask web application on `localhost` and I want to browse to it in headless mode.


### X virtual frame buffer `xvfb-run`

    $ apt-get install xvfb 

Running **Chromium** with the following options

    --allow-running-insecure-content    // trying to get passed
    --ignore-certificate-errors         // the self-signed certs
    --ignore-urlfetcher-cert-requests   //
    --disable-gpu                       
    --no-sandbox                        

the command

     xvfb-run --server-args='-screen 0, 1024x768x24' chromium-browser --allow-running-insecure-content --ignore-certificate-errors --ignore-urlfetcher-cert-requests  --disable-gpu --no-sandbox https://admin:password@localhost
    

# Xlib:  extension "RANDR" missing on display ":99".

    [2596:2596:0407/170544:ERROR:browser_main_loop.cc(206)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
    Xlib:  extension "RANDR" missing on display ":99".
    Xlib:  extension "RANDR" missing on display ":99".
    [2596:2596:0407/170544:ERROR:desktop_window_tree_host_x11.cc(892)] Not implemented reached in virtual void views::DesktopWindowTreeHostX11::InitModalType(ui::ModalType)
    [2596:2596:0407/170545:ERROR:logging.h(808)] Failed to call method: org.freedesktop.DBus.ObjectManager.GetManagedObjects: object_path= /: org.freedesktop.DBus.Error.UnknownMethod: Method "GetManagedObjects" with signature "" on interface "org.freedesktop.DBus.ObjectManager" doesn't exist
    [2596:2596:0407/170545:ERROR:logging.h(808)] Failed to call method: org.freedesktop.DBus.ObjectManager.GetManagedObjects: object_path= /: org.freedesktop.DBus.Error.UnknownMethod: Method "GetManagedObjects" with signature "" on interface "org.freedesktop.DBus.ObjectManager" doesn't exist
    [2596:2596:0407/170629:ERROR:chrome_browser_main_extra_parts_x11.cc(62)] X IO error received (X server probably went away)


## Without `--disable-gpu` and `--no-sandbox`   

    [3122:3122:0407/172728:ERROR:sandbox_linux.cc(338)] InitializeSandbox() called with multiple threads in process gpu-process
    [3062:3099:0407/172728:ERROR:browser_gpu_channel_host_factory.cc(144)] Failed to create channel.

# Also tried the following

    $ sudo Xvfb :1 -screen 0 1024x768x24 -ac +extension GLX +extension RANDR +render -noreset &
    $ export DISPLAY=":1"
    $ chromium-browser --allow-running-insecure-content --ignore-certificate-errors --ignore-urlfetcher-cert-requests  --disable-gpu --no-sandbox https://admin:password@localhost

getting

    [3413:3413:0407/174058:ERROR:browser_main_loop.cc(206)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
    [3413:3413:0407/174058:ERROR:browser_main_loop.cc(256)] Gtk: cannot open display: :1
    [3422:3422:0100/000000:ERROR:zygote_linux.cc(674)] write: Broken pipe

So is it even possible to run Chromium in headless mode?


Anand

unread,
Apr 26, 2016, 4:38:36 AM4/26/16
to Chromium-discuss
It should be possible. I run browser tests (which is basically chromium) all the time under xvfb using https://code.google.com/p/chromium/codesearch#chromium/src/testing/xvfb.py

That script launches a window manager. Maybe you should try doing that.
Reply all
Reply to author
Forward
0 new messages