{"id":131231,"date":"2023-01-16T08:00:00","date_gmt":"2023-01-16T08:00:00","guid":{"rendered":"https:\/\/fedoramagazine.org\/?p=37605"},"modified":"2023-01-16T08:00:00","modified_gmt":"2023-01-16T08:00:00","slug":"build-a-kiosk-with-fedora-silverblue","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2023\/01\/16\/build-a-kiosk-with-fedora-silverblue\/","title":{"rendered":"Build a kiosk with Fedora Silverblue"},"content":{"rendered":"<p>This article will describe the process of creating a kiosk or information &#8220;station&#8221; using Fedora Silverblue.<\/p>\n<p> <span id=\"more-37605\"><\/span> <\/p>\n<h2>What is a kiosk<\/h2>\n<p>If you&#8217;ve had the occasion to visit a museum, you might have used a touchscreen monitor with useful information and insights of the items on display. Or if you&#8217;ve attended a public library, you might have used a workstation with a browser or a software aimed to the consultation of the book\u2019s catalog. Or even in public places like train stations or public squares, you might have spotted big screens or televisions where you can see advertisement videos, or interacted with them in order to obtain information and services. These devices are kiosks. They are locked down environments, generally running a full screen application.<\/p>\n<p>Under the hood there is usually a small PC (maybe a fan-less device or a so called industrial PC, capable of staying powered on without issues for long periods of time) or perhaps a Raspberry Pi. Many times they are powered by Linux!<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2023\/01\/build-a-kiosk-with-fedora-silverblue.jpg\" alt=\"\" class=\"wp-image-37649\" \/><figcaption>A 10&#8243; Capacitive Touch Display showing the Fedora logo<\/figcaption><\/figure>\n<h2>Why Fedora Silverblue<\/h2>\n<p>Fedora Silverblue is a new generation of the desktop operating system. The main benefits of the system are atomic updates and immutability.<\/p>\n<p>Atomic updates means that the update process will complete successfully and if not the operation will be abandoned and the system reverted to the previous state. This prevents situations where some packages are upgraded while others are not. This might occur, for example, due to a power loss in the middle of the update process, leading to an unstable or unbootable system.<\/p>\n<p>In this context, immutability means part of the filesystem is read-only and the system files cannot be modified (at least not in the usual ways, read below). The term has been criticized by several parties: in fact, if you can update the system and install things, the system is actually mutable, so another term should be coined for these kinds of operating systems where there is a clearly defined distinction between the system, the applications and the changes made by the user. However this is not the topic of this article.<\/p>\n<p>You can find more information about Fedora Silverblue in this article: <a href=\"https:\/\/fedoramagazine.org\/what-is-silverblue\/\" target=\"_blank\" rel=\"noreferrer noopener\">What is Silverblue?<\/a><\/p>\n<p>These features make the system more robust and secure. This is an important consideration since a kiosk is usually located in a remote place, accessible to the public (even if hidden inside some box or behind a TV), and difficult to reach in case of malfunctions.<\/p>\n<p>If you have heard about Fedora IoT, you might think that it would be the perfect solution for this kind of operations. However, Fedora IoT, although sharing the same technologies as Fedora Silverblue (immutability, rpm-ostree, etc.), is not designed for and it doesn&#8217;t provide a graphical environment. Running headless is the expected use case for Fedora IoT.<\/p>\n<h2>GNOME Kiosk<\/h2>\n<p><a href=\"https:\/\/gitlab.gnome.org\/GNOME\/gnome-kiosk\" target=\"_blank\" rel=\"noreferrer noopener\">GNOME Kiosk<\/a> is a special GNOME session that &#8220;provides a desktop environment suitable for a fixed purpose, or single application deployments like wall displays and point-of-sale systems&#8221;. It provides a locked down GNOME session, without activities, dock, top bar, etc.<\/p>\n<p>The required bits are available in the Fedora repository.<\/p>\n<h2>How to proceed<\/h2>\n<p>As a basic example, we will create a simple slideshow.<\/p>\n<p>First of all let\u2019s install Fedora Silverblue. <\/p>\n<p>The first user created during initial setup becomes the administrator.<\/p>\n<p>Go to Settings. Enable Sharing and enable Remote Login (that is SSH) in order to access the kiosk for remote management.<\/p>\n<p>In Settings, go to Users and add a new user. Let\u2019s call it &#8220;kiosk&#8221; and assign it a password.<\/p>\n<h3>Install GNOME Kiosk<\/h3>\n<p>Even though Fedora Silverblue is an immutable system, rpm-ostree still allows you to install packages from the DNF repositories. This is called <em>layering<\/em>. Read more on <a href=\"https:\/\/fedoramagazine.org\/how-i-customize-fedora-silverblue-and-fedora-kinoite\/\" target=\"_blank\" rel=\"noreferrer noopener\">How I Customize Fedora Silverblue and Fedora Kinoite<\/a>.<\/p>\n<p>Open the terminal and issue the following command.<\/p>\n<pre class=\"wp-block-preformatted\">sudo rpm-ostree install gnome-kiosk gnome-kiosk-script-session<\/pre>\n<p>To <em>activate<\/em> the layered packages, you will have to reboot the system.<\/p>\n<h3>Automatic login<\/h3>\n<p>We have to set the system to automatically log in as the &#8220;kiosk&#8221; user.<\/p>\n<p>After the reboot, log in as the administrator user. Then go to Settings, Users, select the &#8220;kiosk&#8221; user, and enable Automatic Login. <\/p>\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/fedoramagazine.org\/wp-content\/uploads\/2023\/01\/Screenshot-from-2023-01-10-16-45-44.png\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"553\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2023\/01\/build-a-kiosk-with-fedora-silverblue.png\" alt=\"\" class=\"wp-image-37621\" \/><\/a><\/figure>\n<p>Then log out (don\u2019t reboot yet).<\/p>\n<p>For reference you can enable automatic login from the command line. To do so, edit the file <em>\/etc\/gdm\/custom.conf,<\/em> and add the following two lines to the <kbd>[daemon]<\/kbd> section.<\/p>\n<pre class=\"wp-block-preformatted\">[daemon]\nAutomaticLoginEnable=True\nAutomaticLogin=kiosk<\/pre>\n<h3>Configure the kiosk<\/h3>\n<p>At the login screen, select the \u201ckiosk\u201d user.<\/p>\n<p>As a basic example, let\u2019s create a slideshow of images. To do that we will use the GNOME image viewer (Eye of GNOME or eog). This is already installed on Fedora Silverblue as a Flatpak package. (Yes, you can run Flatpak applications from the command line.)<\/p>\n<p>Put some images in the Pictures folder.<\/p>\n<p>In the activities overview, you can find an application called Kiosk Script. Actually Gedit will open it and let you edit the script that will start when you select the Kiosk session at login. For reference, this script is named <em>gnome-kiosk-script<\/em> and it is located in the home directory under <em>.local\/bin<\/em>.<\/p>\n<p>Read the comments. Pay attention to the last line. If the program that you want to use in the kiosk session exits as soon as it is launched (or it runs in the background), you risk creating an infinite loop that will start a new window each second!<\/p>\n<p>The slideshow script will look like this:<\/p>\n<pre class=\"wp-block-preformatted\">#!\/bin\/sh if [ ! \"$(pidof eog)\" ]\nthen flatpak run org.gnome.eog -s \/home\/kiosk\/Pictures\nfi sleep 1.0\nexec \"$0\" \"$@\"<\/pre>\n<p>The above example script, will run eog in slideshow mode (indicated by the &#8220;-s&#8221; option) only if a process called <em>eog<\/em> isn&#8217;t already running. Make certain to take into account that the script can invoke itself in an infinite loop (it is instructed to do so by the last line). Note that if for some reason Eye of GNOME crashes, it will be launched again because of the &#8220;if&#8221; statement.<\/p>\n<p>Save the script. And the full screen slideshow will start immediately! Don\u2019t worry, you are not yet in the kiosk session. Press the super key and you can still use the dash and the applications overview.<\/p>\n<p>Logout.<\/p>\n<p>At the login screen click on the gear icon at the bottom right of the login page. Select &#8220;Kiosk Script Session (Wayland Display Server)&#8221;.<\/p>\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/fedoramagazine.org\/wp-content\/uploads\/2023\/01\/Screenshot-from-2023-01-10-16-41-21.png\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"553\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2023\/01\/build-a-kiosk-with-fedora-silverblue-1.png\" alt=\"\" class=\"wp-image-37619\" \/><\/a><\/figure>\n<p>Insert the password and the full screen slideshow will start.<br \/>You will be in the locked down GNOME session, so you can&#8217;t use any application or desktop functions. If needed, you can still switch to a TTY to gain the command line using a combination like CTRL+ALT+F3<\/p>\n<p>For reference, the file containing the user&#8217;s default session is <em>\/var\/lib\/AccountsService\/users\/kiosk<\/em><\/p>\n<pre class=\"wp-block-preformatted\">Session=gnome-kiosk-script-wayland<\/pre>\n<p>The last step is to reboot the machine. <\/p>\n<h2>Other types of kiosk<\/h2>\n<p>Other ideas could be: <\/p>\n<ul>\n<li>a full screen Firefox session (take a look at the gnome-kiosk-search-appliance RPM package) <\/li>\n<li>a video loop<\/li>\n<li>your own software specifically crafted for this purpose<\/li>\n<li>any application<\/li>\n<\/ul>\n<h2>Further improvements<\/h2>\n<p>You might modify the script to show the slideshow only at certain times of the day.<\/p>\n<p>To make the system more robust and secure, you might add a password to GRUB and to the BIOS. You might also disable the TTYs.<\/p>\n<p>Other useful ideas might be to enable automatic updates, and especially to implement <a href=\"https:\/\/github.com\/fedora-iot\/greenboot\" target=\"_blank\" rel=\"noreferrer noopener\">greenboot<\/a>, a health check framework developed for Fedora IoT.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article will describe the process of creating a kiosk or information &#8220;station&#8221; using Fedora Silverblue. What is a kiosk If you&#8217;ve had the occasion to visit a museum, you might have used a touchscreen monitor with useful information and insights of the items on display. Or if you&#8217;ve attended a public library, you might [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":131232,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[606,45,919,46,47,269],"class_list":["post-131231","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fedora-os","tag-faqs-and-guides","tag-fedora","tag-kiosk","tag-magazine","tag-news","tag-silverblue"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/131231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=131231"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/131231\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media\/131232"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=131231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=131231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=131231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}