Raspberry Pi Kiosk with Chromium

This tutorial will guide you through creating a web Kiosk on the Raspberry Pi. We will utilize Chromium- one of the best-supported browsers on the Raspberry Pi.

Kiosk Configuration

The first thing we need to do is remove some packages to free up some memory and reduce the total number of packages that need to be updated when updating software on the Pi.

sudo apt-get purge wolfram-engine scratch scratch2 nuscratch sonic-pi idle3 -y
sudo apt-get purge smartsim java-common minecraft-pi libreoffice* -y

Let’s remove unnecessary packages from the Pi and run some cleanup commands

sudo apt-get clean
sudo apt-get autoremove -y

Let’s make sure the Raspberry Pi is up to date.

sudo apt-get update
sudo apt-get upgrade

Install the following packages:

sudo apt-get install unclutter sed

Let’s set up Raspbian auto login to the Pi user, we don’t want to have to manually login to the Pi every time it reboots. Desktop autologin is the default behavior but if you changed it, here are the steps to change it back.

A. Run the following command

sudo raspi-config

B. Now within the tool go to 3 Boot Options -> B1 Desktop / CLI -> B4 Desktop Autologin

C: Now that we have enabled desktop autologin we need to go ahead and write our kiosk.sh script.

Kiosk Script Configuration

We are going to create a script that will configure Chromium browser to act as a kiosk. Let’s create the script:

nano /home/pi/kiosk.sh

Add the following lines:

xset s noblank
xset s off
xset -dpms

The first line defines what the command line interpreter (CLI) should use to try and execute the file. The next three lines help stop the RPI display power management system from blanking out the screen. The three commands set the current xsession to not blank out the screensaver and disables it altogether. The last line disables the entire display power management system.

unclutter -idle 0.5 -root &

The line runs the program we installed earlier called unclutter. This app will hide the mouse from the display whenever it has been idle for longer than 0.5 seconds.

sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/pi/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /home/pi/.config/chromium/Default/Preferences

The last two lines use sed to search through the Chromium preferences file and clear out any flags that would make a warning bar appear: you don’t want any warnings to pop up on a kiosk.

/usr/bin/chromium-browser --noerrdialogs --disable-infobars --kiosk https://techlikethis.com &

The line above launches Chromium with out parameters. Once you configure the script, it should look like the script below:

xset s noblank
xset s off
xset -dpms

unclutter -idle 0.5 -root &

sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/pi/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /home/pi/.config/chromium/Default/Preferences

/usr/bin/chromium-browser --noerrdialogs --disable-infobars --kiosk https://techlikethis.com https://google.com &

while true; do
   xdotool keydown ctrl+r; xdotool keyup ctrl+r;
   sleep 10

The last bit of code (xdotool) allows you to simulate keystrokes. This is useful for scripting an automatic refresh, the code in the script above refreshes the page every 10 seconds

Kiosk Autoboot

Let’s modify the lxsession autostart script:

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart


@xscreensaver -no-splash

Replace with:

#@xscreensaver -no-splash

Add the following line to the bottom of the file:

@bash /home/pi/kiosk.sh

The file should look like this:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
#@xscreensaver -no-splash
@bash /home/pi/kiosk.sh

Restart the Raspberry Pi

sudo reboot

The Kiosk should autoboot. If you ever need to stop the script from running, you can utilize the following command:

sudo killall kiosk.sh


  1. Doesn’t even begin to work.

    pi@raspberrypi:~ $ ./kiosk.sh
    xset: unable to open display “”
    xset: unable to open display “”
    xset: unable to open display “”
    unclutter: could not open display
    sed: no input files
    /home/pi/.config/chromium/Default/Preferences: line 1: account_id_migration_state:2: command not found
    pi@raspberrypi:~ $ [944:944:0322/121351.917349:ERROR:browser_main_loop.cc(595)] Failed to put Xlib into threaded mode.

Leave a Reply

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