Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Shutting down the PC from XBMC
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
m3sm3r
n00b
n00b


Joined: 03 Jul 2008
Posts: 16

PostPosted: Sun Feb 13, 2011 4:29 am    Post subject: [Solved] Shutting down the PC from XBMC Reply with quote

Hello,

I recently built an XBMC htpc. Setup and enverything was relatively smooth and it runs great on a very minimal system (xorg, slim, fluxbox and the various dependencies). The problem I have is that I'm unable to shutdown the PC when I invoke shutdown from XBMC. I know there is a huge number of threads on the net for this issue, but I believe the problem I'm having is specific to gentoo. In most cases the problem is solved when the user is granted permission to call hal.power-management.shutdown

Code:

polkit-auth --user <username> --grant org.freedesktop.hal.power-management.shutdown


Looking at the syslog messages it turns out that indeed the problem is that the dbus request to hal is rejected:

Code:

Feb 12 18:11:51 localhost dbus-daemon: [system] Rejected send message, 1 matched rules; type="method_call", sender=":1.12" (uid=1000 pid=5498 comm="/usr/lib64/xbmc/xbmc.bin) interface="org.freedesktop.Hal.Device.SystemPowerManagement" member="Shutdown" error name="(unset)" requested_reply=0 destination="org.freedesktop.Hal" (uid=0 pid=4109 comm="/usr/sbin/hald))


However the solution above will not work becuase polkit-auth belongs to sys-auth/policykit which is no longer in portage. It appears to be replaced by polkit-1. Furthermore hal is no longer built with policykit support, so I'm not even sure if setting up a policy will solve the issue. It looks to me like I'll need to figure out how to configure hal to accept the request for shutdown.

Thanks


Last edited by m3sm3r on Sun Mar 06, 2011 10:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
BT
Apprentice
Apprentice


Joined: 13 Jun 2004
Posts: 292

PostPosted: Fri Feb 18, 2011 2:12 am    Post subject: Reply with quote

Do you have consolekit installed (with use +policykit) and running? If so, you need to create a polkit policy to allow your user to shutdown/reboot XBMC. I used the policy I found on the Arch Linux Wiki. Since my system uses consolekit, I use the following script to start XBMC:

Code:
#!/bin/sh

exec /usr/bin/ck-launch-session /usr/bin/dbus-launch --exit-with-session /usr/bin/xbmc-standalone


Note that I'm using the xbmc-9999 ebuild which no longer supports HAL. The xbmc-10.0 ebuild will also drop HAL support, so it's probably a good idea to migrate your system away from HAL. There is a great post on this forum to help you do that.
Back to top
View user's profile Send private message
m3sm3r
n00b
n00b


Joined: 03 Jul 2008
Posts: 16

PostPosted: Sun Mar 06, 2011 10:43 pm    Post subject: Reply with quote

Thanks for the update BT,

Actually I got this solved by moving away from login managers/window manager etc. I followed the example I found in a gentoo bug about xbmc and bootsplash issue. The bug tracker seems to be down now and I can't find the entry. Anyway I'll paste the few scripts that got me there and I'll probably setup the policykit. I have it installed. Until hal-less xbmc comes to portage I'll stick with the current config. The guide to migrate away from hal is awesome. Thanks for the link.

Here is what I have:

/etc/conf.d/xdm:
Code:

# We always try and start X on a static VT. The various DMs normally default
# to using VT7. If you wish to use the xdm init script, then you should ensure
# that the VT checked is the same VT your DM wants to use. We do this check to
# ensure that you haven't accidentally configured something to run on the VT
# in your /etc/inittab file so that you don't get a dead keyboard.
CHECKVT=1

# What display manager do you use ?  [ xdm | gdm | kdm | kdm-4.3 | gpe | entrance ]
# NOTE: If this is set in /etc/rc.conf, that setting will override this one.
#
# KDE-specific note:
# - If you are using kdeprefix go with "kdm-4.Y", e.g. "kdm-4.3".
#     You can find possible versions by looking at the directories in /usr/kde/.
# - Else, if you are using KDE 3 enter "kdm-3.5"
# - Else, if you are using KDE 4 enter "kdm" without a version
DISPLAYMANAGER="xbmc-dm"


/etc/X11/Sessions/xbmc
Code:

#!/bin/sh

exec /usr/bin/xbmc-init


/etc/env.d/90xsession
Code:

XSESSION="xbmc"


/usr/bin/xbmc-dm
Code:

#!/bin/bash
/bin/su <xbmc-user> -l -c "/bin/bash --login -c startx >/dev/null 2>&1"


/usr/bin/xbmc-init
Code:

#!/bin/bash
/usr/bin/dbus-launch --exit-with-session /usr/bin/xbmc-standalone
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum