[SOLVED] Setup Kiosk System on Ubuntu 18.04 LTS, xorg, openbox
UbuntuThis forum is for the discussion of Ubuntu Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Setup Kiosk System on Ubuntu 18.04 LTS, xorg, openbox
Hello Everybody,
I am following the tutorial here which is for Ubuntu 14.04. I am trying to do the exact same thing using the latest ubuntu 18.04. I could manage to install openbox, chromium-browser, xorg, by choosing the network installer version of ubuntu.
If I start the machine and log in as the »kioskuser«, directly, and run:
Code:
startx /etc/X11/Xsession /opt/kiosk.sh --
whereby kiosk.sh includes:
Code:
xset -dpms
xset s off
openbox-session &
start-pulseaudio-x11
chromium-browser --kiosk --no-first-run 'http://thepcspy.com'
everything works the way it should.
But to start it on boot, I need to use systemd now, since that just changed since ubuntu 16.04.
So I have created /etc/systemd/system/kiosk.service with this content:
Code:
[Unit]
Description=Kiosk Launcher
# After=systemd-user-sessions.service
[Service]
# with that user it does not work at all
# User=kioskuser
# that script as well
# ExecStart=/bin/bash -c 'startx /etc/X11/Xsession /opt/kiosk.sh'
# this starts a desktop, but starting the browser from there fails as well
ExecStart=/bin/bash -c 'startx'
[Install]
WantedBy=multi-user.target
X.Org X Server 1.19.6
Release Date: 2017-12-20
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-119-generic x86_64 Ubuntu
Current Operating System: Linux t3000 4.15.0-33-generic #36-Ubuntu SMP Wed Aug 15 16:00:05 UTC 2018 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-33-generic root=UUID=12ef906c-b7ad-474d-8cbb-e65263737416 ro splash quiet
Build Date: 13 April 2018 08:07:36PM
xorg-server 2:1.19.6-1ubuntu4 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.34.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/home/tmil/.local/share/xorg/Xorg.0.log", Time: Mon Sep 10 11:32:10 2018
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) xf86OpenConsole: Cannot open virtual console 2 (Permission denied)
(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
(EE) Please also check the log file at "/home/tmil/.local/share/xorg/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
So the whole thing sums up to the fact, that the scripts themself are working, but they are launched wrong, so permissions issues are crossing the way here.
I am really lost here and run out of ideas, since this is the first project that involves setting up a desktop-like environment. Any kind of help is really appreciated, if log files are needed, please let me know which ones are of interest.
Just a thought. It should be possible to use a display manager like lightdm or similar. This will allow you to auto login to open box session as any user you want, then all you need to do is write your commands into the ~/.config/openbox/autostart file.
If you insist on the systemd service file then you will likely need the xserver-xorg-legacy package and add this line to /etc/X11/Xwrapper.config in addition to the line you added above.
Code:
needs_root_rights=yes
This comes from the method to start Kodi with a systemd service. I'm sure this is your problem as I've had that error above as well.
Another thing, rather than running startx from the systemd service you should just start openbox directly. Shortest path between 2 points is a straight line and all that.
*EDIT* I know you aren't running Kodi. I am, hence where I am coming up with these solutions. For me, they work flawlessly and I'm sure they will work for you as well.
Last edited by jmgibson1981; 09-13-2018 at 03:10 PM.
[Service] # with that user it does not work at all User=kioskuser ExecStart=/usr/bin/startx Restart=always
[Install] WantedBy=multi-user.target
Furthermore I added all the initial script for the kiosk mode in /home/kioskuser/.xsession
That works without lightdm. I think it is of advantage not have any »logged in« user in this scenario. SO within the .xsession file there is that
PHP Code:
while true; do chromium-browser --kiosk --no-first-run 'http://thepcspy.com' done
what restarts the browser whenever closed. So this way: If the user can break this loop, he ends up on empty black desktop and if he is additionally able to stop this process, he end up at the terminal login and the systemd service restarts, so the user has ~1 second to enter credentials.
I find this solution quite robust, but if lightdm would be better, I would love to know why.
^ that looks like a good & simple solution.
of course it's not 100% safe, but for most situations it should suffice.
try yourself to break it!
can you break it from another tty? try e.g. Ctrl-Alt-F2.
[Service] # with that user it does not work at all User=kioskuser ExecStart=/usr/bin/startx Restart=always
[Install] WantedBy=multi-user.target
what do you mean by "with that user it does not work at all"??? everything indicates that you are succesfully logging in & starting the browser as kioskuser.
hence the following statement is incorrect:
Quote:
I think it is of advantage not have any »logged in« user in this scenario.
I think it is of advantage not have any »logged in« user in this scenario.
I am referring to a possible use of lightdm or similar as suggested by @Mill-J and @jmgibson1981 to have a kind of login. But since there is no display manager, there is no »real login«, since the main kiosk process is just started by systemd. What means, even if the user can break it (the browser, X and openbox) he ends up at a terminal login prompt.
Just today, after I have logged in to the kiosk via ssh, I noticed that the welcome message changed. I guess that this happens because there is now a »kiosk.service« within /etc/systemd/system, but that is just a vague idea… Anyway it now says something like that:
PHP Code:
… * wanto build a kiosk -- https://tutorials.ubuntu.com/tutorial/wayland-kiosk …
Just visit https://tutorials.ubuntu.com and search for »kiosk«, maybe that should be the »future way« to build kiosks on ubuntu.
Hello, I followed your description, and now I can start the kiosk mode with this command: "startx /etc/X11/Xsession /opt/kiosk.sh --" from ssh connection. Could you explain me how can I do this method: "Furthermore I added all the initial script for the kiosk mode in /home/kioskuser/.xsession", or what is missing from my configuration? Sorry for stupid questions, but I am newbie in linux.
Quote:
Originally Posted by schmi85
Thanks for Help! Meanwhile I have figured out the issues and as it turned out, those are
1. installing xserver-xorg-legacy package
2. needs_root_rights=yes and allowed_users=anybody in /etc/X11/Xwrapper.conf
just as @jmgibson1981 posted.
Than I changed the /etc/systemd/system/kiosk.service to
[Service] # with that user it does not work at all User=kioskuser ExecStart=/usr/bin/startx Restart=always
[Install] WantedBy=multi-user.target
Furthermore I added all the initial script for the kiosk mode in /home/kioskuser/.xsession
That works without lightdm. I think it is of advantage not have any »logged in« user in this scenario. SO within the .xsession file there is that
PHP Code:
while true; do chromium-browser --kiosk --no-first-run 'XXX://thepcspy.com' done
what restarts the browser whenever closed. So this way: If the user can break this loop, he ends up on empty black desktop and if he is additionally able to stop this process, he end up at the terminal login and the systemd service restarts, so the user has ~1 second to enter credentials.
I find this solution quite robust, but if lightdm would be better, I would love to know why.
"Furthermore I added all the initial script for the kiosk mode in /home/kioskuser/.xsession"
it means they opened /home/kioskuser/.xsession in a text editor and added all the lines from the "initial script for the kiosk mode" (except for the first #!/bin/sh i guess) at the end of that file, then saved and closed it.
if this explanation isn't enough, please open a dedicated thread with a full problem description (see first link in my signature).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.