You are not logged in.
Pages: 1
Topic closed
I think few days ago when I'm installing something, I might have screwed up some of my settings which now does not allow me to run certain stuffs.
Here is the problem below:
[dtyj@archlinux ~]$ sudo gedit
[sudo] password for root:
Unable to init server: Could not connect: Connection refused
(gedit:12380): Gtk-WARNING **: cannot open display: :0.
The above does not allow me to open gedit.
I've tried some solution like xhost and it still doesn't work, perhaps someone can shed some light on this?
Thanks!
Last edited by dtyj (2016-10-29 12:52:21)
Offline
Have you tried gnome on xorg?
As of a recent update, gnome defaults to using wayland instead of xorg. The laundry list of breakage this has caused seems immeasurable.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Have you tried gnome on xorg?
As of a recent update, gnome defaults to using wayland instead of xorg. The laundry list of breakage this has caused seems immeasurable.
Hmm, not idea what you meant. I'm still pretty much new to this Arch Linux thing
Here's a screenshot if that helps, http://imgur.com/a/kt2k1
Last edited by dtyj (2016-10-29 13:07:19)
Offline
It's fine to not know what I meant. It's less fine to not have bothered to follow the link I provided which would help you learn and know exactly what I meant. The screenshot really doesn't help. You did a good job of describing the problem in the first post - the cause of the problem is almost certainly related to gnome running on wayland. I gave you the means to test that possibility. Please do so.
EDIT: actually, on second look maybe this isn't a wayland issue if it only happens when using sudo: you should not run gui programs (especially gtk ones) with sudo, use gksu.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
It's fine to not know what I meant. It's less fine to not have bothered to follow the link I provided which would help you learn and know exactly what I meant. The screenshot really doesn't help. You did a good job of describing the problem in the first post - the cause of the problem is almost certainly related to gnome running on wayland. I gave you the means to test that possibility. Please do so.
EDIT: actually, on second look maybe this isn't a wayland issue if it only happens when using sudo: you should not run gui programs (especially gtk ones) with sudo, use gksu.
Okay here's what I have done so far.
I've created a new file at ~/.xinitrc with the following content: exec gnome-session
and I ran startx after that and it gave me this error:
[dtyj@archlinux ~]$ startx
xauth: file /home/dtyj/.Xauthority does not exist
xauth: file /home/dtyj/.Xauthority does not exist
/usr/lib/xorg-server/Xorg.wrap: Only console users are allowed to run the X server
^Cxinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: unexpected signal 2
Couldn't get a file descriptor referring to the console
---
Note: My current setup was using Xorg.
Thank you!
Offline
Hello there , I have similar problem, I just installed Arch Linux and gnome on Xorg ,now my problem is i want to use gedit with root privileges
when I open gedit as a normal user there's no problem but when I use it as root or with sudo or gksu (i dont know what gksu just read somewhere it might be useful)
i get the following error :
Unable to init server: Could not connect: Connection refused
(gedit:1659): Gtk-WARNING **: cannot open display:
Thank you.
Last edited by kourosh.daryaee (2016-10-29 15:12:43)
Offline
Because gnome session will default to wayland. Doesn't work on Xorg for obvious reasons.
Have you ever (notably when writing the OP) managed to boot into a graphical session?
For a beginner, it's better to use a DM (GDM, if you prefer gnome) to achieve that. (See the install guide on the wiki)
Starting a GUI process from a VT (thing that looks like DOS) won't work (easily and certainly not if there's no running display server), so ensure to log into a graphical session first. The report on remaining problems.
Online
Thank you. installed GDM and changed DISPLAY environment to :1 and it worked.
export DISPLAY=:1
Offline
Okay here's what I have done so far.
I've created a new file at ~/.xinitrc with the following content: exec gnome-session
and I ran startx after that and it gave me this error:[dtyj@archlinux ~]$ startx
I don't know where you got this idea - you can't startx from within gnome. I linked to the gnome article about running gnome under X (not trying to start X under gnome).
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
I too am facing the same issue as OP:
$ sudo nautilus
No protocol specified
Unable to init server: Could not connect: Connection refused
(nautilus:1627): Gtk-WARNING **: cannot open display: :0
I cannot open any gui, like gedit, nautilus etc using SUDO. However, I can if I SU.
(I have always used 'sudo'. Mine is a two/three year old Arch-gnome install, with GDM).
I suspect some SUDO issue with X-applications.. Will look further into the issue later, meanwhile any help is welcome.
(For now, lets say, 'gksu' is not an option)
Regards
"Evolution is the nature's way of issuing upgrades".
__________________________________________________________
Arch_x64-Gnome-Shell ~ Arch-lts_x64-Xfce ~ LMDE_x64-Cinnamon
Offline
dtyj wrote:Okay here's what I have done so far.
I've created a new file at ~/.xinitrc with the following content: exec gnome-session
and I ran startx after that and it gave me this error:[dtyj@archlinux ~]$ startx
I don't know where you got this idea - you can't startx from within gnome. I linked to the gnome article about running gnome under X (not trying to start X under gnome).
Well I'm sorry if I'd misinterpreted the instructions (After editing the ~/.xinitrc file, GNOME can be launched with the startx command ). The stuff that I'd tried it's still not working, running under gksu (also shows the same error, "Gtk-Warning **: cannot open display : :0."), and after rebooting still shows the same error).
Offline
I too am facing the same issue as OP
Do you log into gnome on wayland (which is now the default) or gnome on X11?
Either way, a naive "sudo" will not work with most GUI processes, you'll *at least* have to preserve the environment
sudo -E nautilus
This however is a security problem, that's why the GUI elevations exist (they preserve only the relevant stuff and do some more)
On top of this, there should be no reason at all to run nautilus as root.
Online
The stuff that I'd tried it's still not working, running under gksu (also shows the same error, "Gtk-Warning **: cannot open display : :0."), and after rebooting still shows the same error).
You've still not said whether this is on wayland. If you log into gnome and didn't explicitly choose "gnome on xorg" on login, the answer is "yes" and you can expect this and more trouble.
Online
dtyj wrote:The stuff that I'd tried it's still not working, running under gksu (also shows the same error, "Gtk-Warning **: cannot open display : :0."), and after rebooting still shows the same error).
You've still not said whether this is on wayland. If you log into gnome and didn't explicitly choose "gnome on xorg" on login, the answer is "yes" and you can expect this and more trouble.
It was logged into as gnome,and I've tried as gnome on xorg but the problem still persist.
Offline
it isn't just a security problem, it's also known to cause permission problems, changing ownership of certain user files to root, preventing running a graphical session without chowning the user's home folder to them.
the first thing I would try, knowing that the user consistently runs gui apps using sudo is to chown the user's files back to them
sudo chown $USER:$GROUPS $HOME
Offline
fantab wrote:I too am facing the same issue as OP
Do you log into gnome on wayland (which is now the default) or gnome on X11?
Either way, a naive "sudo" will not work with most GUI processes, you'll *at least* have to preserve the environment
sudo -E nautilus
This however is a security problem, that's why the GUI elevations exist (they preserve only the relevant stuff and do some more)
On top of this, there should be no reason at all to run nautilus as root.
Thanks seth.
I use default, wayland.
'sudo' worked fine until a couple of days back (and its been working since I've been using linux). its only since yesterday that I have come across this issue.
sudo -E works.
I mostly use gedit as root, but I do rarely use Nautilus too as root. I find it simpler when editing multiple files as root.
regards..
"Evolution is the nature's way of issuing upgrades".
__________________________________________________________
Arch_x64-Gnome-Shell ~ Arch-lts_x64-Xfce ~ LMDE_x64-Cinnamon
Offline
It was logged into as gnome,and I've tried as gnome on xorg but the problem still persist.
OK, stay for gnome on xorg for the moment and post the *exact* command(s) you tried to execute.
And please confirm that this is only a problem with priv elevation, ie. if you try to execute something as root.
Also mind my other comment itr, you should not and not have to run graphical processes as root. Bad idea.
Online
sudo -E worked for nautilus but was not working for gparted
running xhost +local: fixed all things for me for current session.
Offline
Offline
Pages: 1
Topic closed