Chromium exit code -5

While running Chromium with

chromium-browser –display=:0 https://www.picockpit.com

will allow you to start Chromium from an SSH connection (and it will output to the main display in the X Server), this will fail when you try to run it with subprocess.Popen in Python:

“command”: [“chromium-browser”, “–display=:0”, “https://picockpit.com”]

(this is part of the JSON format I have specified for PiControl – the main idea is that this Array is passed in into subprocess.Popen).

The actual call to run the command is:

proc = subprocess.Popen(
     cmd,
     stdout=subprocess.PIPE,
     stderr=subprocess.PIPE,
     preexec_fn=demote(user, uid, gid)
)

Chromium will exit immediately with an error status code of -5. (And yes, the user and group are set to pi, and the additional group memberships for the user are set).

Update 28.5.2020

Chromium seems to run when picockpit-client is executed as a service. If I test picockpit-client by launching it manually (from an SSH connection), Chromium exits with the code –5.

This will, therefore, also work:

chromium-browser –display=:0 –kiosk https://picockpit.com

image

I therefore do not have a solution for the problem with Chrome exitting with “-5” – but since it does not occur in the normal operation mode of PiCockpit, it is not worth continuing to look into for the moment.

Please disregard the information below, I am leaving this up here for reference purposes only.

Old information

I have not found documentation about Chromium exit codes, however I have come up with a fix for this particular problem (and also which should help you to debug other exit codes as well) (Update 28.5.: this is not a fix for this particular problem, and unfortunately Breakpad is disabled on “normal” builds, which makes debugging more difficult) .

“command”: [“chromium-browser”, “–display=:0”, “–enable-logging=stderr”, “–kiosk”, https://picockpit.com]

(the –kiosk part is optional – it will start Chromium in kiosk mode, that is no URL bar, full screen, to avoid the user “escaping” your application on public facing interactive kiosks).

image

The full command definition for PiControl (for picockpit.com) looks like this:

image

It is contained in a JSON file on the particular pi. This way, you will be able to define many different commands (which will show up as buttons in the webinterface) for the Raspberry Pi by simply editing a JSON file.

We consult for the Raspberry Pi platform (hardware & software development, business concepts), and all things Raspberry Pi! Please get in touch with us today.