Search code examples
chromiumraspbian

Chromium pop up on Raspbian


I'm running Chromium 16 on a Raspberry Pi 3 with the latest Raspbian. My purpose is to launch a Chromium page in --kiosk mode on start-up.

The Pi will always be shut down by switching the power off, so on start-up Chromium shows the "Chromium didn't shut down properly" pop-up. I need to disable this pop-up. I already looked for a bunch of solutions on the web, especially on this thread: https://superuser.com/questions/873381/how-can-i-disable-the-chromium-didn-t-shut-down-correctly-message-when-my-brow

Sadly, none of these work for me. I also tried to set the permissions for the chromium preferences file to read only, but permissions seem to be restored on boot.

Any ideas?


Solution

  • I was looking for a long time, here is my solution:

    #!/bin/bash
    
    #Set CrProfile to the value of your startup profile's config folder
    CrProfile="Default"
    
    HomeFolder="/home/myhome"
    
    #Set URL to the URL that you want the browser to start with
    URL="http://www.apple.com"
    
    #Delete SingletonLock
    rm -f $HomeFolder/.config/chromium/SingletonLock
    rm -f $HomeFolder/.cache/chromium
    
    #Clean up the randomly-named file(s)
    for i in $HomeFolder/.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
        sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' $i
    done
    
    #Clean up Preferences
    sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' $HomeFolder/.config/chromium/$CrProfile/Preferences
    sed -i 's/"exit_state": "Crashed"/"exit_state": "Normal"/' $HomeFolder/.config/chromium/$CrProfile/Preferences
    sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' $HomeFolder/.config/chromium/$CrProfile/Preferences
    
    #Clean up Local State
    sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' $HomeFolder/.config/chromium/"Local State"
    
    /usr/bin/X11/chromium-browser --no-first-run --kiosk $URL