You are not logged in.

#1 2019-07-01 09:35:26

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,702
Website

cage: run as systemd service

I want to run a kiosk application as a systemd service with cage.
When I run the command from a login session, it works fine.

$ cat /etc/systemd/system/application.service 
[Unit]
Description=Cage Digital Signage Test

[Service]
User=digsig
Group=digsig
ExecStart=/usr/bin/cage -- /usr/bin/chromium --kiosk https://bbs.archlinux.org/

[Install]
WantedBy=graphical.target

But when I run it from a systemd service I get these errors:

Jul 01 11:30:38 12 systemd[1]: Started Cage Digital Signage Test.
Jul 01 11:30:38 12 cage[2638]: 2019-07-01 11:30:38 - [wlroots-0.6.0/backend/session/logind.c:511] User has no sessions
Jul 01 11:30:38 12 cage[2638]: 2019-07-01 11:30:38 - [wlroots-0.6.0/backend/session/logind.c:559] Couldn't find an active session or a greeter session
Jul 01 11:30:38 12 cage[2638]: 2019-07-01 11:30:38 - [wlroots-0.6.0/backend/session/direct-ipc.c:35] Do not have CAP_SYS_ADMIN; cannot become DRM master
Jul 01 11:30:38 12 cage[2638]: 2019-07-01 11:30:38 - [wlroots-0.6.0/backend/session/session.c:96] Failed to load session backend
Jul 01 11:30:38 12 cage[2638]: 2019-07-01 11:30:38 - [wlroots-0.6.0/backend/backend.c:321] Failed to start a DRM session
Jul 01 11:30:38 12 cage[2638]: 2019-07-01 11:30:38 - [cage.c:201] Unable to create the wlroots backend
Jul 01 11:30:38 12 systemd[1]: application.service: Main process exited, code=exited, status=1/FAILURE

It looks familiar, since X11 has the same problem when running rootless.
It can only do so from an user's login session.
Does cage have the same shortcoming?
Is it not possible to run a kiosk program in a user context with systemd?
I know that I can hack an autologin by modifying agetty.service and run the kiosk application through the user's ~/.bash_profile.
But I want to avoid this, since it has proven unstable: It does not provide direct control of the actual kiosk process via systemd and thusly has very limited failure detection and recovery options.

Last edited by schard (2019-07-01 09:42:25)


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#2 2019-07-01 09:56:25

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: cage: run as systemd service

You should probably start it as a user service in a "lingering" logind session.

Edit: Or not: https://wiki.archlinux.org/index.php/Sy … _instances

Last edited by progandy (2019-07-01 09:58:17)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#3 2019-07-01 10:05:07

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,702
Website

Re: cage: run as systemd service

I never worked with user units, but it seems easy enough.
But of course there is the issue you pointed to.
Furthermore, for some reason, systemd does not want to enable lingering for the respective user.

$ sudo loginctl enable-linger digsig
Could not enable linger: No such file or directory
$ LANG=C id digsig
uid=993(digsig) gid=993(digsig) groups=993(digsig),997(sshusers)

Last edited by schard (2019-07-01 10:06:23)


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#4 2019-07-01 10:15:56

progandy
Member
Registered: 2012-05-17
Posts: 5,321

Re: cage: run as systemd service

I just looked a bit more, I guess you can use the PAMName option in a normal systemd service in addition to User to create a new session. Just define a special pam configuration that includes the logind session module and doesn't ask for a password.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

Board footer

Powered by FluxBB