Main Page | Report this Page
Linux Forum Index  »  Linux Setup  »  "E233: cannot open display" when starting gvim on...
Page 1 of 1    

"E233: cannot open display" when starting gvim on...

Author Message
TsanChung...
Posted: Sun Aug 30, 2009 10:52 am
Guest
"sudo gvim" is ok on a non-root shell.
$ sudo gvim /etc/fstab
[sudo] password for ts:

However, "E233: cannot open display" error appears when starting gvim
on ubuntu 8.04 root shell.
# gvim /etc/fstab
E233: cannot open display
Press ENTER or type command to continue
# kdesudo gvim /etc/fstab
kdesudo: cannot connect to X server
 
Nico Kadel-Garcia...
Posted: Sun Aug 30, 2009 11:02 am
Guest
On Aug 30, 4:52 pm, TsanChung <tsanchung.w... at (no spam) gmail.com> wrote:
Quote:
"sudo gvim" is ok on a non-root shell.
$ sudo gvim /etc/fstab
[sudo] password for ts:

However, "E233: cannot open display" error appears when starting gvim
on ubuntu 8.04 root shell.
# gvim /etc/fstab
E233: cannot open display
Press ENTER or type command to continue
# kdesudo gvim /etc/fstab
kdesudo: cannot connect to X server

What does 'DISPLAY' say, before and after you run the sudo?

# echo $DISPLAY
# sudo echo $DISPLAY
 
Nico Kadel-Garcia...
Posted: Sun Aug 30, 2009 11:22 am
Guest
On Aug 30, 5:11 pm, Andrew Halliwell <spi... at (no spam) ponder.sky.com> wrote:
Quote:
TsanChung <tsanchung.w... at (no spam) gmail.com> wrote:
"sudo gvim" is ok on a non-root shell.
$ sudo gvim /etc/fstab
[sudo] password for ts:

However, "E233: cannot open display" error appears when starting gvim
on ubuntu 8.04 root shell.
# gvim /etc/fstab
E233: cannot open display
Press ENTER or type command to continue
# kdesudo gvim /etc/fstab
kdesudo: cannot connect to X server

That's now X works.
To use X from another user, such as root, the DISPLAY environment variable
must be set and the X server TOLD to allow it.

Try this...
xhost + localhost
sudo DISPLAY=localhost:0.0
sudo gvim

I strongly, strongly recommend against using xhost this way. xhost is
a very powerful, and very dangerous command, that can allow massive
access to unauthorized people to your X session, for stealing
keystrokes and windows with root access and other

I regularly use 'sudo command arguments' from an X session as a non-
root user, allowing root to pop open a window using the already
available 'DISPLAY' settings. I assume kdesudo does the same thing
properly?
 
Andrew Halliwell...
Posted: Sun Aug 30, 2009 3:11 pm
Guest
TsanChung <tsanchung.wong at (no spam) gmail.com> wrote:
Quote:
"sudo gvim" is ok on a non-root shell.
$ sudo gvim /etc/fstab
[sudo] password for ts:

However, "E233: cannot open display" error appears when starting gvim
on ubuntu 8.04 root shell.
# gvim /etc/fstab
E233: cannot open display
Press ENTER or type command to continue
# kdesudo gvim /etc/fstab
kdesudo: cannot connect to X server

That's now X works.
To use X from another user, such as root, the DISPLAY environment variable
must be set and the X server TOLD to allow it.

Try this...
xhost + localhost
sudo DISPLAY=localhost:0.0
sudo gvim

--
| spike1 at (no spam) freenet.co,uk | "Are you pondering what I'm pondering Pinky?" |
| Andrew Halliwell BSc | |
| in | "I think so brain, but this time, you control |
| Computer Science | the Encounter suit, and I'll do the voice..." |
 
TsanChung...
Posted: Wed Oct 07, 2009 11:40 am
Guest
On the root shell of Konsole on ubuntu 8.04.
# DISPLAY=localhost:0.0
# xclock
Error: Can't open display: localhost:0.0
# gvim /etc/fstab
E233: cannot open display
Press ENTER or type command to continue
# kdesudo gvim /etc/fstab
kdesudo: cannot connect to X server

# xhost + localhost
xhost: unable to open display "localhost:0.0"

# DISPLAY=:0.0
# xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :0.0
# DISPLAY=:0
# xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :0

On Aug 30, 5:11 pm, Andrew Halliwell <spi... at (no spam) ponder.sky.com> wrote:
Quote:
TsanChung <tsanchung.w... at (no spam) gmail.com> wrote:
"sudo gvim" is ok on a non-root shell.
$ sudo gvim /etc/fstab
[sudo] password for ts:

However, "E233:cannotopendisplay" error appears when starting gvim
on ubuntu 8.04 root shell.
# gvim /etc/fstab
E233:cannotopendisplay
Press ENTER or type command to continue
# kdesudo gvim /etc/fstab
kdesudo:cannotconnect to X server

That's now X works.
To use X from another user, such as root, theDISPLAYenvironment variable
must be set and the X server TOLD to allow it.

Try this...
xhost + localhost
sudoDISPLAY=localhost:0.0
sudo gvim

--
|   spi... at (no spam) freenet.co,uk   | "Are you pondering what I'm pondering Pinky?"   |
|   Andrew Halliwell BSc   |                                                 |
|            in            | "I think so brain, but this time, you control   |
|     Computer Science     |  the Encounter suit, and I'll do the voice..."  |
 
Allen Kistler...
Posted: Wed Oct 07, 2009 5:51 pm
Guest
TsanChung wrote:
Quote:
On the root shell of Konsole on ubuntu 8.04.
# DISPLAY=localhost:0.0
# xclock
Error: Can't open display: localhost:0.0
# gvim /etc/fstab
E233: cannot open display
Press ENTER or type command to continue
# kdesudo gvim /etc/fstab
kdesudo: cannot connect to X server

# xhost + localhost
xhost: unable to open display "localhost:0.0"

# DISPLAY=:0.0
# xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :0.0
# DISPLAY=:0
# xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :0

You'll get that error if /etc/hosts defines only 127.0.0.1 as localhost,
but you're connected over IPv6. Edit /etc/hosts so that BOTH 127.0.0.1
and ::1 are defined as localhost.

Since you're apparently connected via ssh, you really shouldn't have to
mess with xhost. In fact, messing with xhost is usually very bad for
security. Just connect with the -X switch, which you're probably
already doing.
 
TsanChung...
Posted: Thu Oct 08, 2009 3:51 am
Guest
On Oct 7, 7:51 pm, Allen Kistler <ackist... at (no spam) oohay.moc> wrote:
Quote:
TsanChung wrote:
On the root shell of Konsole on ubuntu 8.04.
#DISPLAY=localhost:0.0
# xclock
Error: Can'topendisplay: localhost:0.0
# gvim /etc/fstab
E233:cannotopendisplay
Press ENTER or type command to continue
# kdesudo gvim /etc/fstab
kdesudo:cannotconnect to X server

# xhost + localhost
xhost:  unable toopendisplay"localhost:0.0"

#DISPLAY=:0.0
# xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can'topendisplay: :0.0
#DISPLAY=:0
# xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can'topendisplay: :0

You'll get that error if /etc/hosts defines only 127.0.0.1 as localhost,
but you're connected over IPv6.  Edit /etc/hosts so that BOTH 127.0.0.1
and ::1 are defined as localhost.

Since you're apparently connected via ssh, you really shouldn't have to
mess with xhost.  In fact, messing with xhost is usually very bad for
security.  Just connect with the -X switch, which you're probably
already doing.

I followed your instructions to edit /etc/hosts as follows but the
problem still exists.
127.0.0.1 localhost
::1 localhost
127.0.1.1 tc-desktop

# The following lines are desirable for IPv6 capable hosts
#::1 ip6-localhost ip6-loopback
....

I am using gvim on the root shell of Konsole on ubuntu 8.04, I am not
using ssh. I experiment with xhost because I want to solve the
"cannot open display" problem.
 
Allen Kistler...
Posted: Thu Oct 08, 2009 2:53 pm
Guest
TsanChung wrote:
Quote:
On Oct 7, 7:51 pm, Allen Kistler <ackist... at (no spam) oohay.moc> wrote:
TsanChung wrote:
On the root shell of Konsole on ubuntu 8.04.
#DISPLAY=localhost:0.0
# xclock
Error: Can'topendisplay: localhost:0.0

[snip]


[snip]


I followed your instructions to edit /etc/hosts as follows but the
problem still exists.
127.0.0.1 localhost
::1 localhost
127.0.1.1 tc-desktop

# The following lines are desirable for IPv6 capable hosts
#::1 ip6-localhost ip6-loopback
...

I am using gvim on the root shell of Konsole on ubuntu 8.04, I am not
using ssh. I experiment with xhost because I want to solve the
"cannot open display" problem.

Sorry. I missed your mention of Konsole the first time. I got
distracted by DISPLAY=localhost:0.0.

So now I'm wondering why you set DISPLAY. It should have already been
:0.0 (i.e., no localhost hostname), which is the correct value for
someone at the console.

If you just open a terminal window and "echo $DISPLAY" then what do you
get? If you don't set DISPLAY first, does xclock or gvim give an error
then? They should just work without changing DISPLAY.
 
TsanChung...
Posted: Fri Nov 20, 2009 2:30 pm
Guest
On Oct 8, 3:53 pm, Allen Kistler <ackist... at (no spam) oohay.moc> wrote:
Quote:
TsanChung wrote:
On Oct 7, 7:51 pm, Allen Kistler <ackist... at (no spam) oohay.moc> wrote:
TsanChung wrote:
On the root shell of Konsole on ubuntu 8.04.
#DISPLAY=localhost:0.0
# xclock
Error: Can'topendisplay: localhost:0.0

[snip]

[snip]

I followed your instructions to edit /etc/hosts as follows but the
problem still exists.
127.0.0.1       localhost
::1             localhost
127.0.1.1       tc-desktop

# The following lines are desirable for IPv6 capable hosts
#::1     ip6-localhost ip6-loopback
...

I am using gvim on the root shell of Konsole on ubuntu 8.04,  I am not
using ssh.  I experiment with xhost because I want to solve the
"cannotopendisplay" problem.

Sorry.  I missed your mention of Konsole the first time.  I got
distracted byDISPLAY=localhost:0.0.

So now I'm wondering why you setDISPLAY.  It should have already been
:0.0 (i.e., no localhost hostname), which is the correct value for
someone at the console.

If you justopena terminal window and "echo $DISPLAY" then what do you
get?  If you don't setDISPLAYfirst, does xclock or gvim give an error
then?  They should just work without changingDISPLAY.

I use Konsole 1.6.6 on KDE 3.5.10 & kubuntu 8.04.
The regular (non-root) console on Konsole is ok:
$ echo $DISPLAY
:0
$ xclock

The root console on Konsole cannot start xclock:
# echo $DISPLAY
:0
# xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :0
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Sun Dec 06, 2009 8:27 pm