LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 09-10-2018, 04:37 AM   #1
schmi85
LQ Newbie
 
Registered: Sep 2018
Distribution: win65
Posts: 19

Rep: Reputation: Disabled
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
I have add /etc/X11/Xwrapper.config with

Code:
allowed_users=anybody
but that does not change a thing. Running

kioskuser@terminal:~$ startx /etc/X11/Xsession /opt/kiosk.sh --

gives that:

Code:
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.

Thanks in ahead!!!!
 
Old 09-11-2018, 08:05 AM   #2
Mill J
Senior Member
 
Registered: Feb 2017
Location: @127.0.0.1
Distribution: Mint, Void, MX, Haiku, PMOS, Plasma Mobile, and many others
Posts: 1,258
Blog Entries: 2

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
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.
 
Old 09-12-2018, 05:52 PM   #3
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,140

Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
Agree with LightDM. Set it to autologin to the appropriate user into Openbox. Then openbox autostart should have all of the relevant commands.

Here is my lightdm autologin for Kodi as an example. I prefer this > a systemd service as they do not support standalone started via systemd service.

Code:
[SeatDefaults]
autologin-user=kodimain
autologin-user-timeout=0
user-session=openbox
Substitute your user of course.

My openbox autostart for that user.

Code:
kodi &
sleep 5
xset s 0 s blank -dpms &
Again modify to your needs.

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.
 
1 members found this post helpful.
Old 09-20-2018, 02:30 AM   #4
schmi85
LQ Newbie
 
Registered: Sep 2018
Distribution: win65
Posts: 19

Original Poster
Rep: Reputation: Disabled
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

PHP Code:

[Unit]
Description=Kiosk Launcher
After
=systemd-user-sessions.service

[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.

Again Thanks for help!
 
Old 09-21-2018, 12:22 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ 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.


Quote:
Originally Posted by schmi85 View Post
PHP Code:
[Unit]
Description=Kiosk Launcher
After
=systemd-user-sessions.service

[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.
 
Old 09-21-2018, 03:25 AM   #6
schmi85
LQ Newbie
 
Registered: Sep 2018
Distribution: win65
Posts: 19

Original Poster
Rep: Reputation: Disabled
»can you break it from another tty? try e.g. Ctrl-Alt-F2.«

Well no, with

PHP Code:
Section "ServerFlags"
    
Option "DontVTSwitch" "true"
EndSection 
in /etc/X11/xorg.conf

Whit
Quote:
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.
 
Old 09-21-2018, 07:34 AM   #7
Mill J
Senior Member
 
Registered: Feb 2017
Location: @127.0.0.1
Distribution: Mint, Void, MX, Haiku, PMOS, Plasma Mobile, and many others
Posts: 1,258
Blog Entries: 2

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Sounds like you got it. That's very likely more secure than lightdm. Thanks for sharing
 
Old 09-24-2018, 08:23 AM   #8
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,140

Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
Looks good to me. Lightdm would be easier. But your way is most likely better. I'm lazy.
 
Old 09-24-2018, 03:22 PM   #9
schmi85
LQ Newbie
 
Registered: Sep 2018
Distribution: win65
Posts: 19

Original Poster
Rep: Reputation: Disabled
Easter Egg

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.
 
Old 01-09-2019, 10:46 AM   #10
luxmanpower
LQ Newbie
 
Registered: Jan 2019
Posts: 1

Rep: Reputation: Disabled
Question

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 View Post
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

PHP Code:

[Unit]
Description=Kiosk Launcher
After
=systemd-user-sessions.service

[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.

Again Thanks for help!
 
Old 01-10-2019, 12:46 AM   #11
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by luxmanpower View Post
"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).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu 18.04 LTS to use Xorg by default jeremy Linux - News 3 11-09-2018 02:13 PM
LXer: Ubuntu 18.04 LTS Daily Builds Now Use Xorg by Default Instead of Wayland LXer Syndicated Linux News 0 02-10-2018 05:01 PM
[SOLVED] Ubuntu 12.04.5 LTS - unmet dependencies while trying to install xserver-xorg czezz Linux - Software 2 11-29-2017 06:34 AM
Xorg, Openbox?, Cursor appears stretched on dual monitor system. metaf5 Linux - General 1 07-25-2012 05:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 08:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration