Disable Session Restore altogether (RPi3 Raspian Jessie)

814 views
Skip to first unread message

Michael Schulz

unread,
Aug 22, 2016, 4:37:26 PM8/22/16
to Chromium-dev
Is it possible to disable this altogether or somehow make it so chromium-browser thinks it's a fresh session no matter what?

I've tried a couple things: 

- Have a bash script replace the 'exit_type' Crashed to Normal in ~/.config/chromium/Default/Preferences
- Have the autostart file ( at both /autostart and /etc/rc.local) copy a premade 'Preferences' file with the changed exit_type/state from a self made folder in ~/chromiumprefs/Preferences over and replace the one in ~/.config/chromium/Default/Preferences
- Multiple flags on @chromium-browser but while they get rid of the windows/bars they don't change the state, which is the important thing.

What i'm trying to do:

Raspberry Pi3 Raspian Jessie based kiosk that boots into chromium and opens up 2 pre-set tabs that are set in 'Open these tabs on launch' as well as in an extension called 'Revolver' that rotates the tabs every X seconds. The restore state is stopping the tabs from opening and the extension to revolve. One of the tabs is simply chrome://newtab with an extension that creates a nice clock and weather page, very kiosky so it works perfectly. The other is a google calendar.

Any suggestions on how to always have chrome start as a 'Normal' session even if the power is pulled from the rpi or it goes through sudo reboot? I'm at my wits end to the point I might as well just do some sort of auto-hotkey macro that opens chrome once, clicks restore and starts the extension.

Scott Violet

unread,
Aug 22, 2016, 6:20:58 PM8/22/16
to mtsch...@gmail.com, Chromium-dev
It sounds like you always want to have chromium start in a particular
state. If that's the case, I would configure chrome in the state you
want, exit, and copy the preferences and other files off. Before
launching chrome restore these files, then start chrome. This way
every time you launch chrome you get the exact same initial state.
This should work.

-Scott
> --
> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev

Michael Schulz

unread,
Aug 22, 2016, 7:04:09 PM8/22/16
to Chromium-dev, mtsch...@gmail.com
That's actually exactly what i'm doing! But it's still not working, it's still having exit_type be reset to 'Crashed' instead of the 'normal'

I've got this line in /etc/rc.local and i've tried the same thing in the jessie lxde autostart file : cp -f ~/chromiumprefs/Preferences ~/.config/chromium/Default/Preferences

Which copies a copy of Preferences with 'Normal' set as the exit type and true as the exit_state, I then have @chromium-browser --kiosk in  ~/.config/lxsession/LXDE-pi/autostart

i've tried with that file replacement line in the autostart as well to no avail. Do you happen to know when the Preferences file gets written? Maybe the replace is happening too early?

Scott Violet

unread,
Aug 22, 2016, 7:12:36 PM8/22/16
to mtsch...@gmail.com, Chromium-dev
If the exit_type is Crashed, that indicates you copied the file while
chrome was running. Make sure you make the copy while chrome is not
running.

-Scott

Michael Schulz

unread,
Aug 23, 2016, 5:39:59 AM8/23/16
to Chromium-dev, mtsch...@gmail.com
That's what I figured, but I'm guessing my rc.local isn't having the file copy over fast enough? Would you suggest having the file copy at boot then use chron to schedule the boot of chromium-browser for a few seconds later?

Lei Zhang

unread,
Aug 23, 2016, 1:06:35 PM8/23/16
to mtsch...@gmail.com, Chromium-dev
Possibly. if you are still in the middle of creating a Chromium
profile and launching Chromium at the same time, expect race
conditions. Please note configuring your Linux machine's boot sequence
is getting a bit off-topic for chromium-dev.

Scott Hess

unread,
Aug 23, 2016, 2:28:15 PM8/23/16
to mtsch...@gmail.com, Chromium-dev
[Different Scott, here] I think you took Scott's point the wrong way.
You should setup Chromium like you want, then quit Chromium, and make
sure that there are no Chromium processes running, *then* copy out
your canonical user data directory. Chromium puts state in there
which basically says "Chromium crashed", which it removes as part of
shutdown. So if you make the canonical copy while any Chromium
processes are running, then when you launch it will think it crashed.

Obviously when you copy over the canonical data, you should do that
before starting Chromium. Also, you should use something like rsync
-a, so that you don't create a union of old and new data.

-scott

Michael Schulz

unread,
Aug 23, 2016, 3:11:56 PM8/23/16
to Chromium-dev, mtsch...@gmail.com
Ah I see, are you suggesting copying the entire /Default/ directory? As of now i've been going for just the Preferences file. Starting to think that Crash Reports and maybe cache could play a part?

Your last bit is currently my issue, i've tried using sleep and chron in scripts to to swap the (Premade, Crashed state changed to Normal) Preferences file before chromium-browser is autorun 10 seconds later with no success, but i'll give the entire Default directory a shot for sure.

Appreciate this isn't entirely a support forum for chromium and even less so for RPi and debian, so thanks all.

Scott Hess

unread,
Aug 23, 2016, 3:21:14 PM8/23/16
to mtsch...@gmail.com, Chromium-dev
There are some things you might want to copy, some things you might
not want to copy, it's complicated. But, realistically, for a kiosk
setup, it probably doesn't matter, you probably just want to set it up
as you want it, quit completely, then use that as your canonical
version.

Not sure where you're going with using cron and sleep and stuff. Just
write a launcher script something like:

cat >chromium_launcher <<EOF
#!/bin/sh

rsync -a /path/to/canonical/Default/../ /path/to/real/
exec /path/to/chromium --user-data-dir=/path/to/real/
EOF
chmod +X chromium_launcher

Then launch chromium_launcher instead of chromium. That way the data
is always copied beforehand. Or put it all in a loop so that it
restarts fresh every time things crash or exit.

-scott
Reply all
Reply to author
Forward
0 new messages