Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

Launching chromium from emulationstation



  • Hi,
    I installed Chromium using an customised deb package (customised to allow viewing netflix).
    Chromium is installed without errors, but when I try to run it from emulationstation, I get the following message:

    Failed to put Xlib into threaded mode.
    Gtk: cannot open display

    I have a script called chromium.sh in RetroPie/roms/chromium which contains the following line inside:
    chromium-browser

    Also I added the following to the file es_sytems.cfg located in /opt/retropie/config/all/emulationstation/es_system

    <system> <fullname>Chromium</fullname> <name>chromium</name> <path>~/RetroPie/roms/ chromium</path> <extension>.sh .SH</extension> <command>bash %ROM%</command> <platform>chromium</platform> </system>

    Any thoughts?
    Thanks

    Pi Model or other hardware: 3
    RetroPie Version Used (eg 3.6, 3.8.1, 4.1 - do not write latest): 4.3
    Built From: Pre made SD Image on RetroPie websit


  • Global Moderator

    @carlosricardocm Chromium needs an X server running - basically a classic desktop environment. You must run it from Pixel or start it in an X session, see this thread for instance - https://raspberrypi.stackexchange.com/questions/11866/how-can-i-start-x11-only-for-a-single-application



  • There's a custom script to install chromium in the extra repository https://retropie.org.uk/forum/topic/8/. Maybe you can can install your version after you installed that.



  • @carlosricardocm said in Launching chromium from emulationstation:

    I get the following message:
    Failed to put Xlib into threaded mode.
    Gtk: cannot open display

    In order to fix that, you need to follow this tutorial.
    In the end, I only had to run the two installs below:

    sudo apt-get install xinit
    sudo apt-get install matchbox-window-manager
    

    I have a script called chromium[dot]sh in RetroPie/roms/chromium which contains the following line inside:
    chromium-browser

    After installing xinit and matchbox-window-manager, I've modified my Chromium launcher script exactly as instructed in the aforementioned tutorial.

    Also I added the following to the file es_sytems.cfg located in /opt/retropie/config/all/emulationstation/es_system
    <system> <fullname>Chromium</fullname> <name>chromium</name> <path>~/RetroPie/roms/ chromium</path> <extension>.sh .SH</extension> <command>bash %ROM%</command> <platform>chromium</platform> </system>

    In my file, I've got:

      <system>
        <name>chromium</name>
        <fullname>Chromium Web Browser</fullname>
        <path>/home/pi/RetroPie/roms/chromium</path>
        <extension>.sh .SH</extension>
        <command>startx %ROM% > /dev/null 2>&1</command>
        <platform>chromium</platform>
        <theme>chromium</theme>
      </system>
    

    Note the <command> line: I've entered startxfollowed by the %ROM% parameter (which will get the script name) then an extra > /dev/null 2>&1 (this is to omit the output from the script commands, keeping a clean console).

    Update:
    Initially I had xinit in the command line to invoke the script from a window manager environment. A couple days after, while managing modules and plugins (throwing apt-gets at random, for no reason whatsoever), I ended up somehow breaking xinit as in it would no longer start the X-Server. So I found a workaround by replacing xinit with startx in the <command> line, and all was good again.



Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.