How can I disable the "Chromium didn’t shut down correctly" message when my browser opens?

15

4

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?

Doktor J

Posted 2015-02-04T03:34:23.127

Reputation: 2 083

Answers

20

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

Steve

Posted 2015-02-04T03:34:23.127

Reputation: 316

Thanks for posting this. Works great with the --kiosk switch. – Dan McDougall – 2016-01-05T14:34:58.763

I don't think --start-fullscreen is needed when using --kiosk. – emc – 2017-02-02T04:00:55.657

--disable-session-crashed-bubble isn't operational as of some point around Chrome 58... feel free to add your two bits to https://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...

– Ben Roberts – 2018-05-07T12:31:13.453

14

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

user2961555

Posted 2015-02-04T03:34:23.127

Reputation: 241

--incognito does work, but it kills cookies, which (in my case) are required – Davide Andrea – 2017-09-30T22:52:51.853

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 – 2018-01-06T02:22:59.673

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

Davide Andrea

Posted 2015-02-04T03:34:23.127

Reputation: 221

Thanks for catching that. I had posted it in the wrong place. I cut it from there, copied here. Fixed. – Davide Andrea – 2017-10-02T00:28:05.197

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. – Davide Andrea – 2017-10-02T00:39:20.713

OK, then, you're fine. – Scott – 2017-10-02T00:41:52.080

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 – 2017-10-02T05:01:19.130

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)

ArkosX

Posted 2015-02-04T03:34:23.127

Reputation: 31

2Please 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 – 2016-05-05T10:45:20.023

Thank you . This is a much simpler solution and worked for my case. – Plazgoth – 2016-11-23T19:30:03.183

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.

Doktor J

Posted 2015-02-04T03:34:23.127

Reputation: 2 083

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 – 2015-02-04T03:35:17.010

I don't appear to have the randomly-named files, but otherwise this helped me. – Roger Lipscombe – 2015-04-09T16:29:03.653

This doesn't seem to work any more; I'm still (occasionally) getting the "Restore pages?" warning. Any ideas? – Roger Lipscombe – 2015-08-17T10:27:52.967

@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 – 2017-02-23T18:36:13.033

1

Just use incognito mode:

chromium-browser --incognito http://www.example.com

Afonso

Posted 2015-02-04T03:34:23.127

Reputation: 11

@Toto how is this a link only answer? I mean, it could use an explanation, but the URL is there as an example. – bertieb – 2018-07-04T16:17:08.440

@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 – 2018-07-04T18:13:10.273