Programs run as root do not follow user theming

Bug #205201 reported by jeroenl on 2008-03-22
214
This bug affects 21 people
Affects Status Importance Assigned to Milestone
kdesudo (Ubuntu)
Low
Unassigned
Nominated for Karmic by MilchFlasche
Nominated for Lucid by Rafael Belmonte

Bug Description

Binary package hint: gtk-qt-engine

When starting applications in KDE3 from the command line as another user (e.g. root or another normal user) the gtk-qt-engine doesn't do his job, resulting in a ugly looking gtk application.

Example:

'kdesu firefox' will result in a ugly firefox.

In Gutsy and before, this didn't happen.

The gtk-qt-engine works fine when starting applications as the current logged in user.

da1l6 (da1l6) wrote :

Hello

Same problem here, but it's not only the gtk-qt-engine, theme configuration in kcontrol or systemsettings are completely ignored im that case.

kdesu synaptic or sudo synaptic

Start synaptic with GTK default theme.

da1l6

Hello

I have the same problem. It works for current logged user but not for another (sudo for example). I tried symlinking .gtk_qt_engine_rc and .gtkrc_2.0-kde files to same sources but they are ignored. Starting from command line or from kde menu (e.g synaptic) does not matter.

Here is the forum discussion about this:

http://ubuntuforums.org/showthread.php?t=637729

Anthony Mercatante (tonio) wrote :

The is due to kdesudo now loading the root profile instead of the user's one.
The old way to work was more efficient in your case, but cause lots of other issues, since config files in the user's profile where set to root UID/GID.

There is no known solution yet... gksu does the same way than kdesudo...

Changed in kdesudo:
status: New → Won't Fix
vanbosco (vanbosco) wrote :

Same problem here, but if i run from a root konsole "gksu synaptic" the gtk-qt-engine works fine.

jeroenl (jeroenl) wrote :

This is not acceptable.

Changed in kdesudo:
status: Won't Fix → Confirmed
jeroenl (jeroenl) wrote :

It is not acceptable that when starting a GTK-application under KDE as root, the appearance is very "ugly". Remember that although you can set a GTK or Gnome-theme, it doesn't use that theme when starting a application under KDE. Maybe you fix that latter one first, so at least it uses a prober theme.

It appears that explicitly setting the variable
# export GTK2_RC_FILES=/root/.gtkrc-2.0-kde:/root/.kde/share/config/gtkrc-2.0
is enough to make the problem disappear (on my system) for synaptic and wireshark.

If this variable is unset, Synaptic looks "ugly". I think that's a bug as I'd expect applications to find their defaults without the help of environment variables (and the default should not look ugly).

There's also GTK_RC_FILES, but I don't know what application uses this variable.

I strongly disrecommend symlink'ing any files from your regular $HOME to root's home, or vice-versa.

Prior to this, I've set root's "use my KDE style in GTK applications" via
#kcmshell kcmgtk
as was recommended somewhere -- and verified that it modified, /root/..., not my /home/... (cf. the ugly sudo issue).

>The is due to kdesudo now loading the root profile instead of the user's one.
This is a very sane thing to do.

>The old way to work [...] but cause lots of other issues, since
> config files in the user's profile where set to root UID/GID.
Indeed,
a) it caused failure to upgrade from Gutsy to Hardy because root owned
root:root /var/tmp/kdecache-hoehle/http/c/changelogs.ubuntu.com_meta-release_3c25dc09

b) find ~hoehle/. -user root -print
/home/hoehle/./.viminfo
/home/hoehle/./.aptitude/config
/home/hoehle/./.kde/share/config/adept_managerrc
Root rights have nothing to do in these files, they are mine ;)

Q: Howto detect whether your $HOME files are at risk?
A: as root, # cd
If it says /home/..., you maybe at trouble
If it says /root, you should be safe.
Also try # echo $HOME
# su - will take you into such a safe environment (but you'll have to set some variables to be able to start X applications that way).

You may consider adding "set_home" to /etc/sudoers, or systematically use sudo -H.

Well that only works when I use sux. With sudo (-H or not) it gives still the same "ugly" synaptic. Maybe it has to do with my whole root directory. So someone can tell me how to reset this directory, I like to try it again.

Juan Carlos I (juancarlos1) wrote :

Same problem here using a fresh install of Kubuntu 8.04 with kde3
Please comment if you have made any progress

luchio (luch3) wrote :

Would like to say that I have the same problem, hardy, upgraded from feisty, kde3. I did install kde4 for the kicks of it, but reverted to kde3.

Wagner Macedo (wagnerluis1982) wrote :

Here I resolved this problem symlinking ~/.gtkrc-2.0-kde to /root/.gtkrc-2.0

Code:
    sudo ln -s ~/.gtkrc-2.0-kde /root/.gtkrc-2.0

Xwang (xwang1976) wrote :

The bug is still present in kubuntu 8.10 (kde 4.1.4).
Symlinking files from user's home to root doesn't seem safe to me.
Maybe as a temporary workaround knowing which files define the style of applications (both qt and gtk) may be useful to copy them from the user home to root one.
In any way the above command:
sudo ln -s ~/.gtkrc-2.0-kde /root/.gtkrc-2.0
seems wrong; I think it should be:
sudo ln -s ~/.kde/share/config/gtkrc-2.0-kde /root/.kde/share/config/gtkrc-2.0
Do you agree?
Xwang

Changed in kdesudo:
importance: Undecided → Low
Jithin Emmanuel (jithin1987) wrote :

I solved this by simply copying ~/.gtkrc-2.0-kde4 to /root/.gtkrc-2.0
I think that that is a neat solution.

François (francois-letendre) wrote :

For me too, it worked. Thanks.
$ sudo cp ~/.gtkrc-2.0-kde4 /root/.gtkrc-2.0

dw40 (xoobxa) wrote :

This problem still exists in Karmic Kubuntu, even though gtk-qt-engine is now replaced by kcm-gtk. The workaround is still the same.
First you need to configure theme separately for root/sudo by starting system settings with command:

kdesudo systemsettings

The file .gtkrc-2.0-kde4 will be created in the root directory after you choose theme for GTK apps under the GTK Appearance. This file is worthless until you create .gthrc-2.0 symbolic link that points to it. For the security-conscious users out there, use the following command:

sudo ln -s /root/.gtkrc-2.0-kde4 /root/.gtkrc-2.0

This avoids linking user's file to root's file. I just hope that Kubuntu developers will some way, some how, make this work out of the box, so new users won't have to go through this. I've filed a bug report on this, but it is being mark as a duplicate of gtk-qt-engine bug.

https://bugs.launchpad.net/ubuntu/+source/kcm-gtk/+bug/406747

Raine (rainefan) wrote :

This bugs still is present on Jaunty. The #16 fix using 'kdesudo systemsettings' didn't resolved my problem since I have no 'GTK Appearance' on KDE SystemSettings.

Waht really worked is:
$ sudo cp ~/.gtkrc-2.0-kde4 /root/.gtkrc-2.0

Please dev team, resolve this unfortunate bug!

Regards,
Raine

Kenet Jervet (newelevenken) wrote :

Well I don't have much more to say as your solution works very fine.
The only thing I want to add is that there still might be some applications, such as ibus on my Karmic 9.10, that refuse work with gtk2-engines-qtcurve or gtk-qt-engine. In this case you can try "cp .gtkrc-2.0-kde4 .gtkrc-2.0" in your home directory as well as in /root/.

summary: - [Hardy] The gtk-qt-engine doesn't work while staring applications as
- another user
+ Programs run as root do not follow user themeing
summary: - Programs run as root do not follow user themeing
+ Programs run as root do not follow user theming
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers