You are not logged in.

#1 2014-01-06 20:22:41

muh3
Member
Registered: 2013-10-20
Posts: 8

[solved] allow a systemd user service to shutdown the pc (mythtv)

Hi,

I have a problem with my mythtv htpc. What I want is to shutdown the PC if the PC idles.
Mythtv (a pvr htpc software) recognizes if nobody is watching something and starts to shutdown the PC. This is not working ;(

By default, mythtv is running als a system service with a "User=xxx" line in his .service file. I managed to configure mythtv to run as user service, so the user can start/stop it with "systemctl --user start/stop mythbackend" ... but this doesn't solve the problem.

I installed polkit and now the user is able to shutdown the pc (systemctl poweroff) but this also doesn't help.

I already asked in the german forum but nobody has a idea.

Here is the german thread: https://bbs.archlinux.de/viewtopic.php?id=25290

in the first post, you can see my journald output.

can somebody help me? google can't
I don't think this is a mythtv related problem, I think user services are just not allowed to shutdown the pc.

thx for your help!

Last edited by muh3 (2014-01-10 13:26:36)

Offline

#2 2014-01-06 20:57:57

Šaran
Member
From: Bosnia
Registered: 2011-09-03
Posts: 407

Re: [solved] allow a systemd user service to shutdown the pc (mythtv)

To handle power from XBMC polkit rule is needed. It is probably the same with mythtv.

polkit.addRule(function(action, subject) {
  if (action.id.match("org.freedesktop.login1.") && subject.isInGroup("mythtv")) {
    return polkit.Result.YES;
  }
});

Save this as /etc/polkit-1/rules.d/10-mythtv.rules and add user to mythtv group.

Offline

#3 2014-01-07 18:02:12

muh3
Member
Registered: 2013-10-20
Posts: 8

Re: [solved] allow a systemd user service to shutdown the pc (mythtv)

thx...this worked!

but i still have a few questions.

Is this the normal way or is this a workaround?
Why is a normal user allowed to shutdown the pc via cli or an application...but not via a user service deamon? Is this a Bug?
What exactly does this rule allow? only shutdown?

thx!

Offline

Board footer

Powered by FluxBB