LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 08-30-2009, 08:49 AM   #1
TsanChung
LQ Newbie
 
Registered: Jul 2008
Posts: 8

Rep: Reputation: 0
"E233: cannot open display" when starting gvim on ubuntu 8.04 root shell


"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.04root 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

Last edited by TsanChung; 08-30-2009 at 03:53 PM.
 
Old 08-30-2009, 10:40 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Use gtksu gvim /etc/fstab or, if running KDE kdesu ....
 
Old 08-31-2009, 07:36 AM   #3
TsanChung
LQ Newbie
 
Registered: Jul 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by tredegar View Post
Use gtksu gvim /etc/fstab or, if running KDE kdesu ....
# kdesu gvim x
kdesu: cannot connect to X server
 
Old 08-31-2009, 08:24 AM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
# kdesu gvim x
kdesu: cannot connect to X server
No, you cannot use kdesu (are you running KDE or Gnome?) like this.
You need to be running as a regular user, then for KDE:
Code:
tred@vaio:~$ kdesu kate x
or for gnome:
Code:
tred@vaio:~$ gtksu kate x
If you are in a "real" terminal like <CTRL><ALT><F1-6> (and not a terminal window in your GUI) then neither method will work for you.
 
Old 09-08-2009, 09:10 AM   #5
TsanChung
LQ Newbie
 
Registered: Jul 2008
Posts: 8

Original Poster
Rep: Reputation: 0
The problem is solved by
$ sudo cp $HOME/.Xauthority /root/.Xauthority
 
Old 04-26-2020, 01:18 PM   #6
NGC_7492
LQ Newbie
 
Registered: Apr 2020
Posts: 5

Rep: Reputation: Disabled
I found that copying .Xauthority from my user account to my root account did not work. I still got the error "E233: cannot open display" when starting gvim from the root account.

What DID work was adding this line to root's .basrc file:

export DISPLAY=':0.0'

where 0.0 is what is shown when you enter this command from your user account's terminal:

echo $DISPLAY
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I "cat" or "grep" a file to ignore lines starting with "#" ??? callagga Linux - Newbie 7 08-16-2013 06:58 AM
Problem starting gui, "$DISPLAY is not set or cannot connect to the x server" GlennsPref Mandriva 14 02-28-2009 06:15 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
when starting linux "cannot open root device" coalchamber361 Linux - Newbie 2 01-29-2006 09:43 AM
Starting Java from shell script (Exception in thread "main") rolf_mueller Linux - Software 5 10-30-2004 02:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 04:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration