Skip to content

Node OS Kiosk Setup Guide Debian 8

Matt Magoffin edited this page Aug 27, 2017 · 4 revisions

SolarKiosk OS Setup Guide Debian 8

This guide describes the steps I took to create a Debian 8 based image for use as an informational kiosk applications. I started with the image created via the SolarNode OS Setup Guide Debian 8 guide, and modified it such that it:

  • includes a full X server, with the Openbox window manager
  • doesn't include a Java runtime
  • includes some custom scripts using python-webkit to display a web application in full-screen mode without any cursor
  • automatically logs in a kiosk user into X with a full-screen browser open

OS Tweaks

Taking the existing OS image, first I added the new kiosk user and include them in the video group:

useradd -c 'SolarKiosk' -m -U kiosk -G video

Then, removed Java and related packages, and installed the X related stuff:

apt-get purge openjdk-8-jre-headless rsync librxtx-java libjna-java

apt-get install --no-install-recommends openbox python-webkit xserver-xorg xinit

Then, remove some unneeded packages (more could probably be added here):

apt-get purge xserver-xorg-input-wacom \
xserver-xorg-video-ati \
xserver-xorg-video-cirrus xserver-xorg-video-geode \
xserver-xorg-video-mach64 xserver-xorg-video-mga \
xserver-xorg-video-intel xserver-xorg-video-neomagic xserver-xorg-video-nouveau \
xserver-xorg-video-openchrome xserver-xorg-video-r128 xserver-xorg-video-radeon \
xserver-xorg-video-savage \
xserver-xorg-video-siliconmotion xserver-xorg-video-sisusb \
xserver-xorg-video-tdfx xserver-xorg-video-trident \
xserver-xorg-video-vmware xserver-xorg-input-vmmouse

apt-get autoremove

apt-get clean

Tweak the host name:

echo 'solarkiosk' >/etc/hostname
echo 'Welcome to SolarKiosk.' >/etc/motd

Edit /etc/hosts to change the localhost line to this:

127.0.1.1       solarkiosk.localdomain  solarkiosk

Prevent screen saver / blanking

Create a /etc/X11/xorg.conf.d/99-solarkiosk.conf file with the following content:

Section "Monitor"
	Identifier "LVDS0"
	Option "DPMS" "false"
EndSection

Section "ServerLayout"
	Identifier "ServerLayout0"
	Option "StandbyTime" "0"
	Option "SuspendTime" "0"
	Option "OffTime"     "0"
	Option "BlankTime"   "0"
EndSection

System setup files

The solarkiosk-system-files.tgz archive contains the system files that enable the kiosk application to run. The kiosk user is assumed to have been created already, and then as root you can expand this archive from the / file system. The files included are:

  • etc/X11/xorg.conf.d/99-solarkiosk.conf
  • usr/local/bin/web.py
  • usr/local/bin/web.sh
  • home/kiosk/.profile
  • home/kiosk/.Xauthority
  • home/kiosk/.xinitrc
  • home/kiosk/.config/openbox/
  • home/kiosk/.config/openbox/autostart
  • home/kiosk/.config/openbox/menu.xml

Autologin

The system is set to automatically log the kiosk user in when the system boots. This is accomplished via the the /etc/systemd/system/getty@tty1.service.d/autologin.conf file, so the tty1 console is configured to log the kiosk user in:

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin kiosk --noclear %I $TERM
Type=simple

The ~kiosk/.profile script then starts the X server by calling startx. The ~kiosk/.xinitrc script starts Openbox, and then ~kiosk/.config/openbox/autostart launches the custom web application.

Launcher Web Server

If the web page to be shown by the kiosk may not be available when the system boots, then a static "launch" HTML file with a bit of JavaScript can be used display a "loading" message until the real webapp is available.

An example of this is kiosk.html. This page looks for a query parameter named url that contains the real webapp URL to show, and will attempt to load that in the background. Once it is able to reach that URL, it will set the window's location to that URL, essentially redirecting to the real webapp.

However, the browser may not allow JavaScript to change the URL to the real webapp when served from a file. Python provides a lightweight webserver that can be used to serve up the "launch" HTML file. A systemd unit file /etc/systemd/system/kiosk-server.service can be used to start this when the system boots:

# kiosk web service unit

[Unit]
Description=Kiosk Web Server.

[Service]
Type=simple
User=kiosk
Group=kiosk
WorkingDirectory=/home/kiosk/web
ExecStart=/usr/bin/python -m SimpleHTTPServer 8081
Restart=always
RestartSec=1

[Install]
WantedBy=multi-user.target

That can be enabled via systemctl enable kiosk-server and started via systemctl start kiosk-server. Once that is in place, then the .config/openbox/autostart file can be changed to

/usr/local/bin/web.sh 'http://localhost:8081/kiosk.html' &

Note that because the JavaScript is attempting to access a non-origin resource, CORS support for the "launch" URL would need to be enabled in the real webapp.

Clone this wiki locally