You are not logged in.

#1 2012-11-03 09:31:53

rp9
Member
From: Austria
Registered: 2010-09-16
Posts: 13

xbmc, systemd -> shutdown, reboot

Hi!

I have a htpc which will just start xbmc trough xinit.
And since consolekit was removed a few days ago, the shutdown, reboot entries in xbmc are gone.
I still booted with systemV init, but switched now to systemd, but shutdown/reboot is still missing.

I tried installing the polkit-use-wheel-group package from aur, but still nothing.

Does anyone know a way to get back the shutdown/reboot?

Offline

#2 2012-11-03 13:17:11

amatriain
Member
Registered: 2011-06-02
Posts: 49

Re: xbmc, systemd -> shutdown, reboot

I'm seeing something similar, though I'm not sure it's the same problem. In my HTPC I see shutdown/reboot menu entries in XBMC, but they just close XBMC and immediately restart it without actually powering off/rebooting the pc. This happens since the removal of consolekit.

I've tried customizing the unit file following the wiki instructions. Changed the "Restart=always" line to "Restart=on-failure". Now when I issue a shutdown or reboot command through XBMC, XBMC closes and I go back to the login screen.

I've also tried enabling autologin into XFCE from GDM, and autostarting XBMC from the XFCE session, instead of launching XBMC with systemd. Similar behavior, only now when I try to shutdown/reboot from XBMC I just go back to the XFCE desktop (the session is not even closed).

When I login through ssh the user that owns the XBMC process in all cases can issue poweroff/reboot commands without issue, with or without sudo. I made sure to follow the instructions here:

https://wiki.archlinux.org/index.php/Al … o_Shutdown

and here:

http://wiki.xbmc.org/index.php?title=Ar … -less_sudo

I only have problems when trying to shutdown/reboot from inside XBMC. Either from an XFCE session or from ssh, using the same user, I can do it with no problem.

The arch wiki mentions that D-Bus and upower must be installed to enable shutdown-suspend-hibernate out of XBMC. I made sure they are installed, but I'm not sure if I have to configure something else there.

Until recently the wiki entry for XBMC had instructions to write a policykit rules file to enable power management; they've been removed, not sure why (they are no longer applicable maybe?). I've tried following them anyway but it still won't work.

I made sure that in the XBMC configuration the default shutdown action is set to actually shut down, not just close.

I'm sure it was working fine before the upgrade which removed consolekit.

Offline

#3 2012-11-03 13:17:15

ck3mp
Member
Registered: 2010-06-08
Posts: 20

Re: xbmc, systemd -> shutdown, reboot

Ive no idea how bad this is to do but with having the intention to reset my years old system I just tried to find a quick fix to this. I solved the exact same issue by installing both polkit-consolekit and consolekit-git using yaourt. Seems to have solved my issues for now.

Offline

#4 2012-11-03 13:36:56

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: xbmc, systemd -> shutdown, reboot

please don't use any of those polkit-xy AUR packages, there are not needed. Same thing for crappy sudo NOPASSWD hacks. You just have to make sure that your session is properly registered by logind, how exactly are you starting X?

I just noticed the unit file on the XBMC wiki page: don't use it, it is crap and can't work because your session isn't set up properly. Either use a display manager or autologin into tty1 and startx from there.

Offline

#5 2012-11-03 14:02:32

rp9
Member
From: Austria
Registered: 2010-09-16
Posts: 13

Re: xbmc, systemd -> shutdown, reboot

Thx @65kid

I removed the xbcm system .service and followed:
https://wiki.archlinux.org/index.php/Au … al_console
and
https://wiki.archlinux.org/index.php/Start_X_at_Login

works perfect now.

Offline

#6 2012-11-03 14:05:23

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: xbmc, systemd -> shutdown, reboot

wow, this crappy service file and an xbmc user with a whole bunch of obsolete groups (audio,video,storage) etc. is actually part of the package. This really shouldn't be used and obviously causes nothing but problems, I'm gonna write a bug report about this.

Offline

#7 2012-11-03 14:06:05

amatriain
Member
Registered: 2011-06-02
Posts: 49

Re: xbmc, systemd -> shutdown, reboot

@65kid:

I don't use the unit file from the wiki. I use the unit file that comes with the xbmc package. I assume it's ok, I can paste it here if you like. It doesn't work (shutdown-reboot do not work), I've alsto tried customizing the user that owns the process and the "restart=on-failure" as I said in my post.

I also tried not using a unit file at all (systemctl disable xbmc) and instead starting a DM (systemctl enable gdm), enabling autologin into XFCE and from the XFCE session autostarting XBMC. I assume the session is correctly set up. Still shutdown-reboot does not work from XBMC; it does work from the XFCE desktop and from a ssh session, with the same user.

Any other useful info I can give about my setup?

Offline

#8 2012-11-03 14:12:33

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: xbmc, systemd -> shutdown, reboot

regarding the unit file, read my post above.

please try the following:
1. make sure upower is installed.
2. make sure you use the polkit from the official repositories and don't have any useless polkit rules in /etc/polkit-1/...
3. create a new user and login with it to XBMC via GDM.
4. Make sure the shutdown option in XBMC is actually set to shutdown

This really should work. If it doesn't I'm going to have to test this myself.

Offline

#9 2012-11-03 21:45:04

amatriain
Member
Registered: 2011-06-02
Posts: 49

Re: xbmc, systemd -> shutdown, reboot

@65kid:

Thanks for looking into it. Anyway, still no luck.

- upower is installed and up to date. I realized that the service was not enabled; I run a "systemctl enable upower" to enable it. However it seems to make no difference.
- polkit is installed from the official repos and up to date
- I've created a new user and set its .xinitrc to start xfce.
- I've logged in with the new user into xfce using gdm, and then launched xbmc. I made sure the default shutdown option was set to "shutdown".

After all this, XBMC still doesn't shut down or reboot. The menu options appear, but they just close XBMC itself, the session is not closed. I can see nothing of relevance in the logs. I've enabled the XBMC debugging log but there's nothing of interest there.

I also tried the method that worked for @rc9 (automatically login into a virtual console and autostarting X, instead of using a DM). Same result.

Anything else I can try?

Offline

#10 2012-11-04 12:58:01

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: xbmc, systemd -> shutdown, reboot

mh, I just tried this myself. It turns out this indeed doesn't work for me either. As far as I understand, the shutdown/reboot functionality would be handled by ConsoleKit, so it would make sense that this doesn't work, since afaik XBMC would have to be patched to use systemd instead.

What however should work is suspending because this is handled by upower and I seriously have no idea why it doesn't work.

@rp9: what exactly is working for you? only suspending or shutting down as well?

Offline

#11 2012-11-04 13:20:10

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: xbmc, systemd -> shutdown, reboot

got it. The XBMC code checks for ConsoleKit and if it doesn't exist, XBMC won't even try to use either ConsoleKit or UPower for its power management. The workaround is to simply install ConsoleKit and everything works as expected. So XBMC definitely has to be patched for systemd.

It works for rp9 because he still has ConsoleKit installed.

Offline

#12 2012-11-04 13:31:30

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,341
Website

Re: xbmc, systemd -> shutdown, reboot

65kid - Good bit of detective work.  Have you checked or opened a bug against upstream?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#13 2012-11-04 14:15:43

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: xbmc, systemd -> shutdown, reboot

graysky wrote:

65kid - Good bit of detective work.  Have you checked or opened a bug against upstream?

I opened a thread on the XBMC forums:
http://forum.xbmc.org/showthread.php?tid=144419

Offline

#14 2012-11-04 17:02:59

rp9
Member
From: Austria
Registered: 2010-09-16
Posts: 13

Re: xbmc, systemd -> shutdown, reboot

@65kid: shutdown, reboot, suspend.. everything

yes I still have the consolekit package installed and guess I will keep it until there is a patch for xbmc smile

Offline

#15 2012-11-04 21:17:58

Tymiboss
Member
Registered: 2012-11-04
Posts: 1

Re: xbmc, systemd -> shutdown, reboot

I ran into exactly the same issue today... instead of going throught the hassle of installing consolekit on my system, I went for more a drastic solution.
If XBMC is running, then not running anymore (because I clicked "shutdown" and it exited) I just "poweroff" my system. I do that with a little bit of bash run by root (in a cron, but it could work with a systemd service):

#!/bin/bash
while :;do
    if pgrep xbmc;then
    #XBMC is running
    	while :; do
	    if ! pgrep xbmc;then
            #XBMC was running, but is not anymore
	    	/sbin/poweroff
	    fi
	sleep 1s
	done
    fi
    sleep 1s
done

This is very ugly... but it will do for the time being!

Offline

#16 2012-11-04 21:19:33

amatriain
Member
Registered: 2011-06-02
Posts: 49

Re: xbmc, systemd -> shutdown, reboot

@65kid: Good find, thanks. Same as @rp9, I guess I will reinstall consolekit from the pacman cache and keep it until xbmc is patched.

I don't have high hopes that this will be patched quickly. It seems to me xbmc development is mainly focused in ubuntu, and I don't expect this to be a high priority. We will see.

Offline

#17 2012-11-04 22:44:53

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,341
Website

Re: xbmc, systemd -> shutdown, reboot

65kid wrote:

I opened a thread on the XBMC forums:
http://forum.xbmc.org/showthread.php?tid=144419

You'll very likely need to open a ticket on the bug tracker for a dev to see and know about this if it isn't there already.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#18 2012-11-05 17:26:33

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: xbmc, systemd -> shutdown, reboot

graysky wrote:

You'll very likely need to open a ticket on the bug tracker for a dev to see and know about this if it isn't there already.

done: http://trac.xbmc.org/ticket/13499

Offline

#19 2012-11-13 10:06:40

r3v0ss
Member
Registered: 2011-11-15
Posts: 5

Re: xbmc, systemd -> shutdown, reboot

same problem here, updated yesterday and now I'm not able to shutdown XBMC properly. Only the suspend and hibernate options are available. Hoping for a patch soon.

Offline

#20 2012-11-13 11:30:04

amatriain
Member
Registered: 2011-06-02
Posts: 49

Re: xbmc, systemd -> shutdown, reboot

After an upgrade, I'm experiencing this bug again. It seems the workaround of keeping consolekit installed no longer works for me.

Offline

#21 2012-11-13 11:39:38

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

Re: xbmc, systemd -> shutdown, reboot

I think we can edit DialogButtonMenu.xml to run custom comands, eg. systemctl poweroff.

Offline

#22 2012-12-02 16:44:17

ould
Member
Registered: 2007-05-22
Posts: 121

Re: xbmc, systemd -> shutdown, reboot

A fix for systemd was merged into the main git branch 2 days ago. I am trying a build now to see if it works as advertised. It is supposed to determine whether systemd or consolekit is being used and act accordingly, as far as I can tell anyways. Hope it works.

here's the commit:

https://github.com/xbmc/xbmc/commit/58d … 59de283732

I will try to update once my build is complete and installed. :-)

Last edited by ould (2012-12-02 16:47:09)

Offline

#23 2012-12-02 19:21:25

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

Re: xbmc, systemd -> shutdown, reboot

It works! Even better, it can tell which options are supported, eg. on Raspberry Pi there is no suspend option.

Offline

#24 2012-12-03 20:06:55

ould
Member
Registered: 2007-05-22
Posts: 121

Re: xbmc, systemd -> shutdown, reboot

Šaran wrote:

It works! Even better, it can tell which options are supported, eg. on Raspberry Pi there is no suspend option.

Did you do anything special to make it work. It is still not working for me. How are you starting xbmc? Maybe that has something to do with it. I am using this service file:

https://projects.archlinux.org/svntogit … kages/xbmc

Thanks,

Kevin

Offline

#25 2012-12-03 20:11:07

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

Re: xbmc, systemd -> shutdown, reboot

Use this in combination with this. Also install upower and add xbmc --standalone to .xinitrc.
Using xbmc service file will not register your session and therefore poklit won't be able to do it's job.

Offline

Board footer

Powered by FluxBB