Disable Session Restore Message in Chromium for Raspberry Pi

chromium + raspberry pi

I was using Raspberry Pi’s as a digital signage solution. I had a network of Pi’s that would simply point to a website displaying a slideshow. I set up each Pi to automatically open Chromium browser to that website on boot. It’s a great solution because its so simple and has the added benefit of consuming very little electricity, since its running on a Raspberry Pi.

A huge issue I ran into though, was when there was a power outage, or if the Raspberry Pi was improperly shut off, Chromium would open with a little pop-up bubble saying: Chromium did not shutdown properly. Do you want to restore your session? The only way to get rid of it was to plug in a mouse to the Raspberry Pi and dismiss the message. Not ideal if you are planning to manage multiple digital signs this way, and it looks kind of unprofessional.

chrome restore bubble

I spent days trying to find a fix. There were plenty of solutions on various forums and websites, but they were all outdated and no longer worked on recent versions of Chromium.

Through my research I narrowed down the cause of this problem to the chromium preferences file, found in this directory:


There are two variables in that file that let Chromium know on startup whether or not it shutdown correctly.

We want to make sure that exit type is set to Normal and that exited cleanly is set to true.

So let’s look at this file and make sure these values are set correctly. To do this from the command line, we will open the Preferences file in Nano, which is a very basic command line text editor. Type the following into the terminal:

sudo nano /home/pi/.config/chromium/Default/Preferences

This will open Chromiums Preferences file in the terminal.

We need to find the two values to make sure they are correct. You can either scroll to the right with the arrow keys on your keyboard, or if you type ctrl+w on your keyboard it will open up nano’s search function. Then you can search for the word ‘exited’ and find the two variables.

Depending on how chromium shut down the last time you had it open, these values may already be correct. They should look like this:

terminal screenshot

If this line of text looks correct, exit the nano editor with ctrl+x on your keyboard.

Nano will ask you if you want to save the changes. Type in ‘y’ for yes and hit enter. This will save and take you back to the terminal.

Now we have our Preferences file set correctly, but as soon as Chromium crashes it will change these values and we will get the dreaded popups.

So what we need to do is make a copy of the Preferences file that we just edited with the proper settings. Then we will write a bash script to replace Chromium’s preferences file with our good copy each time the Raspberry Pi boots up.

First create a directory (folder) to store our copy. From the terminal, type:

mkdir /home/pi/chromium_prefs

Then copy our updated Preferences file into this new directory. Type the following command:

cp /home/pi/.config/chromium/Default/Preferences /home/pi/chromium_prefs

This is using the linux cp (copy) command, which takes two parameters, the path to the file we want to copy and the path to the folder we want to copy it too.

Now we just need to create the bash script to copy our Preferences file over Chromium’s version everytime the Raspberry Pi starts up.

We are going to use the nano editor again:

sudo nano start.sh

This creates a blank file and opens it in nano.

Let’s write our script. It should look like this:


cp /home/pi/chromium_prefs/Preferences /home/pi/.config/chromium/Default
chromium-browser --kiosk

The first line is just the standard header for bash scripts.

The next line is where we are copying our Preferences file and replacing the one in Chromium’s Default folder.

The last line actually launches Chromium in kiosk mode.

The final thing we have to do is tell the Raspberry Pi to run this script on start up.

Type the following in the command line:

sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart

Then add this line to the bottom of the autostart file.

@sh /home/pi/start.sh

That’s it! You can test this out by having Chromium open when shutting down your Raspberry Pi, and then booting it back up to see if you get the System Restore message.

It really shouldn’t be this difficult, as Chromium on a Raspberry Pi seems to be a popular solution for digital signage. But even though it takes a little effort, this solution works fine and I’ve used it for multiple digital signs. I hope this can help someone else.

16 comments on “Disable Session Restore Message in Chromium for Raspberry Pi

  1. Thanks for this! I search for a while and tried every different combination of solutions, none of which worked for me. You’re right it shouldn’t be this hard.

    One note: you’re missing a space in your bash script between copy and the first dir.
    should be
    cp /home/pi/chromi…

  2. Hi,
    Thank you for this, it’s my first time using a Raspberry Pi and this is the first solution to work for me with this problem!

    One thing though, I think there’s supposed to be a space in the bash script for the CP commend?

    cp/home/pi/chromium_prefs/Preferences /home/pi/.config/chromium/Default
    chromium-browser –kiosk”

  3. Hi,
    I found this article to be very useful, except there’s a small typo in the script.

    You’ve wrote “cp/home/pi/chromium_prefs/Preferences”
    However, there should be a space between cp and /home/ otherwise the script doesn’t run, so I was still getting the restore message!

    After adding the space it ran fine.

  4. Very helpful, thank you for this.

    I set it up like this on 2 pi’s, but when doing exactly the same thing on the 3rd pi, everytime i restart i get a “your preferences file is corrupt or invalid” error from chromium… strange..

  5. A shorter way as long as “Crashed” is only in that file once.

    Add this instead of the cp line in autostart

    #Search chromium Preferences replacing Crashed with Normal
    sed -i ‘s/Crashed/Normal/g’ ~/.config/chromium/Default/Preferences

  6. You can also avoid the bubble message easily by launching in app mode:
    chromium-browser –app=https://your-web.app

  7. Fantastic – there should simply be a –disable -recovery flag for launching chromium – this simple solution has worked great for my needs.

    Thanks for your time and for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *