Bug 353263

Summary: No icons show on root session. unable to assign any too.
Product: [Applications] kdesudo Reporter: Eyal Porat <eyal.por>
Component: generalAssignee: Jonathan Riddell <jr>
Status: RESOLVED WORKSFORME    
Severity: normal CC: amubtdx, bruno+kde, capitan.zap, frank78ac, ilyes.spd, jasonwert, kde-software, kubry, leszek.lesner, m, mityi, postboxwa, reeves.87, stgparris, stu109382, terry.horridge, white.russ
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: strace -o dolphin_strace.txt dolphin

Description Eyal Porat 2015-09-28 07:11:31 UTC
I am using Kubuntu 15.04.
When I open Dolphin as root no icons can be seen anywhere - apart from Libre Office files(!).
Tried to assign different icons separately but to no avail.
Preview pane works fine... showing icons and images.
Note: the previous version of Dolphin crashed when tried to load as root via kdesu (opened OK from console using sudo - without icons).
After updating to current version 15.08.1 it opens but as described above).

Reproducible: Always

Steps to Reproduce:
1. set command in "edit application" to kdesu dolphin.
2. start Dolphin from Application Launcher.

1 . Alt. - run sudo Dolphin from console.

Actual Results:  
Dolphin opens up without any icons - either on left pane (Places, recently saved, search for etc).
Right pane works fine.

Expected Results:  
See all folders and files with icons next to them.
Comment 1 Frank Reininghaus 2015-09-28 15:47:59 UTC
Thanks for the bug report. Do you see the icons in the file dialog of, e.g., KWrite if you start is as root?
Comment 2 Eyal Porat 2015-09-28 19:24:14 UTC
 Frank Reininghaus 2015-09-28 15:47:59 UTC
Thanks for the bug report. Do you see the icons in the file dialog of, e.g., KWrite if you start is as root?
Tried with Kate - OK.
In the mean time I use Krusader as root. Also no problems.
Comment 3 stu109382 2015-10-23 17:10:39 UTC
I am having the same issue with newly installed Kubuntu 15.10
Comment 4 mityi 2015-11-13 21:31:41 UTC
i can confirm this
Comment 5 Alexis Murzeau 2015-11-28 15:50:57 UTC
Created attachment 95786 [details]
strace -o dolphin_strace.txt dolphin

I can reproduce this too.

With a root session, dolphin only search for icons in hicolor theme.

See also the strace attachment dolphin_strace.txt.
The scenario was:
#strace -o dolphin_strace.txt dolphin
then close dolphin
Comment 6 Leszek Lesner 2015-12-08 09:42:06 UTC
I can confirm that aswell on Netrunner 17
Comment 7 Leszek Lesner 2015-12-08 10:26:54 UTC
As a workaround I found that executing 
kdesudo -c "KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true  dbus-launch dolphin" 
works like expected. 
Seems like kdesudo isn't giving its command the correct env variables.
Comment 8 Frank Reininghaus 2015-12-09 20:20:15 UTC
(In reply to Leszek Lesner from comment #7)
> As a workaround I found that executing 
> kdesudo -c "KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true  dbus-launch
> dolphin" 
> works like expected. 
> Seems like kdesudo isn't giving its command the correct env variables.

Thanks for the update, I'll reassign it to kdesudo then.

See also https://mail.kde.org/pipermail/kde-frameworks-devel/2015-December/029228.html
Comment 9 Michael Tunnell 2016-01-26 01:44:08 UTC
I too have this problem when using kdesudo combined with dolphin.

I also tested elevating to root via "sudo su" and then launching dolphin, the same error happens there as well.

I ran the suggested workaround in comment #7 without kdesudo and can confirm that the workaround of "KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dbus-launch dolphin" running with sudo su works properly with the icons.

I'm not sure if this helps narrow it down but perhaps this means that it's not directly related to kdesudo.
Comment 10 Jason Wertenberger 2016-02-02 02:12:52 UTC
I can also confirm this error. Seeing it on Kubuntu 15.10 and fresh install with Neon ppa.

Launching any kde5 app (systemsettings5 or dolphin) with  "kdesudo -c "KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true  dbus-launch ..." does fix the issue.
Comment 11 Jason Wertenberger 2016-02-02 12:22:21 UTC
Is there any config file that "KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true" can be added so that it doesn't need to be run at the time the kde5 application is launched?
Comment 12 Bruno P. 2016-03-23 09:00:28 UTC
Jason, as workaround you can create a file named /etc/sudoers.d/workaround_kde5 :

Defaults env_keep += "KDE_SESSION_VERSION KDE_FULL_SESSION"

I have no idea why those variables are now needed…
Comment 13 Jason Wertenberger 2016-03-24 01:26:06 UTC
Thank you so much, Bruno! That completely did the trick.

-jason
Comment 14 Elvis Angelaccio 2016-06-04 14:31:54 UTC
*** Bug 362045 has been marked as a duplicate of this bug. ***
Comment 15 michael 2016-06-17 21:50:36 UTC
The workaround fixes it for me too. In my case actually logging in as root from lightdm works as well but presents more of a risk.
Comment 16 Terry Horridge 2016-08-04 15:53:57 UTC
I have also seen this same issue in Kubuntu 16.4.1.  The patch in comment 12 entirely fixes it.
Comment 17 Graham 2016-10-28 12:18:56 UTC
(In reply to Bruno Patri from comment #12)
> Jason, as workaround you can create a file named
> /etc/sudoers.d/workaround_kde5
> 
> Defaults env_keep += "KDE_SESSION_VERSION KDE_FULL_SESSION"
> 
> I have no idea why those variables are now needed…

I have tried this in Neon 5.8.2 and cannot see any effect. I have to use the long kdesudo command in comment 7.

I have no idea why the file doesn't work, found several ways to make it on different sites, but nothing worked.
Comment 18 michael 2016-10-29 19:36:01 UTC
For those who don't know /etc/sudoers.d/ is specific to Debian based distros like Kubuntu. Non debian based distros do not necessarily load files in this folder by default. /etc/sudoers should be used on theses systems. This file can also be read on Debian based systems but may be overwritten after an update.
Comment 19 Russ White 2016-10-30 18:37:48 UTC
I have confirmed that creating a file in /etc/sudoers.d with 

  Defaults env_keep += "KDE_SESSION_VERSION KDE_FULL_SESSION"

fixes the issue for programs launched using sudo however theme/style/icons/etc are still missing if launched using kdesudo.  Is there something that differentiates them?  I was under the impression that kdesudo was just the GUI version of sudo.
Comment 20 Ilyes Kechidi 2016-11-12 20:09:29 UTC
(In reply to Russ White from comment #19)
> I have confirmed that creating a file in /etc/sudoers.d with 
> 
>   Defaults env_keep += "KDE_SESSION_VERSION KDE_FULL_SESSION"
> 
> fixes the issue for programs launched using sudo however
> theme/style/icons/etc are still missing if launched using kdesudo.  Is there
> something that differentiates them?  I was under the impression that kdesudo
> was just the GUI version of sudo.

I found that changing the HOME environment variable fixes problem

try executing kdesudo -c "HOME=$HOME dolphin"
Comment 21 Ganton 2017-04-21 07:17:32 UTC
Thank you very much, Ilyes!

Note: A user can e.g. execute
    kdesudo -c "HOME=/root partitionmanager"
to launch KDE Partition Manager if he wants it to use root's theme. (*)

(*) Because the user wants to visually make prominent the graphical programs which are executed with privileges, or because the user utilizes a dark theme but KDE Partition Manager works better with a non-dark theme, etc.

In that case the KDE Menu Editor can be used to change the existing "KDE Partition Manager" entry, but disabling the "Advanced" > "Run as different user" checkbox because "kdesudo" is already being used.
Comment 22 GHPS 2017-04-22 10:34:34 UTC
(In reply to Bruno Patri from comment #12)
> Jason, as workaround you can create a file named
> /etc/sudoers.d/workaround_kde5 :
> Defaults env_keep += "KDE_SESSION_VERSION KDE_FULL_SESSION"
> I have no idea why those variables are now needed…
Great - thanks for getting this fixed.

Hint: I spend one hour to get this working since I used "workaround_kde5.txt" as a file name following these instructions [1]. But the README states it clearly: Only files without ~ and . are included.

After creating the patch file make sure that both environment variables are present in the sudo session with

sudo -i
env

1: https://askubuntu.com/questions/690201/icons-not-showing-on-sudo-dolphin-on-15-10
Comment 23 Justin Zobel 2022-11-04 03:10:14 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 24 GHPS 2022-11-07 14:09:48 UTC
> If you can reproduce the issue, please change the status to "REPORTED" when
> replying. Thank you!

It is no longer possible to reproduce this bug since

"Executing Dolphin with sudo is not possible due to unfixable security vulnerabilities."
Comment 25 Bug Janitor Service 2022-11-22 05:12:40 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 26 Bug Janitor Service 2022-12-07 05:12:16 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!