Skip to content

Menu

  • Home
  • Sysadmin
  • Debian
  • Security
  • Docker

Blog by Constantin Herold | Theme by ThemeinProgress | Proudly powered by WordPress

Spaaacesysadmin & dev stuff

Raspberry Pi Grafana Kiosk

February 23, 2021Monitoring, Raspberry Pi, Sysadmin Standard
Read time 2 minutes

We will use the dashboard that we previously created for reference see https://herold.space/proxmox-grafana-dashboard

Prepare

Use Etcher to copy Raspberry Pi OS with desktop onto a SD Card.

Change the password for “pi” and setup a static IP.

Also run updates.

Kiosk

First enable auto login and disable screen blanking via raspi config cli.

raspi-config
# 3 Boot Options -> B1 Desktop / CLI -> B4 Desktop Autologin
# 7 Advanced Options -> A6 Screen Blanking -> No

The default user pi has a lot of additional permissions so we create a dedicated user for security reasons.

adduser kiosk

Then change the auto login user from pi to kiosk.

sed -i "s/autologin-user=pi/autologin-user=kiosk/g" /etc/lightdm/lightdm.conf

In order to hide the mouse cursor we have to install unclutter.

apt install unclutter

With everything done we create a auto start script to run chrome which will display our Grafana kiosk.

All you have to do is adjust the “–app” argument with your kiosk URL.

cat << 'EOF' > /etc/xdg/lxsession/LXDE-pi/autostart
# disable screen blank
@xset s noblank
@xset s off
@xset -dpms

# disable cursor
@unclutter -idle 0

# run chrome
@chromium-browser --kiosk --check-for-update-interval=31536000 --disable-component-update --disable-restore-session-state --disable-features=TranslateUI --disable-session-crashed-bubble --force-device-scale-factor=1.00 --app=http://192.168.1.120:3000/playlists/play/1?kiosk&autofitpanels
EOF

If you reboot now it should run the kiosk in full screen and cycle trough your dashboards.

Read Only File System

SD cards do not last long with constant writes.

To prevent wear we will use a read only file system.

cp /etc/fstab /etc/_fstab

cat << 'EOF' > /etc/fstab
proc            /proc              proc    defaults                        0       0
/dev/mmcblk0p1  /boot              vfat    ro                              0       2
/dev/mmcblk0p2  /                  ext4    ro                              0       1
tmpfs           /run               tmpfs   defaults,noatime,mode=0755      0       0
tmpfs           /tmp               tmpfs   defaults,noatime,mode=1777      0       0
tmpfs           /var/tmp           tmpfs   defaults,noatime,mode=1777      0       0
tmpfs           /var/log           tmpfs   defaults,noatime,mode=0755      0       0
tmpfs           /var/lib/systemd   tmpfs   defaults,noatime,mode=0755      0       0
tmpfs           /var/lib/lightdm   tmpfs   defaults,noatime,mode=0755      0       0
tmpfs           /home/kiosk        tmpfs   defaults,noatime,mode=0777      0       0
EOF

DNS must be set via bak file.

cat << 'EOF' > /etc/resolv.conf.bak
nameserver 192.168.1.1
EOF

Fixing permission issues of lightdm.

sed -i "s/#user-authority-in-system-dir=false/user-authority-in-system-dir=true/g" /etc/lightdm/lightdm.conf

Clearing browser cache daily to prevent OOM.

cat << 'EOF' > /etc/cron.daily/cachereset
#!/bin/bash
find /home/kiosk/.cache/chromium/Default/Cache/ -maxdepth 1 -type f -mmin +60 ! -name "index*" -delete
EOF

chmod +x /etc/cron.daily/cachereset

If you reboot now the filesystem should be read only.

If you ever need to change something remount the file system using

mount -o remount,rw /
mount -o remount,rw /boot

Rotate Display

To change rotation of the display add the following to the boot config.

cat << 'EOF' >> /boot/config.txt
# 0=default, 1=90, 2=180, 3=270
display_rotate=3
EOF

Schedule Display

You can use vcgencmd to turn off hdmi displays.

cat << 'EOF' >> /var/spool/cron/crontabs/root
# schedule display to turn off from 23:00 - 06:00
0 23 * * * vcgencmd display_power 0
0 6 * * * vcgencmd display_power 1
EOF

Disable LED

You can also disable the disk activity and power led.

cat << 'EOF' >> /var/spool/cron/crontabs/root
# did not work if applied once
*/5 * * * * echo 0 > /sys/class/leds/led0/brightness
*/5 * * * * echo 0 > /sys/class/leds/led1/brightness
EOF

Write a Reply or Comment Cancel reply

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

Recent Posts

  • Create SWAP on ZFS ZVOL
  • Raspberry Pi Grafana Kiosk
  • Proxmox Grafana Dashboard
  • Proxmox Full Disk Encryption with SSH Remote Unlock
  • Login Mail Alert Using Rsyslog

Categories

  • Debian
  • Docker
  • Monitoring
  • Personal
  • Proxmox
  • Raspberry Pi
  • Security
  • Sysadmin