gedit can't run in root terminal

Bug #1449748 reported by Phil Wolff
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
One Hundred Papercuts
Confirmed
Medium
Unassigned
gedit (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

Folowing upgrade 14.10 -> 15.04, in a root terminal:

  root@adiabat:~# gedit
  No protocol specified

  ** (gedit:8757): WARNING **: Could not open X display
  No protocol specified
  gdk_mir_display_open
  Failed to connect to Mir: Failed to connect to server socket: No such file or directory
  Unable to init server: Could not connect: Connection refused

  (gedit:8757): Gtk-WARNING **: cannot open display: :0
  root@adiabat:~#

However, from a user terminal, " gedit" and "gksu gedit" both work just fine.

ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: ubuntu-release-upgrader-core 1:15.04.14
ProcVersionSignature: Ubuntu 3.19.0-15.15-generic 3.19.3
Uname: Linux 3.19.0-15-generic x86_64
ApportVersion: 2.17.2-0ubuntu1
Architecture: amd64
CrashDB: ubuntu
CurrentDesktop: Unity
Date: Tue Apr 28 13:55:28 2015
InstallationDate: Installed on 2014-11-04 (174 days ago)
InstallationMedia: Ubuntu 14.10 "Utopic Unicorn" - Release amd64 (20141022.1)
PackageArchitecture: all
SourcePackage: ubuntu-release-upgrader
Symptom: dist-upgrade
UpgradeStatus: Upgraded to vivid on 2015-04-28 (0 days ago)
VarLogDistupgradeTermlog:

Revision history for this message
Phil Wolff (adiabat) wrote :
Revision history for this message
Brian Murray (brian-murray) wrote :

This isn't a bug with the release upgrader, the software that provides release upgrades, rather with the system after the release upgrade. Subsequently, I am removing the package.

affects: ubuntu-release-upgrader (Ubuntu) → ubuntu
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu:
status: New → Confirmed
Changed in ubuntu:
importance: Undecided → Medium
Changed in hundredpapercuts:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
fprietog (fprietog) wrote :

Is there a workaround for this bug?

Revision history for this message
Phil Wolff (adiabat) wrote :

Yes, I just found a workaround yesterday.

I discovered that root is handed a definition of the environment variable XAUTHORITY that points to a non-existent directory:

    root@login:~# echo $XAUTHORITY
    /tmp/libgksu-OgwC1o/.Xauthority
    root@login:~# ls $XAUTHORITY
    ls: cannot access /tmp/libgksu-OgwC1o/.Xauthority: No such file or directory

 This makes it impossible to run any GUI-based program as root.

I worked around this by adding the following to root's .bashrc file:

    export XAUTHORITY=~/.Xauthority
    cp /home/<myhome>/.Xauthority $XAUTHORITY

It would appear that libgksu is the source of this problem.

Revision history for this message
fprietog (fprietog) wrote :

Thanks Phil Wolff,

Your workaround works like a charm.

Revision history for this message
fprietog (fprietog) wrote :

BTW, using Phil Wolff's workaround solved another problem I had trying to open android SDK from root's command line.

Revision history for this message
Dan Hartman (bj7u6139zdyf2a6nz2ly74oec10f2lne-9rjk-jjcftv6wldnzq84cskygyvhqqb9qwjfc) wrote :

This is still a bug in Ubuntu 16.04. In my case, it comes from running a gui (synaptic package manager) as root inside a tiger vncserver session. It runs fine in the last vncserver it was run in, but from the real desktop console it conks out with the following error:

```root@ubuntu1604-p6720f:~# synaptic
No protocol specified
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused

(synaptic:23495): Gtk-WARNING **: cannot open display: :1
root@ubuntu1604-p6720f:~# DISPLAY=:0 synaptic
No protocol specified
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused

(synaptic:23624): Gtk-WARNING **: cannot open display: :0
root@ubuntu1604-p6720f:~# ```

As shown, even if I specify the exact display to open, it refuses to run in the main desktop. For whatever reason, Mir isn't running. I have no clue what that is. It also says "No protocol specified" -- is there a way to work around it by specifying a protocol?

Revision history for this message
Dan Hartman (bj7u6139zdyf2a6nz2ly74oec10f2lne-9rjk-jjcftv6wldnzq84cskygyvhqqb9qwjfc) wrote :

Also, I tried Phil Wolff's workaround and it didn't work.

Revision history for this message
Eric Huber (echuber2) wrote :

Here's an alternative method that works for me. Enter this to allow all local users to launch GUI windows: (Enter exactly as shown, including the final colon.)

xhost +local:

Or, more extreme (may not be secure without running a firewall):

xhost +

To undo, enter:

xhost -

I don't need to type sudo to run these commands when I enter them as my local user that has X authority (if I'm understanding the situation correctly).

Paul White (paulw2u)
affects: ubuntu → gedit (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.