You are not logged in.

#1 2013-11-04 23:21:58

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

[solved] can't start GUI apps from shell as ROOT

hey,

somehow, i can't start any GUI applications from command line as root anymore. The $DISPLAY variable is empty which might be the reason or at least connected to the problem.

It works perfectly fine as normal user and i can even use sudo to start GUI software with root priviliges. But as soon as i want to do it directly as root, nothing happens.

I just set up a brand new system and i am using systemd, then autologin via agetty on tty1 and triggering startx via .zprofile (zsh). my .xinitrc reads exec awesome.

Any idea how to give my root display access from shell again?
Thanks

P.S.: I think what i need might be multi user support for xorg. I'd be glad if someone could give me a hint, i'm having trouble finding info on that.

Last edited by demian (2013-11-05 14:00:01)


no place like /home
github

Offline

#2 2013-11-05 00:05:57

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved] can't start GUI apps from shell as ROOT

Why do you want to do this in the first place?
https://wiki.archlinux.org/index.php/Ru … ps_as_root

Offline

#3 2013-11-05 00:34:46

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: [solved] can't start GUI apps from shell as ROOT

yeah, it's bad practice, i know. it's just lazyness on my part. i'll try that article, thanks!


no place like /home
github

Offline

#4 2013-11-05 13:49:06

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: [solved] can't start GUI apps from shell as ROOT

okay i tried everything in that wiki article including the discussion part.

The problem is in fact the $DISPLAY variable. It won't stay for root.

Right now, the only way it works if i prepend any GUI action as root with DISPLAY=:0, e.g. DISPLAY=:0 medit .zshrc

i'll have another look around the web, hopefully i can mark this solved, soon


no place like /home
github

Offline

#5 2013-11-05 13:52:59

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,737
Website

Re: [solved] can't start GUI apps from shell as ROOT

Iqm assuming you're logging in as a "normal" user, so how are you switching to the root user? Are you using one of the methods described in the wiki page that Karol linked?

Do you have anything in root's shell config files that may be unsetting the DISPLAY variable when they're sourced?


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2013-11-05 13:59:45

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: [solved] can't start GUI apps from shell as ROOT

i'm switching to root via su.

somehow, it works now. i did pretty much everything described in the wiki article and then once again exported DISPLAY=:0 in my roots .zshrc (which didn't work before at all).

But i still find it curious. I never used to have to explicitly export DISPLAY as root to have X access. Oh, well, marking as solved. Thanks everyone.

Last edited by demian (2013-11-05 14:01:35)


no place like /home
github

Offline

#7 2013-11-05 16:03:13

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: [solved] can't start GUI apps from shell as ROOT

Why not use gksu to run gui applications as root?

Offline

#8 2013-11-06 00:35:26

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: [solved] can't start GUI apps from shell as ROOT

anonymous_user wrote:

Why not use gksu to run gui applications as root?

I dont think you can run gksu if you are already logged in as root (which was the situation in question).


no place like /home
github

Offline

#9 2013-11-06 00:38:16

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: [solved] can't start GUI apps from shell as ROOT

I suppose my question is why you use a root shell rather than stay in a user shell and just use gksu?

Offline

#10 2013-11-07 08:23:15

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] can't start GUI apps from shell as ROOT

anonymous_user wrote:

Why not use gksu to run gui applications as root?

I never used gksu but gksudo. Any objections why I should use gksu over gksudo or are they basically the same?

Offline

#11 2013-11-07 08:33:12

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,737
Website

Re: [solved] can't start GUI apps from shell as ROOT

gksudo uses sudo as a backend, gksu uses su. It depends on your personal preference.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#12 2013-11-07 09:17:50

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] can't start GUI apps from shell as ROOT

Interesting. I just tried gksu subl3 to start Sublime Text Editor as root. But it does not open an GUI whereas gksudo subl3 does (first it shows me the password prompt).

Offline

#13 2013-11-07 11:25:20

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,737
Website

Re: [solved] can't start GUI apps from shell as ROOT

That's strange. What behaviour do you experience with gksu? Do you get an error or anything? Can you use 'su' by itself?

gksudo is just a symlink to gksu, there shouldn't be that big a difference in behaviour between the two.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#14 2013-11-07 19:18:46

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] can't start GUI apps from shell as ROOT

No error. There is simply nothing happening. I can properly use su.

~ $ gksu subl3

~ $ su
Password: 
[root@thinkpad orschiro]# 

Offline

#15 2013-11-07 19:26:27

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,737
Website

Re: [solved] can't start GUI apps from shell as ROOT

You should probably open a new topic about it if you want to get to the bottom of it, it's not going to get a lot of attention in this solved topic. You could try running it with strace to see if that reveals anything.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB