A minimal kiosk mode for a Raspberry Pi
Monday, 20 January 2020
2 min read
When I was making my Smart mirror I made a webapp to run on the Raspberry Pi hidden behind the frame. From all the tutorials I saw, they reccomended using a full instillation of the Raspbian desktop, then installing chrome, then hacking away at it. I didn't like this.
I felt this was a waste as all I wanted was to run chrome. I didn't need a window manager, or any of the countless pre-installed apps that come with raspbian. I wanted a minimal footprint on the pi, with hopefully only chrome. This means less to manage and a smaller security footprint.
Then I found this blog post, which promised to do all of that.
Start with Raspbian Lite (not the desktop version). Then install the packages required to run chromium and set the pi to boot straight into to the console.
sudo apt-get update -qq
sudo apt-get install --no-install-recommends xserver-xorg-video-all \
xserver-xorg-input-all xserver-xorg-core xinit x11-xserver-utils \
# Go to: Boot Options > Console Autologin
/home/pi/.bash_profile to automatically start the gui.
There's a check for the bash context first,
so you don't accidentally start chromium whenever you ssh in.
if [ -z $DISPLAY ] && [ $(tty) = /dev/tty1 ]
The last bit is to setup
/home/pi/.xinitrc to run chromium whenever you run startx.
Here's the full list of chromium arguments.
xset s off
xset s noblank
chromium-browser https://yourfancywebsite.com \
It disables the cursor and screensaver.
Then runs chromium with *all* of the flags.
https://yourfancywebsite.com to the website which you want to display.
--window-size to the size of your display (it's horizontal first and vertical after the comma).
You may also want to uncomment
/boot/config.txtso that the pi boots up using the full display.
Now whenever the pi boots up it'll go into the console then on into chromium.
If you want to exit you can hit
Alt+F4, then enter
startx to start up the browser again.