8

I am automating a RPi for four displays at my company. I have them rebooting every day so the browser will refresh. I can't get the Restore pages? Chromium didn't shut down correctly bubble to not come up. I've tried several solutions that ive found online, but nothing works.

Ive added many switches such as --noerrdialogs --disable-session-crashed-bubble --disable-infobars --disable-restore-session-state --incognito

Ive also tried a couple of sed commands i found online.

Any help would be greatly appreciated.

  • Have you looked into properly shutting down chrome? – Steve Robillard Jun 20 '17 at 13:55
  • the reason I suggest this is it is treating the disease, not the side effects. – Steve Robillard Jun 20 '17 at 14:33
  • I was thinking about a cronjob to shut down chromium 10 minutes before the reboot runs. Thats the next step, any suggestions? – Paul Karvetski Jun 20 '17 at 15:34
  • That may work especially if scripted through the GUI and a check is added before your reboot. You may also be able to avoid the reboot completely. If they are only displaying a single page you may want to look at fullpageOS. – Steve Robillard Jun 20 '17 at 15:38
  • 1
    you can use javascript to refresh after a certain amount of time stackoverflow.com/questions/2787679/… you likely don't need to refresh every 5 seconds but the theory is the same. – Steve Robillard Jun 20 '17 at 15:48
11

I've got it! Use --app=your.url

For example:

chromium-browser --kiosk --app=http://your.url.here
  • 2
    the only thing that worked for me on my Pi Zero! Thank you – DarkCygnus Oct 10 '18 at 16:15
  • Where were you a year ago :) – uchuugaka Dec 30 '18 at 15:37
  • Seriously, this saved my irritiations with crashy chromium. thanks – uchuugaka Dec 30 '18 at 15:37
5

1) I dunno why --disable-infobars didn't work for you. This works well for me:

chromium-browser --kiosk --disable-infobars \
http://URL1 \
http://URL2 \
http://URL3

2) A better way to refresh the browser (contents) would be to sent it Control-R? e.g. in your browser startup script, do:

(while sleep 200; do xdotool key ctrl+R; done) &

(I also send ctrl+Tab to cycle through my multiple browser tabs

4

I know this doesn't really solve the issue - but as a work-around - it did the trick for me.

I made sure Chrome was shut down cleanly... Opened terminal

cd .config/chromium/Default
chattr +i Preferences

This makes the file immutable... strictly read-only, Chrome can crash as much as it likes - it wont show the popup as the Preferences file can no longer be changed.

This setup works for me as the Pi config will not change - it's just displaying a web based app in kiosk mode.

  • Works in Linux Distros too... Note that there could be issues in Windows / WebDriver / Selenium as reported elsewhere – MarcoZen Aug 21 '18 at 13:42
2

I came up with a workaround that actually took care of several items at once.

vi restartscript.sh

#!/bin/sh
/usr/bin/killall chromium-browser
/usr/bin/apt-get update -y
/usr/bin/ apt-get upgrade -y
/sbin/reboot

Make the script executable: chmod +x restartscript.sh

Edit cron: chrontab -e

0 5 * * * /home/pi/restartscript.sh

The webpage im displaying gets refreshed, and the pi stays up to date.

2

This page gave me the answer. Adding the option

chrome_options.add_argument("--profile-directory=Default")

resolved it for me (in a non-kiosk application).

Turns out this was only part of the issue. The whole situation seems very variable. I additionally added:

prefs = {'exit_type': 'Normal'}
chrome_options.add_experimental_option("prefs", {'profile': prefs})

Trying to reproduce the error to prove this was the fix, I can't now get it to come back with the pop-up (even without this code). YMMV, btw this is running version 72 of Chrome. I saw other posts that advocated changing the Preferences file with something like sed before starting the browser.

1

My solution is very easy. I only copy a Preferences file from a former clear shutdown of Chromium over the current file ~/.config/chromium/Default/Preferences.

1

For those arriving here from Google:

The best way to now perform this task, without having to use incognito, is to adjust two settings in the Chromium preferences. They are:

  • exited_cleanly
  • exit_type

From what I have gathered from personal tests, just changing the "exited_cleanly" setting may not always work at preventing the Chromium prompt on startup. Other flags such as "-disable-infobars" will also not work.

To adjust these settings, please add the following in your startup file, before launching Chromium (depending on how you have set up Chromium to automatically run in kiosk mode, this file can either be located at "/etc/xdg/lxsession/LXDE-pi/autostart", "/etc/xdg/openbox/autostart", "~/.Xsession", or another file, depending on what you have already installed).

  • sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/Default/Preferences
  • sed -i ‘s/”exit_type”: “Crashed”/”exit_type”: “Normal”/’ ~/.config/chromium/Default/Preferences

For example, with my setup (using Xsession), the procedure would go as follows:

  1. Enter "sudo ~/.Xsession" into the console
  2. Insert the above 2 lines into the file, before Chromium is run (You should see a line starting with "chromium-browser", so insert them above this)
  3. Press ctrl + X to exit the file
  4. Type "Y"
  5. Press enter
  6. Reboot the machine

Again, the file used to start up Chromium may be located in a different location, depending on how you have setup your pi, but after changing these two settings, Chromium should start up without displaying the crashing prompt.

0

To disable the Restore Pages bubble I open chromium twice in the autostart file like this:

chromium-browser --no-startup-window --kiosk
chromium-browser --noerrordialogs --kiosk http://your.url.here

The first one gets the popup bubble but you don't see it, then the second one opens as if browser was closed successfully. Probably not the cleanest way to do this, but it worked for me.

0

The only way that worked for me was to modify the config before starting Chromium:

sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/Default/Preferences

protected by Darth Vader Apr 28 at 7:41

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.