You are not logged in.

#1 2016-12-31 09:11:38

tux1999
Member
Registered: 2016-12-31
Posts: 2

[SOLVED] Gedit: Unable to init server, cannot open display: :0

Hello,

I'm not sure what mistake I did in the Terminal, but I can't start gedit with sudo in the Terminal:

[tux@Pi]$ sudo gedit /etc/default/grub
No protocol specified
Unable to init server: Verbindung ist gescheitert:Verbindungsaufbau abgelehnt

(gedit:1731): Gtk-WARNING **: cannot open display: :0

It is still possible to start gedit via Terminal without sudo.

Thank you.

Last edited by tux1999 (2016-12-31 13:35:08)

Offline

#2 2016-12-31 12:15:35

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Gedit: Unable to init server, cannot open display: :0

You shouldn't use sudo for graphical applications, use gksudo instead. Although this still may not  work if you're using Gnome on Wayland.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2016-12-31 13:06:37

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: [SOLVED] Gedit: Unable to init server, cannot open display: :0

Your hostname seems to be "Pi". Is this on a Raspberry Pi? If that is the case you should ask on the Arch Linux ARM forum. https://bbs.archlinux.org/viewtopic.php?id=153431


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#4 2016-12-31 13:19:47

tux1999
Member
Registered: 2016-12-31
Posts: 2

Re: [SOLVED] Gedit: Unable to init server, cannot open display: :0

fsckd wrote:

Your hostname seems to be "Pi". Is this on a Raspberry Pi? If that is the case you should ask on the Arch Linux ARM forum. https://bbs.archlinux.org/viewtopic.php?id=153431

No, "Pi" stands for the mathematical constant Pi. I'm not running a Raspberry Pi

Last edited by tux1999 (2016-12-31 13:21:14)

Offline

#5 2017-01-02 20:29:11

FalkAlexander
Member
Registered: 2016-05-25
Posts: 3

Re: [SOLVED] Gedit: Unable to init server, cannot open display: :0

tux1999 wrote:

It is still possible to start gedit via Terminal without sudo.

I guess you are using the Gnome Wayland Session. Running applications under a different user (e.g. root) is not possible in the traditional way when using Wayland.
However, you can go into Nautilus/Files and enter in the location bar (open it with ctrl+L):

admin:///

A password prompt will open, and after entering your password, you can browse and edit everything with root rights. If you open now for example the /etc/default/grub file from Nautilus/Files, Gedit/Texteditor will ask you for your password again. Now you can edit this file with root rights.

Another way is, to use the following into your terminal (its always the same pattern):

gedit admin:///etc/default/grub

You do not need to write sudo/su or anything else in front of it.

Keep in mind, this admin:/// way only works with the GNOME environment, and therefore with GNOME applications.
All other desktop environments do not have any way for the root thing yet.


Greetings/Grüße

Offline

#6 2017-04-03 13:23:09

entodoays
Member
From: Malta
Registered: 2014-10-25
Posts: 118

Re: [SOLVED] Gedit: Unable to init server, cannot open display: :0

Thanks for this tip.

However I use geany as my default text editor.

When I try to open

/etc/fstab

from nautilus using the first method, the file opens with Libreoffice writer and not Geany. If I try to use "open with " from the context menu Geany lauches but doesn't open the file.

When I try

geany admin:///etc/fstab

I receive a "file not found" error.

Offline

Board footer

Powered by FluxBB