{"id":26112,"date":"2020-05-19T20:13:53","date_gmt":"2020-05-19T18:13:53","guid":{"rendered":"https:\/\/pi3g.com\/?p=26112"},"modified":"2020-05-28T17:42:56","modified_gmt":"2020-05-28T15:42:56","slug":"chromium-exit-code-5","status":"publish","type":"post","link":"https:\/\/pi3g.com\/de\/chromium-exit-code-5\/","title":{"rendered":"Chromium-Exit-Code -5"},"content":{"rendered":"<p>While running Chromium with <\/p>\n<blockquote>\n<p>chromium-browser &#8211;display=:0 <a href=\"https:\/\/www.picockpit.com\">https:\/\/www.picockpit.com<\/a><\/p>\n<\/blockquote>\n<p>will allow you to start Chromium from an SSH connection (and it will output to the main display in the X Server), this will <strong>fail<\/strong> when you try to run it with subprocess.Popen in Python:<\/p>\n<blockquote>\n<p>&#8220;command&#8221;: [&#8220;chromium-browser&#8221;, &#8220;&#8211;display=:0&#8221;, \u201c<a href=\"https:\/\/picockpit.com\">https:\/\/picockpit.com<\/a>\u201d]<\/p>\n<\/blockquote>\n<p>(this is part of the JSON format I have specified for PiControl \u2013 the main idea is that this Array is passed in into subprocess.Popen). <\/p>\n<p>The actual call to run the command is:<\/p>\n<blockquote>\n<p>proc = subprocess.Popen(<br \/>&nbsp;&nbsp;&nbsp;&nbsp; cmd,<br \/>&nbsp;&nbsp;&nbsp;&nbsp; stdout=subprocess.PIPE,<br \/>&nbsp;&nbsp;&nbsp;&nbsp; stderr=subprocess.PIPE,<br \/>&nbsp;&nbsp;&nbsp;&nbsp; preexec_fn=demote(user, uid, gid)<br \/>\n)<\/p>\n<\/blockquote>\n<p>Chromium will exit immediately with an <strong>error status code of -5<\/strong>. (And yes, the user and group are set to pi, and the additional group memberships for the user are set). <\/p>\n<p><\/p>\n<h1>Update 28.5.2020<\/h1>\n<p>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 \u20135.<\/p>\n<p>This will, therefore, also work:<\/p>\n<blockquote>\n<p>chromium-browser &#8211;display=:0 &#8211;kiosk <a href=\"https:\/\/picockpit.com\">https:\/\/picockpit.com<\/a><\/p>\n<p><a href=\"https:\/\/pi3g.com\/wp-content\/uploads\/2020\/05\/image-18.png\"><img loading=\"lazy\" decoding=\"async\" width=\"641\" height=\"49\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/pi3g.com\/wp-content\/uploads\/2020\/05\/image_thumb-18.png\" border=\"0\"><\/a><\/p>\n<\/blockquote>\n<p>I therefore do not have a solution for the problem with Chrome exitting with \u201c-5\u201d \u2013 but since it does not occur in the normal operation mode of PiCockpit, it is not worth continuing to look into for the moment.<\/p>\n<p><strong><font style=\"background-color: rgb(255, 255, 0);\">Please disregard the information below, I am leaving this up here for reference purposes only.<\/font><\/strong><\/p>\n<h1>Old information<\/h1>\n<p>I have not found documentation about Chromium exit codes, <strike>however I have come up with a fix for <strong>this<\/strong> particular problem<\/strike> (and also which should help you to debug other exit codes as well) (<em>Update 28.5.: this is not a fix for this particular problem, and unfortunately Breakpad is disabled on \u201cnormal\u201d builds, which makes debugging more difficult<\/em>) . <\/p>\n<blockquote>\n<p>&#8220;command&#8221;: [&#8220;chromium-browser&#8221;, &#8220;&#8211;display=:0&#8221;, &#8220;&#8211;enable-logging=stderr&#8221;, &#8220;&#8211;kiosk&#8221;, <a href=\"https:\/\/picockpit.com\">https:\/\/picockpit.com<\/a>]<\/p>\n<\/blockquote>\n<p>(the &#8211;kiosk part is optional \u2013 it will start Chromium in kiosk mode, that is no URL bar, full screen, to avoid the user \u201cescaping\u201d your application on public facing interactive kiosks).<\/p>\n<p><a href=\"https:\/\/pi3g.com\/wp-content\/uploads\/2020\/05\/image-16.png\"><img loading=\"lazy\" decoding=\"async\" width=\"776\" height=\"81\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/pi3g.com\/wp-content\/uploads\/2020\/05\/image_thumb-16.png\" border=\"0\"><\/a><\/p>\n<p>The full command definition for PiControl (for picockpit.com) looks like this: <\/p>\n<p><a href=\"https:\/\/pi3g.com\/wp-content\/uploads\/2020\/05\/image-17.png\"><img loading=\"lazy\" decoding=\"async\" width=\"974\" height=\"250\" title=\"image\" style=\"display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/pi3g.com\/wp-content\/uploads\/2020\/05\/image_thumb-17.png\" border=\"0\"><\/a><\/p>\n<p>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. <\/p>\n<p>We consult for the Raspberry Pi platform (hardware &amp; software development, business concepts), and all things Raspberry Pi! <a href=\"https:\/\/pi3g.com\/kontakt\/\">Please get in touch with us today.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>While running Chromium with chromium-browser &#8211;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: &#8220;command&#8221;: [&#8220;chromium-browser&#8221;, &#8220;&#8211;display=:0&#8221;, \u201chttps:\/\/picockpit.com\u201d] (this is part of the JSON format I have&hellip;<\/p>\n","protected":false},"author":830,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[402],"tags":[795,708,796,798,799,797],"class_list":["post-26112","post","type-post","status-publish","format-standard","hentry","category-development","tag-chromium","tag-debug","tag-exit-code","tag-exit-status","tag-exit_","tag-status-code"],"_links":{"self":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/26112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/users\/830"}],"replies":[{"embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/comments?post=26112"}],"version-history":[{"count":2,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/26112\/revisions"}],"predecessor-version":[{"id":27236,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/posts\/26112\/revisions\/27236"}],"wp:attachment":[{"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/media?parent=26112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/categories?post=26112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pi3g.com\/de\/wp-json\/wp\/v2\/tags?post=26112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}