Chromium autostart Session Restore Pages issue

Hi,
i´m building a small kiosk with a Raspberry pi 3 B+ and Dietpi with the Autostart Option “Chromium - Dedicated use, without desktop”
When the raspi reboots there´s an an annoying bubble that says: Restore pages? I´ve tried some flags on Chromium startup with no luck, then i found this in another forum:

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

Sure is a noob question but, where can i add this lines in DietPi?
Thank you in advance.

Ref: https://github.com/MichaIng/DietPi/issues/2938

Yes you can.

command script to call it all is located in
/var/lib/dietpi/dietpi-software/installed/
chromium-autostart.sh

The line I changed to get the pop-uo to stop is

CHROMIUM_OPTS="--kiosk --test-type --window-size=$RES_X,$RES_Y --incognito --disable-infobars --start-fullscreen --start-maximized --window-position=0,0"
# - If you want tablet mode, uncomment the next line.
#CHROMIUM_OPTS+=' --force-tablet-mode --tablet-ui'

–incognito flag is the one that did it for me

meeki007
As discussed on GitHub, the incognito mode implies disabled cache and some other behaviour that is actually not wanted. However one possibility aside from changing --homepage $URL to --app=$URL which basically overrides the kiosk mode into app mode which again has some other implications.

As discussion on GitHub as well, we will work on some enhanced options for Chromium startup but finally a Chromium command line option to skip reloading the last session in kiosk mode would be great, respectively having this as default since the usual use of kiosk mode is a single website only.

meeki007 mentioned already.
You can put sed scripts on /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh file.

I just put right before CHROMIUM_OPTS, and no more restore page bubble.

...
# - Resolution to use for kiosk mode, should ideally match current system resolution
RES_X=$(grep -m1 '^[[:blank:]]*SOFTWARE_CHROMIUM_RES_X=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
RES_Y=$(grep -m1 '^[[:blank:]]*SOFTWARE_CHROMIUM_RES_Y=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')

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

CHROMIUM_OPTS="--kiosk --window-size=$RES_X,$RES_Y --start-fullscreen --start-maximized --window-position=0,0"
# - If you want tablet mode, uncomment the next line.
#CHROMIUM_OPTS+=' --force-tablet-mode --tablet-ui'
...

Sorry to bump this old thread, but without it I would not have been able to resolve the strange issue/s I was having.

So I thought I should post what the problem was and how this thread helped me, in case anyone comes here looking for the same solution.

So issues I was having.

Odroid C2, with a 7 inch HDMI touch screen, at 1024 x 600
trying to load Chromium into Kiosk mode & full screen.

I could get Chromium to load, after setting the Display options correctly for the HDMI resolution correctly.

But for some reason it didn’t seem like it was Grep’ing the resolution correctly and I was getting the “restore pages” bubble and couldn’t get across the screen to close it.

Also, the Webserver that I am running on that machine takes a few minutes to come up properly. (www.openhab.org if anyone is interested)

So I pasted in the configuration extras above and manually set the X & Y values, as well as adding in a 3 minute sleep period.

It’s all working really well and the real joy is that I can still use the dietpi-autostart >> Chromium Kiosk (11) option to adjust the start page :smiley:

For reference, here is the edited chromium-autostart.sh contents

#!/bin/bash
# Autostart run script for Kiosk mode, based on @AYapejian https://github.com/MichaIng/DietPi/issues/1737#issue-318697621
# - Please see /root/.chromium-browser.init (and /etc/chromium.d/custom_flags) for additional egl/gl init options


## Sleep this script to allow for openHAB2 to fully load
## Sleep 3 minutes

sleep 3m


# Command line switches https://peter.sh/experiments/chromium-command-line-switches/
# --test-type gets rid of some of the chromium warnings that you may or may not care about in kiosk on a LAN
# --pull-to-refresh=1
# --ash-host-window-bounds="400,300"

# - Resolution to use for kiosk mode, should ideally match current system resolution
## Commented out because it just wasn't grabbing the screen size correctly

#	RES_X=$(grep -m1 '^[[:blank:]]*SOFTWARE_CHROMIUM_RES_X=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
#	RES_Y=$(grep -m1 '^[[:blank:]]*SOFTWARE_CHROMIUM_RES_Y=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')





## Manually set window / screen size 

	RES_X=1024
	RES_Y=600

## Added following to remove "Restore Bubble"

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


CHROMIUM_OPTS="--kiosk --test-type --window-size=$RES_X,$RES_Y --start-fullscreen --start-maximized --window-position=0,0"
# - If you want tablet mode, uncomment the next line.
#CHROMIUM_OPTS+=' --force-tablet-mode --tablet-ui'

# - Add URL for first run:
URL=$(grep -m1 '^[[:blank:]]*SOFTWARE_CHROMIUM_AUTOSTART_URL=' /DietPi/dietpi.txt | sed 's/^[^=]*=//')
CHROMIUM_OPTS+=" --homepage $URL"

# Find absolute filepath location of Chromium binary.
FP_CHROMIUM=$(command -v chromium)
if [[ ! $FP_CHROMIUM ]]; then

	# - Assume RPi
	FP_CHROMIUM="$(command -v chromium-browser)"

fi

xinit $FP_CHROMIUM $CHROMIUM_OPTS

Update

I have found out why the X screen for Chromium was being set incorrectly.

The entry at the bottom of

/DietPi/dietpi.txt

was set to something like 1280 whereas the 7 inch screen is 1024 x 600

I couldn’t find anyway in the menus to adjust this, so I edited it in nano.

Next step

So the next things is to work out how to get the 7 inch HDMI touch screen running Chromium in Kiosk mode and the SPI / LCD screen to run a terminal

Hi,

many thanks for feedback and sharing your solution. :slight_smile: