gedit can't run in root terminal

Bug #1449748 reported by Phil Wolff on 2015-04-28
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
One Hundred Papercuts
Medium
Unassigned
gedit (Ubuntu)
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:

Phil Wolff (adiabat) wrote :
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
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
fprietog (fprietog) wrote :

Is there a workaround for this bug?

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.

fprietog (fprietog) wrote :

Thanks Phil Wolff,

Your workaround works like a charm.

fprietog (fprietog) wrote :

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

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?

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

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) on 2019-02-15
affects: ubuntu → gedit (Ubuntu)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers