Kiosk Modes

From RidgeRun Developer Wiki

Follow Us in Twitter LinkedIn Email Share this page


NVIDIA partner logo NXP partner logo






Kiosk mode on a Jetson Orin Nano essentially transforms the powerful embedded system into a dedicated, single-purpose device. Instead of a general-purpose desktop environment, it boots directly into a specific application, often in a full-screen, locked-down state. This is incredibly useful for creating interactive displays, digital signage, point-of-sale systems, or any application where a user should only interact with a single, defined interface.

Below is a general approach to activating kiosk mode. This was done on a Jetson Orin Nano using JetPack 6. This assumes the board is already flashed. In case the board is not flashed, please follow Flashing_with_SDK_Manager_Guide to flash a Jetson board using Jetpack 6 and Linux for Tegra. Also, the board needs to be connected to a screen. It could be via HDMI.

With the board connected to an HDMI screen and a keyboard, log in to the default user created in the flashing process. Open a terminal with the following keys:

ctrl + alt + t

It will wait 40 seconds and then get out of kiosk mode. Of course, if an application has a loop or needs to be running for any time required, it is possible as well. Save this file and change

Create a dedicated user for kiosk mode.

sudo useradd -m kioskmode

Then, enable login without a password on the kiosk mode user.

sudo passwd -d kioskmode

This will allow you to directly get into the kiosk mode session without the user having to provide login information.

As mentioned before, kiosk mode sets the board to only run one application and the resources needed to do it. We are going to create a simple bash script as our application to show the functionality of this mode. The file for this guide is going to be named kioskmode.sh, and it is just going to write a simple text file and save it to the filesystem. Open the file using your preferred text editor:

vi kioskmode.sh

add the following contents:

#!/bin/bash
echo "kiosk mode is successfully activated" > /home/kioskmode/kiosktest.log
sleep 40

Move the file to the kioskmode user's home directory:

mv kioskmode.sh /home/kioskmode/

Make the file executable:

sudo chmod 770 /home/kiosk/kiosk.sh

Make kioskmode user the owner of the file:

sudo chown kiosk:kiosk /home/kiosk/kiosk.sh

After the application is defined, to achieve kiosk mode, autologin must be set for the kiosk mode user. This will tell the system to login in the kiosk mode user without asking. To achieve this, modify the gdm3 custom configuration.

Open the custom configuration file for gdm3:

sudo nano /etc/gdm3/custom.conf

In the [daemon] section, add or modify:

[daemon]
AutomaticLoginEnable=true
AutomaticLogin=kioskmode

For reference, gdm3 stands for GNOME Display Manager version 3. As its name says, it is the display manager that runs after the boot process is done and has functionalities like handling the login screen and the process itself. It also handles the session for the desktop environment and the necessary resources for it.

Now, an xsession created specially for kiosk mode is needed. Create the kiosk.desktop file:

sudo nano /usr/share/xsessions/kioskmode.desktop

Add the following lines:

[Desktop Entry]
Name=KioskMode
Comment=Starts the kiosk application
Exec=/home/kioskmode/kioskmode.sh
Type=Application

This .desktop file is used to launch a desktop session. In this file, the session's name is defined. There is also a comment added to describe what the session is going to do. The Exec value defines the application that is going to be run. This is an important value because it shows the name of the application that is going to be run or the path to the executable. It is going to be the name of the application if it is a system wide installed application or a path if a specific executable wants to be launched. For the Type value, which is application, signifies that this .desktop file defines an entire desktop session rather than a single application that would typically appear in a menu. This might seem a bit counter-intuitive, but it's the standard way to define sessions. The [Desktop Entry] header is the standard for .desktop files.

To activate kiosk mode, we also need to create a configuration file for the user inside the accounts service.

sudo nano /var/lib/AccountsService/users/kioskmode

Add or modify the following lines in the [user] section:

[User]
Language=
XSession=kioskmode
Session=kioskmode

The [User] header is the standard way to let the service know that the following lines define general properties for the user account. The XSession value specifies the desktop session to be used when the "kioskmode" user logs in. This way we are going to use the kioskmode.desktop file created previously to define the session for this user.

Finally, as stated in the application created (kioskmode.sh), it is going to create and save a file in the filesystem. It is important to know that the kiosk mode user needs permissions according to what is needed by the application. In this case, it needs permission to write to its home directory, so with the next command we are going to grant this.

sudo chmod 755 /home/kiosk_mode

This gives the kiosk mode user read, write, and execute permissions over its home directory. This applies according to the application; for example, if you want to run a Python application, the user needs access to Python libraries.

After this, kiosk mode is set to work on the board after a reboot. Run the following command to reboot the board and get into kiosk mode.

sudo reboot

If you have an HDMI screen connected, the boot messages should be appearing on screen before a blank screen. This blank screen should last 40 seconds as stated in our kioskmode.sh application. After the 40 seconds are over, it should get back to the login screen. To check if kiosk mode really worked, the file created can be checked. Login in the main user (the one we used for the kiosk mode configurations) and print the contents of the file created by the application in the kiosk mode user's home directory:

sudo cat /home/kioskmode/kiosktest.log

kiosk mode is successfully activated

And there it is. As mentioned before, this is a simple example, but it shows the main principles to activate kiosk mode on a Jetson Board. This could be useful for more specific applications like setting a board to only run an AI inference model. This example, of course, would need more permissions granted according to the application dependencies.