19

I am running Chromium 39 on Ubuntu 14.04, on a single-board computer (ODROID U3, though I believe the question is applicable to Chromium on any Ubuntu system and possibly other Linux distros as well).

The computer is being used with Chromium in kiosk mode to power a large wall display; however, if the system loses power, when Chromium restarts it has the big nag bar complaining that "Chromium didn't shut down correctly". Since the system is designed to be automated, and we intend to run multiple systems, manually remoting into the machine (or worse, running around connecting and disconnecting a USB mouse) is not an acceptable solution.

How can I prevent Chromium from popping up this warning if it gets shut down improperly?

6 Answers 6

24

Much easier solution, start Chromium with the --disable-infobars flag. I tried all of the above before finding it, and it does exactly what I wanted. You can leave all of the other stuff alone.

My specific command line is:

/usr/bin/chromium-browser --start-fullscreen --disable-session-crashed-bubble --disable-infobars http://www.example.com
3
  • Thanks for posting this. Works great with the --kiosk switch. Commented Jan 5, 2016 at 14:34
  • I don't think --start-fullscreen is needed when using --kiosk.
    – emc
    Commented Feb 2, 2017 at 4:00
  • --disable-session-crashed-bubble isn't operational as of some point around Chrome 58... feel free to add your two bits to bugs.chromium.org/p/chromium/issues/detail?id=445256#c17 (which seems to be still be under consideration) to let the Chromium team know that this matters and hopefully have this functionality added back in...
    – B Robster
    Commented May 7, 2018 at 12:31
16

Also, apparently running in incognito mode by default will also prevent the error because nothing is saved from the session against which to check for a crash.

example: chromium-browser --kiosk --start-maximized --incognito kiosk.html

2
  • --incognito does work, but it kills cookies, which (in my case) are required Commented Sep 30, 2017 at 22:52
  • This worked well for me. I could not get the above --disable-infobars or --disable-session-crashed solution above to work for me.
    – Nate Dudek
    Commented Jan 6, 2018 at 2:22
5

This finally worked for me, and it's pretty simple:

  1. Shut down Chromium gracefully
  2. Change the "Change content" permissions of ~/.config/chromium/Default/Preferences to "Nobody"

That will lock the state of two variables, regardless of how Chromium was shut down:

  • "exit_type": "Normal"
  • "exited_cleanly": true

Of course, only do that after you're done setting preferences

4
  • Thanks for catching that. I had posted it in the wrong place. I cut it from there, copied here. Fixed. Commented Oct 2, 2017 at 0:28
  • Yes, I wrote it. I wrote in the wrong browser tab (different question). When I noticed, I cut it from there (so the original no longer exists) and I pasted it in the tab with this question, the correct place. I am really sorry for having caused all this confusion, and I thank you for catching my pasting mistake. Commented Oct 2, 2017 at 0:39
  • OK, then, you're fine. Commented Oct 2, 2017 at 0:41
  • 2
    Please do not post the same answer to multiple questions. If the same information really answers both questions, then one question (usually the newer one) should be closed as a duplicate of the other. You can indicate this by voting to close it as a duplicate or, if you don't have enough reputation for that, raise a flag to indicate that it's a duplicate. Otherwise tailor your answer to this question and don't just paste the same answer in multiple places.
    – DavidPostill
    Commented Oct 2, 2017 at 5:01
3

Solution/Hack in 5 seconds (https://askubuntu.com/a/720855) Settings->Advanced Settings->System-> uncheck Continue running background apps when Chrome is closed

(read the whole thread for hints on why the issue happens. Makes a lot of sense)

2
  • 2
    Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.
    – DavidPostill
    Commented May 5, 2016 at 10:45
  • Thank you . This is a much simpler solution and worked for my case.
    – Plazgoth
    Commented Nov 23, 2016 at 19:30
3

Just use incognito mode:

chromium-browser --incognito http://www.example.com
3
  • @Toto how is this a link only answer? I mean, it could use an explanation, but the URL is there as an example.
    – bertieb
    Commented Jul 4, 2018 at 16:17
  • @bertieb: Without explanation I consider this as a link only because the only thing I see is a link, but after reread it, it seems a very low quality post. I just keep the last part of my comment: Can you elaborate on this a little more?
    – Toto
    Commented Jul 4, 2018 at 18:13
  • This is a great post - the only one which worked for me.
    – Marc
    Commented Mar 12, 2020 at 6:42
2

Chromium version 39 (on Ubuntu at least) tracks the browser's exit state in three separate files:

  • ~/.config/chromium/"Profile 1"/Preferences
  • ~/.config/chromium/"Profile 1"/.org.chromium.Chromium.XXXXXX
  • ~/.config/chromium/"Local State"

Where "XXXXXX" is a six-digit random alphanumeric string. Note also that "Profile 1" may be named differently based on what browser profile you are using (another common profile name is simply "Default")

The two profile-based files have two entries that can trigger the message, "exit_state" (values are either "Normal" or "Crashed", with quotes) and "exited_cleanly" (values are either true or false, without quotes).

The "Local State" file only contains the "exited_cleanly" entry.

There is also a "lock" file that may cause trouble; this file is located at

  • ~/.config/chromium/SingletonLock

You can write a script that uses sed and rm to correct these before launching Chromium

#!/bin/bash

#Set CrProfile to the value of your startup profile's config folder
CrProfile="Profile 1"

#Set URL to the URL that you want the browser to start with
URL="http://www.example.com"

#Clean up the randomly-named file(s)
for i in $HOME/.config/chromium/$CrProfile/.org.chromium.Chromium.*; do
    sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' $i
    sed -i 's/"exit_state": "Crashed"/"exit_state": "Normal"/' $i
done

#Clean up Preferences
sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' $HOME/.config/chromium/$CrProfile/Preferences
sed -i 's/"exit_state": "Crashed"/"exit_state": "Normal"/' $HOME/.config/chromium/$CrProfile/Preferences

#Clean up Local State
sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' $HOME/.config/chromium/"Local State"

#Delete SingletonLock
rm -f $HOME/.config/chromium/SingletonLock

/usr/bin/X11/chromium-browser --kiosk $URL

Note that for ideal usage, Chromium's preferences should be set to start with a new tab, rather than a specific URL or restoring a session; this will ensure that it starts with the specified URL and nothing else.

4
  • Please note that I rewrote the script from memory (with the help of notes reminding me where the files were located); if anyone spots any glaring syntax errors or the like please feel free to edit or point it out in comments.
    – Doktor J
    Commented Feb 4, 2015 at 3:35
  • I don't appear to have the randomly-named files, but otherwise this helped me. Commented Apr 9, 2015 at 16:29
  • This doesn't seem to work any more; I'm still (occasionally) getting the "Restore pages?" warning. Any ideas? Commented Aug 17, 2015 at 10:27
  • @RogerLipscombe if you're still having this problem, see Steve's answer above (which I've marked as accepted because it seems to do the trick on my test unit). Hope it helps!
    – Doktor J
    Commented Feb 23, 2017 at 18:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .