FS#25031 - [dbus, consolekit] /etc/X11/xinit/xinitrc.d/30-dbus breaks consolekit permissions

Attached to Project: Arch Linux
Opened by Daniel Micay (thestinger) - Tuesday, 05 July 2011, 17:00 GMT
Last edited by Dave Reisner (falconindy) - Saturday, 20 October 2012, 19:22 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan de Groot (JGC)
Andreas Radke (AndyRTR)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 36
Private No

Details

Description:

To get proper consolekit permissions such as the ability to mount drives as a regular user, dbus-launch needs to be run after ck-launch-session.

Desktop environments run dbus-launch if it hasn't already been done, so `ck-launch-session startxfce4` has worked fine in the past. WM users have been able to start add a `dbus-launch` command after ck-launch-session to get the same thing.

Now that Arch's dbus package includes an xinitrc.d script to start the dbus session automatically, it gets started before ck-launch-session, and attempting to mount a drive in programs like Thunar results in a 'not authorized' message.

There are two obvious solutions to the problem:
1) a script could be included in the consolekit package which runs ck-launch-session before the dbus script
2) the dbus script could be removed

The first solution is tempting, because it would get rid of a very common issue along with this bug. However, I don't think that starting dbus or consolekit automatically just because they are installed follows Arch's principles, regardless of what upstream thinks.

Additional info:
dbus 1.4.12-1
consolekit 0.4.5-1

Steps to reproduce:

Install Xfce4, start it with the attached xinitrc and try mounting a drive in Thunar.
   .xinitrc (0.2 KiB)
This task depends upon

Closed by  Dave Reisner (falconindy)
Saturday, 20 October 2012, 19:22 GMT
Reason for closing:  Won't fix
Additional comments about closing:  CK is being dropped.
Comment by Daniel Micay (thestinger) - Tuesday, 05 July 2011, 17:09 GMT
This problem only happens if you include the new xinitrc.d code from the skeleton xinitrc, so this hasn't broken anything on old installs. I guess that's it wasn't already reported.

I don't currently use consolekit or a DE, so I wasn't aware of the problem until I checked today after this discussion on the wiki: https://wiki.archlinux.org/index.php/User_talk:Thestinger#startxfce4_vs_xfce4-session.
Comment by Daniel Micay (thestinger) - Monday, 15 August 2011, 12:37 GMT
It doesn't seem like this is a problem anymore with dbus 1.4.14. In fact, the session is only properly authorized if the dbus session is started before ck-launch-session (via 30-dbus or similar code in xinitrc). Can anyone confirm?
Comment by Louis Chan (louis058) - Monday, 15 August 2011, 22:34 GMT
About dbus 1.4.14, I still had the same problem while running dbus 1.4.14, and using the default .xinitrc code, where usb drives couldn't be mounted, saying 'Not Authorized'. I also fixed it in the same way, by commenting out the code to start dbus-launch. So I cannot confirm that dbus 1.4.14 fixes the problem.
Comment by Dario Giovannetti (kynikos) - Tuesday, 16 August 2011, 00:22 GMT
dbus 1.4.14 does not fix this neither for me.
Comment by Daniel Micay (thestinger) - Tuesday, 16 August 2011, 12:01 GMT
Looks like I was wrong about this being fixed, it just worked a single time for an unknown reason.
Comment by solsTiCe (zebul666) - Sunday, 09 October 2011, 20:19 GMT
I still had the issue with dbus-1.4.16 and gnome 3.2 and nautilus-3.2, the later that throws 'not authorized' errors with usb keys.

see https://bbs.archlinux.org/viewtopic.php?id=128000
Comment by Leonid Isaev (lisaev) - Friday, 04 November 2011, 18:41 GMT
IMHO the only bug here is /etc/X11/xinit/xinitrc.d/30-dbus not exporting $DBUS_SESSION_BUS_ADDRESS, like /etc/xdg/xfce4/xinitrc does. If this variable is exported there shouldn't be any problem with xfce4 at least. In a running xfce4 session:

$ echo $DBUS_SESSION_BUS_ADDRESS
unix:abstract=/tmp/dbus-7IzVsp4eIi,guid=15f7f168a2d064877ba665d200000163/xdg/xfce4/xinitrc
$
$ grep -i dbus /etc
# Use dbus-launch if installed.
if test x"$DBUS_SESSION_BUS_ADDRESS" = x""; then
if which dbus-launch >/dev/null 2>&1; then
eval `dbus-launch --sh-syntax --exit-with-session`
# some older versions of dbus don't export the var properly
export DBUS_SESSION_BUS_ADDRESS
echo "Could not find dbus-launch; Xfce will not work properly" >&2
Comment by Vasili (3point2) - Monday, 12 March 2012, 15:24 GMT
adding "export DBUS_SESSION_BUS_ADDRESS" to the end of /etc/X11/xinit/xinitrc.d/30-dbus didn't seem to make any difference for me. commenting out the file entirely allows me to mount normally (i use xfce which launches dbus itself).
Comment by Leonid Isaev (lisaev) - Monday, 12 March 2012, 17:15 GMT
OK, revisiting this, it seems I misunderstood the problem, and you seem to have found the solution...

Anyway, the .xinitrc skeleton is totally wrong because dbus-launch has to be started AFTER ck session is initialized, otherwise thunar can't properly connect to polkit for authorization. That's why commenting 30-dbus worked for you. That's what .xinitrc is supposed to look like: "exec ck-launch-session startxfce4".
Comment by Andreas Radke (AndyRTR) - Friday, 06 April 2012, 15:11 GMT
Can we close this as "not a bug" ?
Comment by Leonid Isaev (lisaev) - Friday, 06 April 2012, 21:46 GMT
I'd say yes, since it looks like as a misconfig (unless we want to fix skel/.xinitrc)...
Comment by Dario Giovannetti (kynikos) - Friday, 06 April 2012, 22:10 GMT
I'm still experiencing the problem (system up to date): if it's not a bug then what is it? :P
https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines#Reasons_for_not_being_a_bug defines some reasons, which one are you referring to?
Maybe it could be closed as "upstream" and reported to https://bugs.freedesktop.org/ ?
Comment by Vasili (3point2) - Friday, 06 April 2012, 22:40 GMT
The only way I found to get mounting working correctly in xfce is to edit the default /etc/X11/xinit/xinitrc.d/30-dbus and comment it out. If this only affects xfce then at least this should be documented on the xfce wiki page. If the problem is the same with kde and gnome, then I'd say this is a bug and /etc/X11/xinit/xinitrc.d/30-dbus needs to be re-thought.
Comment by Daniel Micay (thestinger) - Friday, 06 April 2012, 22:51 GMT
Leaving the loop that runs files in xinitrc.d shouldn't break anything. There are other packages like libcanberra that put scripts in the directory.
Comment by Andreas Radke (AndyRTR) - Saturday, 07 April 2012, 05:49 GMT
What do our Xfce maintainers say?
Comment by Evangelos Foutras (foutrelis) - Saturday, 07 April 2012, 12:24 GMT Comment by Dario Giovannetti (kynikos) - Saturday, 07 April 2012, 13:25 GMT
I've tested this bug in GNOME and KDE in my VirtualBox testing system (up to date); note that my workaround for the bug is removing execute permissions to /etc/X11/xinit/xinitrc.d/30-dbus ; I tried to mount a virtual CD image with the respective file managers.
*GNOME/Nautilus:
When 30-dbus is executable I can't mount the drive (same problem as in Xfce/Thunar); but there's more: if I start GNOME with the image loaded in VirtualBox (but not mounted in the system) GNOME can't start in Shell mode, and starts in Fallback mode; if I load the image after GNOME has started, GNOME starts correctly in Shell mode.
When 30-dbus is not executable everything seems to work correctly (I can mount and unmount the drive in Nautilus).
*KDE/Dolphin:
Everything seems to work fine even with 30-dbus executable, although in either case I've not managed to eject the virtual CD with Dolphin without force-unmounting it.

EDIT: the lines used in .xinitrc are:
exec ck-launch-session gnome-session
exec ck-launch-session startkde
Comment by Leonid Isaev (lisaev) - Saturday, 07 April 2012, 16:10 GMT
@Evangelos: FWIW,I think removing 30-dbus (together with xinitrc.d -- is this dir needed for anything else?) is the best choice.

Different DE have different requirements regarding ck* and the only sane way is to make no assumptions about the order of ck-launch-session and dbus-launch on users' behalf.
Comment by Philip (nuc) - Sunday, 22 April 2012, 17:13 GMT
This Workaround DOES NOT work for my System! When I do not include "dbus-launch", I experience the common Problem.
This is what my .xinitrc looks like (I use SLiM as a Login-Manager):

if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi

case $1 in
openbox)
exec openbox-session
;;
xfce4|*)
exec ck-launch-session dbus-launch startxfce4
;;
esac


EDIT: As the new SLiM v. 1.3.3 now supports Console/PolicyKit, the ck-launch-session command isn't required anymore and thus I do not experience any further problems concerning this 'bug'.

my current xfce line in .xinitrc looks like this:
exec startxfce4

So using a Console/PolicyKit capable Display Manager is also a possible solution.
Comment by Piyush Bhatt (piyhatt) - Saturday, 19 May 2012, 19:08 GMT
I have 2 year old arch installation with gnome.
I am also facing problem with mounting partitions.I was searching for this problem in forums but was not able to find any thread and than i came here.
I have gnome3.4 now.
When i click on partitions in nautilus,it says "Unable to mount program files \n Not authorized to perform operation"

Problem is not only while mounting partitions.
Wherever we need authorization .Like changing date and time ,changing user accounts using gnome UI etc.The unlock button is greyed out permanently.

even i am not able to shutdown using gnome menus. it just log out only.
i run gnome using daemon method. not through xinitrc
Comment by Daniel Micay (thestinger) - Saturday, 19 May 2012, 19:57 GMT
It's unlikely this bug is relevant if you don't use xinitrc with the code to source scripts in xinitrc.d. There are other reasons why you would encounter those problems.
Comment by Piyush Bhatt (piyhatt) - Saturday, 26 May 2012, 01:03 GMT
That are other reason.How can i solve my problem.I tried to get answer in forum.But nobody replied.

https://bbs.archlinux.org/viewtopic.php?id=141849
Comment by Daniel Micay (thestinger) - Saturday, 26 May 2012, 01:09 GMT
If you don't get help on the forum, you should try IRC, you're much more likely to get an answer there because it's easier to help people through debugging. This isn't the place to be asking for help about this though.
Comment by Alexander F. Rødseth (xyproto) - Tuesday, 11 September 2012, 05:45 GMT
Is this still an issue? Thanks
Comment by Daniel Micay (thestinger) - Tuesday, 11 September 2012, 06:10 GMT
This is still an issue for people who use xorg-xinit and rely on consolekit.

However consolekit can be replaced by simply using systemd (which has logind) and making sure X starts on the same tty as the display manager or getty.
Comment by Andreas Radke (AndyRTR) - Saturday, 15 September 2012, 07:29 GMT
I tend to close this one "won't fix" because we have the successor systemd with an alternative login method.
Comment by Jan de Groot (JGC) - Thursday, 20 September 2012, 22:04 GMT
Do we actually still need this scriptlet? I removed it a while ago and GNOME still works fine.
Comment by Daniel Micay (thestinger) - Thursday, 20 September 2012, 22:11 GMT
It's definitely not needed since the session dbus will start on-demand, even in a minimal window manager.
Comment by Daniel Micay (thestinger) - Saturday, 20 October 2012, 19:21 GMT
Since consolekit is being dropped, this can just be closed.

Loading...