User Tools

Site Tools


kioskchromium

Run a RaspberryPi with Chromium in kiosk mode

The RaspberryPi is a perfect device for just being attached to a monitor, let it automatically boot into X and let automatically start a browser with a selfupdating news or status page.

Here is decribed, how the Pi with the currenty Raspian “Jessie” is setup to have a RaspberryPi being up an running in so called kiosk mode, so without mouse or any other controls just a status monitor.

Preparation

Preparation is as usual and common as for nearly all how-tos, installation of current Jessie Raspian image is required. All packages need to be up-to-date:

sudo apt-get update; sudo apt-get dist-upgrade

Don't use the lite image, as X is required with many additional packages. It would be possible to go the lite-way, but would require quite some further installations including X.

When installed, ensure letting the Pi boot and login as user 'pi' into X or LXDE in this case by using sudo raspi-config.

BTW: Remove the wolfram engine, as it frees over 600MB of storage on the SD card and is usually not used/needed:

sudo apt-get remove wolfram-engine

Install Chromium

When trying to install chromium, it's not that easy anymore as there is today no “chromium-browser” package prepared and existing. But it's quite easy to just pick the last stable working version from Ubuntu universe and use the ARM-builds as they are provided in the web here:
http://ports.ubuntu.com/pool/universe/c/chromium-browser/.

I first tried chromium >=v49, but there are too many too new libraries dependent which are not part of the current raspian jessie, so I finally installed v48.0.2564.82 successfully. I would guess each v48 should be valid and easy to install.

So first download the relevant files from ubuntu:

wget http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-browser_48.0.2564.82-0ubuntu0.15.04.1.1193_armhf.deb
wget http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-browser-l10n_48.0.2564.82-0ubuntu0.15.04.1.1193_all.deb
wget http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_48.0.2564.82-0ubuntu0.15.04.1.1193_armhf.deb

If this is successfully done, these files have to be installed manually:

sudo dpkg -i chromium-codecs-ffmpeg-extra_48.0.2564.82-0ubuntu0.15.04.1.1193_armhf.deb
sudo dpkg -i chromium-browser-l10n_48.0.2564.82-0ubuntu0.15.04.1.1193_all.deb chromium-browser_48.0.2564.82-0ubuntu0.15.04.1.1193_armhf.deb

Already now chromium should be installed and useable, give it a try by calling chromium-browser in an X-Terminal.

Create autostart conditions/script

So when booting the Pi right now, it logs in as user “pi” into LXDE but nothing further happens. In former installations it was quite easy to just modify /etc/xdg/lxsession/LXDE/autostart, but this is not working anymore since jessie, it's also not working to edit /etc/xdg/lxsession/LXDE-pi/autostart instead; but there is another quite flexible way to let applications start automatically after a sucessful login by just adding a link in the autostart folder.

Create a new folder autostart in /home/pi/.config/ if not yet existing.

As a next step an autostart “link” has to be created as it would also be seen on a desktop as an icon/app to click, here it's called /home/pi/.config/autostart/AutostartChromium.desktop. The content of this file is pointing to a bash script, which is executing all neccessary commands:

AutostartChromium.desktop
[Desktop Entry]
Type=Application
Exec=/home/pi/chromium-autostart-script.sh
Terminal=false
Hidden=false
X-GNOME-Autostart-enabled=true
Name[de_DE]=Autostart meine Lieblingsseite mit Chromium
Name[en_US]=Autostart my favorite website with Chromium
Name=Autostart my favorite website with Chromium
Comment=Start Chromium when X starts with my favorite website

The most important row here is Exec=/home/pi/chromium-autostart-script.sh, which is pointing to the script being called and starting chromium with all neccessary params and former preparation in kiosk mode.

Create chromium autostart script

The following script is created in /home/pi/chromium-autostart-script.sh in order to prepare the current X-Session with relevant params and run chromium in kiosk mode and ensure, no surprising error messages will raise:

chromium-autostart-script.sh
#!/bin/bash
echo "Starting Chromium in kiosk mode..."
xset s off
xset -dpms
xset s noblank
 
/usr/bin/chromium-browser --noerrdialogs --disable-session-crashed-bubble --disable-infobars --allow-cross-origin-auth-prompt --kiosk --incognito http://<URL-to-my-website-to-be-opened>

BTW: In my case the opened website requires different http-authentications (like http://someone:somepassword@www.some-auth-page.de/somewhere/) and for beeing able to access them all, it's sooooo important to add –allow-cross-origin-auth-prompt as a param when opening chromium!

Finding more useful possible params, which can be used with chromium, can be found here: http://peter.sh/experiments/chromium-command-line-switches/.

Ensure no mouse is visible and screensaver is deactivated

Finally everything should be fine so far, but if there is still the mouse in the middle of the screen it can easily be removed by installing unclutter, which is ensuring to remove the pointer, if it's not moved for a while. The apt description says “unclutter - hides the mouse cursor in X after a period of inactivity”, so this can be installed by entering:

sudo apt-get install unclutter

While testing, the screensaver still might be activated after some time. This can be deactviated by searching in the file /etc/lightdm/lightdm.conf for xserver-command and uncomment or better add a new row below with following content:

[...]
xserver-command=X -s 0 dpms
[...]

Now everything should be done, reboot the Pi and see X start and chromium to be opened in kiosk mode with the given URL.

Thinking further

Libre Office Presentation

Not beeing part of this how-to but also possible could be to run a presenation instead of a website aka chromium. When having libre office installed (sudo apt-get install libreoffice libreoffice-l10n-de), there is also the chance of running a presentation in a loop, just call:

libreoffice --nologo --norestore -show /home/pi/myDemoPresentation.odp''


Turning HDMI screen 90°

Having the screen turned 90° might also be an option for a status monitor, therefore just add the config-command display_rotate=1 to turn screen in /boot/config.txt and if it's HDMI, force the screen always to be the HDMI screen by adding hdmi_force_hotplug=1.

kioskchromium.txt · Last modified: 29.03.2016 00:00 by andreas