32

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.

Paul Karvetski
  • 341
  • 1
  • 3
  • 4

9 Answers9

38

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

For example:

chromium-browser --kiosk --app=http://your.url.here
Greenonline
  • 2,969
  • 5
  • 27
  • 38
Fabiano Cores
  • 481
  • 4
  • 2
10

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 nano ~/.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.

Greenonline
  • 2,969
  • 5
  • 27
  • 38
Wincruzer
  • 101
  • 1
  • 4
6

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

Nigel Pearson
  • 61
  • 1
  • 2
6

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.

Aurora0001
  • 6,357
  • 3
  • 25
  • 39
3

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.

MD004
  • 103
  • 3
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.

MatsK
  • 2,882
  • 3
  • 17
  • 22
Paul Karvetski
  • 341
  • 1
  • 3
  • 4
2

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.

Aurora0001
  • 6,357
  • 3
  • 25
  • 39
2

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
Mikey
  • 21
  • 1
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.

Bryan
  • 341
  • 1
  • 2
  • 8