Hardware: Raspberry Pi - Dashboard (Kiosk)

From Luky-Wiki
Jump to: navigation, search

Do You have spare RPi and big monitor / TV ? If yes then let's try to build dashboard. There are several ways how to get "data" on screen. Most common is to use browser to do all rendering and remote connections. This article describe configuration using browser. Browser needs X11 subsystem and there are several ways how to start X11 + browser. I selected two most common options.

Base OS

I recommend Rasbian installed using unattended installer. Keyboard is not necessary to perform installation and re-instillation. This article describe re-installation but with small modification you can use it also durring initial installation. Raspbian UA installer can be obtained from release page or homepage.

Step 1

Clean /boot and replace it with UA installer.

cd /root
wget https://github.com/debian-pi/raspbian-ua-netinst/releases/download/v1.0.8.1/raspbian-ua-netinst-v1.0.8.1.zip

cd /boot
rm -rf *

unzip /root/raspbian-ua-netinst-v1.0.8.1.zip

Step 2

Configure root file system type and hostname / domain. Edit /boot/installer-config.txt and insert following lines:


Alter hostname / domainname to fit your installation. Root password stay visible in this configuration file after installation. I recommend do leave it as is here and change it later.

Step 3

Start installation:

cd /
umount /boot

reboot -f

For more details review Raspbian UA installer documentation. After installation log-in using ssh and user: root / password: root"

OS configuration

Initial config

UA installer install only minimum packages and configuration files. It is necessary to "customize" system upon first log-in.


dpkg-reconfigure locales


dpkg-reconfigure tzdata

root password:


Base packages installation

Minimum set of tools:

apt-get install raspi-config btrfs-tools apt-utils

Note: separate installation of "apt-utils" will speed up installation of packages later

System tools (may help to diagnose problems):

apt-get install screen htop nload git-core traceroute mc ddrescue rsync vim pydf lsof psmisc unzip util-linux collectl

HDMI port configuration

I highly recommend to disable overscan and properly configure connected TV / Monitor. It is necessary to switch TV aspect to "1:1", "Just", "16:9", "PC" or other mode (depending on vendor) to get 1:1 pixel mapping. Screen may be blurry without this configuration.

Overscan can be disabled by editing /boot/config.txt. Add following line:


It may be neccesary to tweak it a bit more (depending on age of TV). Check RPiconfig for more details. Configuration is loaded on next reboot.

Network Time

If You don't like default NTP configuration and/or RPi can't be auto-configured (via DHCP) then configure NTP manually. Here is example how to do this configuration:

NTP daemon should be installed but to be sure:

apt-get install ntp

Then edit /etc/ntp.conf. I am using following configuration:

# Name of the servers ntpd should sync with

server ntp-server1
server ntp-server2

# local failback in case of network failure

# you should not need to modify the following paths
driftfile		/var/lib/ntp/ntp.drift
logfile			/var/log/ntp.log

# restriction config 
restrict default	nomodify notrap nopeer noquery
restrict	nomodify notrap nopeer


Note: replace ntp-server1 and ntp-server2 with local ntp servers

Restart NTP to load new configuration:

/etc/init.d/ntp restart

Verify configuration using following command. It may take some time before NTP protocol settle down.

ntpq -p

Root Password + accounts

If You don't changed root password yet, then I recommend to do it now:

passwd root

Add user account(s):

useradd --create-home --shell /bin/bash lukas
passwd lukas

Replace "lukas" with your preferred name :o)

Add dashboard user:

useradd --create-home --shell /bin/bash dashboard

(optional) Migrate system to subvolume

One of great benefits of BTRFS is ability to take snapshots. It is necessary to have system in subvolume in order to utilize all its features. Here is step by step guide how to migrate system into subvolume.

Configure boot subvolume. Edit /boot/cmdline.txt and add following to end of line:


Edit /etc/fstab and modify definition for / to looks like:

/dev/mmcblk0p2	/ 	btrfs 	noatime,subvol=system	0 0

Add entry point for btrfs system. Edit /etc/fstab and add following line:

/dev/mmcblk0p2	/btrfs 	btrfs 	noatime,subvolid=0	0 0

Create mountpoint and try to mount btrfs entry point:

mkdir /btrfs
chmod 0 /btrfs
mount /btrfs

Create subvolume by using snapshot feature:

btrfs sub snap / /system

Create file that indicate successful boot from subvolume and reboot system:

touch /system/boot_ok.txt

shutdown -r now

After reboot check if boot_ok.txt is directly in /. If yes then proceed with clenaup of /btrfs. There should remain only "system" subvolume / directory.

Option 1 -> Browser started using display manager

Required packages (Op1)

Following packages are required:

apt-get install midori unclutter x11-xserver-utils lightdm lxde

Note: unclutter will make sure that mouse pointer is hidden while input is idle.

Configuration (Op1)

Automatic cleanup. This will ensure that there will be no data left over from previous run of system / browser. Edit /etc/rc.local and add:

find /home/dashboard/ -mindepth 1 -delete

LightDM configuration. Edit /etc/lightdm/lightdm.conf and replace it with:

xserver-command=/usr/bin/X -s 0 -dpms

Edit /etc/xdg/lxsession/LXDE/autostart and replace it with:

@xset -dpms
@xset s off
@midori -e Fullscreen -a http://example.com/dashboard

Issue reboot (shutdown -r now). System should boot-up directly to browser / dashboard.

Pros / Cons (Op1)

  • Pros:
    • Relatively quick configuration
    • Only minor adjustment of system and/or pre-build image is necessary.
  • Cons:
    • Size -> full LXDE installation
    • No automatic restart capability in case of browser failure

Option 2 -> Browser started using init

Required packages (Op2)

Following packages are required:

apt-get install midori unclutter x11-xserver-utils xinit lwm

Note: unclutter will make sure that mouse pointed is hidden while input is idle.

Configuration (Op2)

Default security may be too strict to start X11 server from user account. Therefore it is necessary to tweak it a bit. Execute following command and select "Anybody" from menu:

dpkg-reconfigure x11-common

It is possible to do same by editing /etc/X11/Xwrapper.config but is not recommended.

This idea use one specific script that handle startup of dashboard. Create /usr/local/bin/dashboard-start.sh with following content:


exec >> /var/log/dashboard.log 2>&1

LANG=C date

echo Cleaning homedir ...
find /home/dashboard/ -mindepth 1 -ls -delete

echo Creating startup file ...

echo    'xset -dpms'
echo    'xset s off'
echo    'lwm &'
echo    'unclutter &'
echo    'exec midori -e Fullscreen -a http://example.com/dashboard'

) > /home/dashboard/.xinitrc
cat /home/dashboard/.xinitrc

echo Starting X11 session ...
su - dashboard -c "startx -- tty7 -s 0 dpms"

echo Waiting before restart ...
for a in 60 50 40 30 20 10 00
        echo -n "$a "
        sleep 10

echo Forcing termination of script ...
exec sleep 1


Recent version of Rasbian use systemd. Therefore we need systemd startup configuration. Create /etc/systemd/system/dashboard.service with content:

Description=RPi dashboard



Enable execution. Reload configuration. Start service:

chmod +x /usr/local/bin/dashboard-start.sh
systemctl daemon-reload
systemctl enable dashboard.service
systemctl start  dashboard.service

Pros / Cons (Op2)

  • Pros
    • Automatic restart in case of browser / X11 failure.
    • Size -> only essential packages are installed.
    • Logging of startup events.
  • Cons
    • Configuration may look more complicated.

Synthetic F5 (reload)

I see two reasons why it is good to "hit" F5 on keyboard (at least from time to time). To get latest version of dashboard page and also to clean memory / cache of browser. It is good that this can be accomplished without connecting keyboard. Just install following packages:

apt-get install cron xdotool

Edit corntab using crontab -e and add following line:

0 * * * * su - dashboard -c "DISPLAY=:0 xdotool key F5" > /dev/null 2>&1

Correct way should be to find browser window and send "F5" only to it. Unfortunately web page can change tile of page / window which break things a bit ..."

This will ensure that page is refreshed each hour.

(optional) Snapshots

This dashboard can be easily reinstalled in case of some serious failure. Backup is not necessary but it is handy to have at least snapshots. I recommend btrbk tool. Please note that this tool require system in subvolume.

Tool is not in repository but can be downloaded from gitbub:

cd /root/
git clone https://github.com/digint/btrbk

Tool itself is one file. Copy it to sbin directory:

cp -p btrbk/btrbk /usr/local/sbin/

It need directory for configuration file and snapshots:

mkdir -p /etc/btrbk
mkdir -p /btrfs/_snapshot/system

Configuration is located in /etc/btrbk/btrbk.conf. Here is my configuration file:

# Global configuration

transaction_log		/var/log/btrbk.log

timestamp_format	long-iso

snapshot_create		always

preserve_day_of_week	monday
snapshot_preserve_min	 6h
snapshot_preserve	16h 14d 4w 3m

# Volume configuration

volume /btrfs
	subvolume system
		snapshot_dir _snapshot/system


Btrbk create snapshot each time it is invoked with "run" option. Therefore it needs to be scheduled via cron. Invoke cron editor via crontab -e and add following line:

0 * * * * /usr/local/sbin/btrbk run >> /var/log/btrbk_cron.log 2>&1

Dashboard source possibilities

First of all just try to google it. There are lot of different possibilities and range of product may quickly change after I publish this wiki article.

I am currently testing solution provided by geckoboard (2016-05). I think this is most advanced dashboard solution.

Previously I tested thedash. I think it is good as start but it lack custom widgets.

I will mostly probably do at least some testing of following dashboard product in future:


Ignore CEC init message

When Raspberry Pi get HDMI CEC Init message then it normally respond with source active reply. This may cause channel switch to HDMI port and/or wake-up TV from standby if RPi is rebooted. It is possible to configure RPi to ignore this kind of message. Just edit /boot/config.txt and insert following line to enable this configuration:


Reboot of RPi is required to enable this configuration

Disable CEC

If TV or RPi is still reacting to some of CEC messages then it is possible to disable it completely. This will make sure that CEC messages are not interpreted by RPi and TV think that there is only "dumb" HDMI video source.

Edit /boot/config.txt and add following line to completely disable CEC: