Non-Interactive RPi Kiosk Improvements

I’m just documenting a few things I did to make a non-interactable kiosk a bit more useful.

Hide the cursor

vim /var/lib/dietpi/dietpi-software/installed/

At the very bottom change the line



exec "$STARTX" "$FP_CHROMIUM" $CHROMIUM_OPTS "${URL:-}" -- -nocursor

Set the resolution

I hooked my pi up to a 1080p monitor.

vim /var/lib/dietpi/dietpi-software/installed/

At the top change CHROMIUM_OPTS

CHROMIUM_OPTS="--kiosk ... --window-size=${RES_X:-1920},${RES_Y:-1080}"
vim /boot/dietpi.txt

Change SOFTWARE_CHROMIUM_RES_X and RES_Y to the same resolution.

Adjust chromium kiosk startup arguments.

Add or remove whatever you want.
I didn’t really look into all of these, but there seems to be some recommended consensus on these arguments.
Some I also added.

vim /var/lib/dietpi/dietpi-software/installed/
CHROMIUM_OPTS="--kiosk --no-crash-upload --disable-breakpad --disable-crash-reporter --incognito --disable-translate --no-first-run --fast --fast-start --disable-features=TranslateUI --disk-cache-dir=/dev/null --disk-cache-size=1 --password-store=basic --start-fullscreen --noerrdialogs --disable-infobars --window-size=${RES_X:-1920},${RES_Y:-1080} --window-position=0,0"

Turn off the monitor

I used this to avoid burn-in on my monitor. I have it turn off certain hours every night.
Put this into a .sh script file and run with a cron job run from dietpi’s account.
Set the script to be executable. (I use 755 and group/user to dietpi)
If you run this script and the error is something about “Invalid MIT-MAGIC-COOKIE-1 key”, it means you probably need to run it from root but this should not be necessary.

xset -display :0 s blank
xset -display :0 s reset
xset -display :0 s activate

Turn on the monitor

Also put this into a cron job using dietpi’s account.

xset -display :0 s reset
xset -display :0 s noblank

Check if Chrome is Misbehaving

The purpose of this is because chrome doesn’t know when a page fails to load or there’s some other issue with the page. WARNING: The script below hard codes 7 to be the number of processes I expect to be running at all times with my specific Dakboard webpage I’m displaying. If it’s less than this amount, it will reboot. You need to use htop or something to see how many chromium processes you expect to be running on your kiosk with your specific kiosk webpage. Anything below this amount will cause the raspberry pi to reboot. I did this because sometimes a chromium process or several may crash or fail to load. My kiosk displays a webpage with about 10 chromium processes when it’s working properly. So, for me, if it’s below 7, then I know something is definitely screwed up. If you set this too low, your pi will keep rebooting, so just be careful. It’s hacky I know…

Create a script called “” with (permissions 755, group and owner is dietpi) in the dietpi user directory somewhere with the following contents:

RES=$(ps -aux | grep -c chromium)
if [ "${RES}" -lt 7 ]; then
    sudo shutdown -r now

Setup the crontab

Using the dietpi user, I type in crontab -e to edit the crontab with the following contents:

0 10 * * * sudo shutdown -r now
5 * * * * /home/dietpi/kiosk/
0 1 * * * /home/dietpi/kiosk/
0 9 * * * /home/dietpi/kiosk/
  • 1 am the monitor should shut off. (Added bonus, the cpu usage and temps drop to minimal).
  • 9 am the monitor should turn on.
  • Every 5 minutes it checks to see if chrome is screwed up and reboots the Rpi if it is.
  • 10 am the Rpi will reboot. Chrome leaks memory quite drastically on my Dakboard kiosk page, so a reboot is necessary for me or it will start crashing and doing weird stuff. You may or may not need this.
  • I was able to get away with NOT putting anything in the root’s crontab. So it should be empty.

Final Notes

  • If you update dietpi’s packages, make sure you do a full reboot of the Rpi or the monitor scripts won’t work. Not 100% why.

Thanks for sharing your experiance. One hint, vim did not exist on a standard DietPi system. Usually we use nano :slight_smile:

Really helpfull tips, but when I use the script to turn off the monitor, it turns on automatically again after a few minutes. Do you have any ideas on how to solve this?

Make sure your monitor’s firmware is up to date. I saw this occur on a Dell before.
Switch our your monitor cables. Some cause weird negotiation failures.
I will update the instructions because I did update the scripts on my end but not on this post.

Okay I updated the instructions. I’ve been using this setup for several months now with very little hiccups.

nice instructions, great job !

Does anyone know of a way to restart the Chromium kiosk without rebooting the hardware ?

In the script which starts chromium you could make a while loop which restarts the process automatically when it’s not running. For a restart you just need to kill the process and it will restart afterwards,

here an example:


while true; do
    # start Chromium in kiosk mode
    chromium-browser --kiosk

    # wait until a new attempt is made (optional)
    sleep 5

    # check if chromium process is still running
    if ! pgrep -x "chromium-browser" > /dev/null; then
        echo "restart chromium."
        echo "chromium is still running."


In the original posting is also a script which checks if it crashed and if this is true it restart. Instead of a restart you could execute the script for starting chromium again.

RES=$(ps -aux | grep -c chromium)
if [ "${RES}" -lt 7 ]; then

let me rephrase :
given that Chromium was started with /var/lib/dietpi/dietpi-software/installed/, what would be a good way to stop and restart the browser without rebooting ?

The issue I’m troubleshooting is that the browser goes full white screen after x time.
I will try disabling hardware accelleration, which might help since the device isn’t a RPi but an Odroid XU4.
Meanwhile I’d like to find a workaround, such as relaunching the browser.

If you didn’t have a chance to leave the browser regularly, you would need to connect via SSH and kill the process.

pkill chromium-browse to the rescue.