[Bug 370607] Re: X applications won't run under sudo

Launchpad Bug Tracker 370607 at bugs.launchpad.net
Mon Dec 26 15:14:36 UTC 2011


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

** Changed in: sudo (Ubuntu)
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to sudo in Ubuntu.
https://bugs.launchpad.net/bugs/370607

Title:
  X applications won't run under sudo

Status in “sudo” package in Ubuntu:
  Confirmed

Bug description:
  Binary package hint: sudo

  Using the default configuration supplied by ubuntu 9.04 (except
  changed logfile), X applications do not run correctly under "sudo" or
  "sudu -E"

  whitis at cervantes:/tmp$ sudo glxgears
  No protocol specified
  Error: couldn't open display :0.0
  whitis at cervantes:/tmp$ sudo update-manager
  No protocol specified
  /var/lib/python-support/python2.6/gtk-2.0/gtk/__init__.py:72: GtkWarning: could not open display
    warnings.warn(str(e), _gtk.Warning)
  No protocol specified
  Traceback (most recent call last):
    File "/usr/bin/update-manager", line 44, in <module>
      gtk.init_check()
  RuntimeError: could not open display
  whitis at cervantes:/tmp$ sudo k3b
  Error: "/tmp/kde-whitis" is owned by uid 1000 instead of uid 0.
  Error: "/tmp/ksocket-whitis" is owned by uid 1000 instead of uid 0.
  Error: "/tmp/ksocket-whitis" is owned by uid 1000 instead of uid 0.
  No protocol specified
  kdeinit: Can't connect to the X Server.
  kdeinit: Might not terminate at end of session.
  Error: "/tmp/kde-whitis" is owned by uid 1000 instead of uid 0.
  No protocol specified
  kded: cannot connect to X server :0.0
  DCOP aborting call from 'anonymous-14296' to 'kded'
  No protocol specified
  k3b: cannot connect to X server :0.0
  DCOP aborting call from 'anonymous-14279' to 'k3b'
  whitis at cervantes:/tmp$ sudo printenv XAUTHORITY
  /home/whitis/.Xauthority
  whitis at cervantes:/tmp$ sudo printenv DISPLAY
  :0.0
  whitis at cervantes:/tmp$ printenv DISPLAY
  :0.0
  whitis at cervantes:/tmp$ sudo leafpad /etc/passwd
  No protocol specified
  leafpad: Cannot open display: 
  whitis at cervantes:/tmp$ sudo hexdump -C $XAUTHORITY
  *works*
  whitis at cervantes:/tmp$ sudo xhost +root    #needs to run as non-root user, anyway
  No protocol specified
  xhost:  unable to open display ":0.0"

  su has the same problem.

  /usr/bin/startx is identical to the version on my old debian system which did not have this problem.
  changing DISPLAY to unix:0.0 doesn't help.  gksudo fails in the same way.   emacs falls back on its curses environment when it can't open the display.

  xhost +root   fails (claims root is an invalid hostname even though
  manpage says this is valid).   xhost +root@ succeeds but doesn't fix
  problem.   xhost +root at localhost succeeds but doesn't fix problem even
  if you use DISPLAY=localhost:0.0.   xhost +cervantes, xhost
  +cervantes/unix, xhost root at cervantes don't fix the problem.

  /home/whitis/.[a-zA-Z]* were copied from previous install, but the
  default dotfiles installed by ubuntu didn't contain xhost or xauth.

  Since root has access to ~/.Xauthority, I didn't try the "xauth
  extract - $DISPLAY | ssh  ... " method, and copying ~/.Xauthority to
  /root/.Xauthority didn't help, anyway.

  X is sstarted with  -auth /var/lib/gdm/:0.Xauth by gdm.  There is no
  kerberos line in ~/.Xauthority.

  None of the usual fixes seem to work.    Except for "xhost +" which is
  a really bad idea.

  xhost +local:root  does work.   Not that the man page will tell you
  this.

  This may be an X problem, not a sudo problem, but to the average user
  it will appear to be a sudo problem since ubuntu encourages people to
  use sudo rather than run as root.    And other distributions do
  whatever setup is required to make this work.

  ProblemType: Bug
  Architecture: amd64
  DistroRelease: Ubuntu 9.04
  NonfreeKernelModules: nvidia
  Package: sudo 1.6.9p17-1ubuntu3
  ProcEnviron:
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: sudo
  Uname: Linux 2.6.28-11-generic x86_64

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/sudo/+bug/370607/+subscriptions




More information about the foundations-bugs mailing list