Bug 2438

Summary: export $(dbus-launch) problem for 'su' root login - many applications need 'su -' login for running as root
Product: Mageia Reporter: Edward d'Auvergne <true.bugman>
Component: RPM PackagesAssignee: Mageia Bug Squad <bugsquad>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: Normal CC: balcaen.john, dmorganec, marja11, tmb
Version: 1   
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: coreutils CVE:
Status comment:

Description Edward d'Auvergne 2011-08-16 14:45:21 CEST
Running Konsole in KDE, and logging in as root via 'su' is broken.  For example:

[root@localhost ~]# okteta 
okteta(24724): Session bus not found 
To circumvent this problem try the following command (with Linux and bash) 
export $(dbus-launch) 

KCrash: Application 'okteta' crashing...
KCrash: Attempting to start /usr/lib64/kde4/libexec/drkonqi from kdeinit
sock_file=/root/.kde4/socket-localhost.localdomain/kdeinit4__0
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/lib64/kde4/libexec/drkonqi directly
drkonqi(24726): Session bus not found 
To circumvent this problem try the following command (with Linux and bash) 
export $(dbus-launch) 

[root@localhost ~]# 



Typing:

# export $(dbus-launch)

fixes the problem.  This also affects gvim (https://bugs.mageia.org/show_bug.cgi?id=2216) and other programs.  As in that bug report, logging in with 'su -' is a fix.  But this was never needed before (ever since I've been using Redhat 4.2), so saying that one should type 'su -' now is not very convincing ;)  This is likely to be a dbus configuration issue.
Comment 1 D Morgan 2011-10-01 14:46:21 CEST
this was not needed before because apps weren't using dbus.

CC: (none) => dmorganec

Comment 2 Manuel Hiebel 2011-10-04 19:37:55 CEST
So closing this as wontfix/invald ? (same for bug 2216)
Comment 3 Edward d'Auvergne 2011-10-04 21:08:50 CEST
Comment 1 (https://bugs.mageia.org/show_bug.cgi?id=2438#c1), that this wasn't a problem before, does not mean that the bug does not exist!  A possible solution to such a bug could be to modify the /etc/profile script (or the scripts in /etc/profile.d) to include the line:

export $(dbus-launch)

Now, if all apps now have been shifted to using dbus when they were not previously - something I'm not so sure about because KDE4 switched to dbus a long, long time ago, and Gnome has been using it for even longer - then all other distros out there should experience the same problem.  You can also see the antiquity of this problem for KDE here, back in 2006:

http://lists.kde.org/?l=kde-devel&m=115126548105346&w=2

The environmental variable DBUS_SESSION_BUS_ADDRESS is the problem.  I've just tested on a VM of Mandriva 2008 Spring.  Log in as a user, and type in Konsole:

env | grep BUS

Then log in using 'su' and type the same thing.  On Mandriva 2008, the variable is inherited from the user and is the same value for the user and root.  On Mageia, the value is different.  How this bug was introduced in the transition from Mandriva to Mageia, I do not know.  But this bug is very much real!
Manuel Hiebel 2011-10-30 12:14:35 CET

Source RPM: (none) => dbus

Comment 4 Marja Van Waes 2011-12-24 22:50:46 CET
Changed the summary to "..... cannot launch okteta", because the gvim issue got fixed and no other programs with this issue were named.

@ Mikala

Assigning to you, because I hope you can solve this on the okteta side :)

Please assign back to bugsquad, or preferably to someone who can fix this, if I'm wrong.

Please set status to ASSIGNED if you think this bug was assigned correctly. If for workflow reasons you can't do that, then please put OK on the whiteboard instead.

The problem still exists in Mageia 1.
Out of curiousness, I not only tried with su, but with su - , too, but that didn't help much:

[marja@DenkBlok2 ~]$ su
Password: 
[root@DenkBlok2 marja]# okteta
okteta(26928): Session bus not found 
To circumvent this problem try the following command (with Linux and bash) 
export $(dbus-launch) 

KCrash: Application 'okteta' crashing...
KCrash: Attempting to start /usr/lib64/kde4/libexec/drkonqi from kdeinit
sock_file=/root/.kde4/socket-DenkBlok2/kdeinit4__0
Warning: connect() failed: : No such file or directory
KCrash: Attempting to start /usr/lib64/kde4/libexec/drkonqi directly
drkonqi(26929): Session bus not found 
To circumvent this problem try the following command (with Linux and bash) 
export $(dbus-launch) 

[root@DenkBlok2 marja]# exit
[marja@DenkBlok2 ~]$ su -
Password: 
[root@DenkBlok2 ~]# okteta
okteta(29822)/kdeui (kdelibs): Attempt to use QAction "" with KXMLGUIFactory! (15x the above line)
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
kbuildsycoca4 running...
kbuildsycoca4(29853) KConfigGroup::readXdgListEntry: List entry Categories in "/usr/share/applications/gcalctool.desktop" is not compliant with XDG standard (missing trailing semicolon).
kbuildsycoca4(29853) KConfigGroup::readXdgListEntry: List entry Categories in "/usr/share/applications/kde4/Kontact.desktop" is not compliant with XDG standard (missing trailing semicolon).
kbuildsycoca4(29853)/kdecore (services) KServicePrivate::init: The desktop entry file  "/usr/share/applications/kde4/trash.desktop"  has Type= "Link"  instead of "Application" or "Service"

kbuildsycoca4(29853) KBuildServiceFactory::createEntry: Invalid Service :  "/usr/share/applications/kde4/trash.desktop"
Undecodable sequence: \001b(hex)[36l

CC: (none) => marja11
Assignee: bugsquad => balcaen.john
Summary: export $(dbus-launch) problem for 'su' root login - cannot launch programs with GUIs. => export $(dbus-launch) problem for 'su' root login - cannot launch okteta.
Source RPM: dbus => kdesdk4-4.6.5-0.mga1.src.rpm, dbus

Comment 5 John Balcaen 2011-12-25 04:38:21 CET
I don't know how i can fix okteta if the environnement is not correctly setup.
the problem is more in a change in su.
Please note that it does work here with su - under both Mageia 1 & Mageia cauldron.

CC: (none) => balcaen.john
Assignee: balcaen.john => bugsquad

Comment 6 John Balcaen 2011-12-25 05:04:17 CET
Just for the record mandriva 2008 is using coreutils 6.9 while mageia 1 is using coreutils 8.8.
I also just tested on a fedora 16 & the behaviour can be reproduced aka
okteta can't be launched under root if you switch to root using su, using su - allow the root user to launch okteta.
I guess we can imagine some change in su behaviour between coreutils 6.9 & coreutils 8.8.
Fedora 16 is using coreutils 8.12
Comment 7 Marja Van Waes 2011-12-25 09:38:27 CET
Thanks John :)

My environment was undoubtedly set up wrong, sorry. I didn't even know okteta exists before reading this bug report ;)

Edward already confirmed (I should have seen that before making my comment about su - not working well for me, it would have kept me from trying) that su - worked for him :)

@ tmb

This changed su behaviour, is that something that was decided upstream and won't be reverted?

CC: (none) => tmb
Source RPM: kdesdk4-4.6.5-0.mga1.src.rpm, dbus => coreutils

Comment 8 Marja Van Waes 2012-03-15 21:46:34 CET
lowering severity to normal, because it works with su -

Severity: major => normal

Comment 9 Edward d'Auvergne 2012-03-15 22:14:47 CET
This does not just affect okteta.  Here is a partial list:

gvim
okteta
konsole
dolphin
evince
gedit

Well, most X apps fail.  The KDE apps have messages such as (this is from dolphin):

-----
unnamed app(15809): KUniqueApplication: Cannot find the D-Bus session server:  "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."

unnamed app(15808): KUniqueApplication: Pipe closed unexpectedly.
-----

and the Gnome apps messages such as (this if from evince):

-----
Failed to get bus connection: The connection is closed
**
GLib-GIO:ERROR:gdbusconnection.c:2279:initable_init: assertion failed: (connection->initialization_error == NULL)
Aborted
-----

Hopefully this is already fixed in the coreutils version which will ship with Mageia 2.
Comment 10 Marja Van Waes 2012-03-17 17:35:26 CET
(In reply to comment #9)
> This does not just affect okteta.  Here is a partial list:
> 
> gvim
> okteta
> konsole
> dolphin
> evince
> gedit
> 

To be honest, even if it is a bug and this was not intended, for me this is an improvement.

I'm not always aware that I'm root when I launch an application. so that many of them fail now and force me to do su -, makes that I can still launch them as root when needed, but that I can't *accidentally* launch them as root.

I'll try to remember to check when I run Mga2b2
Marja Van Waes 2012-03-17 17:37:23 CET

Summary: export $(dbus-launch) problem for 'su' root login - cannot launch okteta. => export $(dbus-launch) problem for 'su' root login - many applications need 'su -' login for running as root

Comment 11 Edward d'Auvergne 2012-03-17 18:53:54 CET
It's not a very fail safe way of protecting the root user from launching applications.  There are a number that give the dbus error message, but launch anyway.  And there are others that launch without problem (e.g. Libreoffice).

It is more of an annoyance though, as my instinct is to type 'su' to launch applications as root, as I have been doing this since 1997 (Redhat 4.1 Vanderbilt days).
Comment 12 Marja Van Waes 2012-03-17 21:41:34 CET
On i586 in cauldron, with "su" I get the dbus error when trying to start dolphin, and with "su -" I get 

"dolphin: cannot connect to X server".

So it seems it got worse.

If someone can confirm this, a new bug report should be opened for cauldron (this one can be cloned and adapted)
Comment 13 Manuel Hiebel 2012-11-05 16:52:46 CET
This message is a reminder that Mageia 1 is nearing its end of life. 
In approximately 25 days from now, Mageia will stop maintaining and issuing 
updates for Mageia 1. At that time this bug will be closed as WONTFIX (EOL) if it 
remains open with a Mageia 'version' of '1'.

Package Maintainer: If you wish for this bug to remain open because you plan to 
fix it in a currently maintained version, simply change the 'version' to a later 
Mageia version prior to Mageia 1's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not 
be able to fix it before Mageia 1 is end of life.  If you would still like to see 
this bug fixed and are able to reproduce it against a later version of Mageia, 
you are encouraged to click on "Version" and change it against that version 
of Mageia.

Although we aim to fix as many bugs as possible during every release's lifetime, 
sometimes those efforts are overtaken by events. Often a more recent Mageia 
release includes newer upstream software that fixes bugs or makes them obsolete.

--
Mageia Bugsquad
Comment 14 Manuel Hiebel 2012-12-02 14:32:14 CET
Mageia 1 changed to end-of-life (EOL) status on ''1st December''. Mageia 1 is no 
longer maintained, which means that it will not receive any further security or 
bug fix updates. As a result we are closing this bug. 

If you can reproduce this bug against a currently maintained version of Mageia 
please feel free to click on "Version" change it against that version of Mageia and reopen this bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

--
Mageia Bugsquad

Status: NEW => RESOLVED
Resolution: (none) => WONTFIX