Launch Chromium in Kiosk Mode on Raspberry Pi OS Lite
This document provides instructions to configure a Raspberry Pi running Raspberry Pi OS Lite (without a desktop environment) to automatically launch Chromium in kiosk mode and display a specified URL on system startup.
1. Start Raspberry Pi OS Lite
Start from a clean installation of Raspberry Pi OS Lite.
Ensure SSH is enabled so you can connect remotely if needed.
2. Update and Install Required Packages
Update the system package list, upgrade existing packages, and install the required components:
sudo apt update
sudo apt upgrade -y
sudo apt install -y chromium-browser xserver-xorg x11-xserver-utils xinit openbox
3. Create Kiosk Launch Script
Create a script to launch Chromium in kiosk mode.
sudo nano /home/pi/kiosk.sh
Add the following contents (replace the URL as needed):
#!/bin/bash
xset s off
xset s noblank
xset -dpms
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
/usr/bin/chromium-browser --noerrdialogs --disable-infobars --kiosk https://google.com
Make the script executable:
sudo chmod +x /home/pi/kiosk.sh
4. Configure Openbox
Create the Openbox configuration directory and autostart file:
mkdir -p ~/.config/openbox
nano ~/.config/openbox/autostart
Add the following line:
~/kiosk.sh &
5. Configure X Session
Create or edit the .xinitrc file to define the session startup command:
nano ~/.xinitrc
Add:
exec openbox-session
6. Configure Automatic Start on Login
Edit the .bash_profile file:
nano ~/.bash_profile
Add this line at the end:
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor
7. Enable Automatic Login
Run Raspberry Pi configuration tool:
sudo raspi-config
Navigate to: System Options → Boot / Auto Login → Console Autologin
Then exit and reboot:
sudo reboot
8. Configure Wi-Fi Network
Use nmtui to add or edit wireless connections:
sudo nmtui
Select Add a New Network and complete the setup.
9. [Optional] Remove Old Wi-Fi Configurations
NetworkManager stores connection profiles in: /etc/NetworkManager/system-connections/
Each saved network is stored as a separate file named after the SSID or a UUID.