[Bug 1712477] Re: cannot open display: at /usr/lib/x86_64-linux-gnu/perl5/5.26/Gtk2.pm line 126.

Jean-Baptiste Lallement jean-baptiste.lallement at ubuntu.com
Wed Aug 23 07:26:34 UTC 2017


Thanks for your report.

>From pkexec's man page:

"The environment that PROGRAM will run it, will be set to a minimal
known and safe environment in order to avoid injecting code through
LD_LIBRARY_PATH or similar mechanisms. In addition the PKEXEC_UID
environment variable is set to the user id of the process invoking
pkexec.

As a result, pkexec will not allow you to run X11 applications as
another user since the $DISPLAY and $XAUTHORITY environment variables
are not set.

These two variables will be retained if the org.freedesktop.policykit.exec.allow_gui annotation on an action is set to a nonempty value; this is discouraged, though, and should only be used for legacy programs.
"

So unless you added a specific policy file, this is the expected
behaviour (for ref on x11 you can run GUI apps without a policy file by
passing $DISPLAY and  $XAUTHORITY on the command line like this: pkexec
env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gtkorphan)

I'm closing this report.

** Changed in: perl (Ubuntu)
       Status: New => Invalid

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

Title:
   cannot open display:  at /usr/lib/x86_64-linux-gnu/perl5/5.26/Gtk2.pm
  line 126.

Status in perl package in Ubuntu:
  Invalid

Bug description:
  oem at zz64:~$ pkexec gtkorphan
  Gtk-WARNING **: cannot open display:  at /usr/lib/x86_64-linux-gnu/perl5/5.26/Gtk2.pm line 126.

  **********
    # gtk_init_with_args is not wrapped.
    foreach my $function (qw/Gtk2::init Gtk2::init_check Gtk2::parse_args/) {
      my $orig_function = \&{$function};
      *{$function} = sub {
        if (!$disable_setlocale) {
          POSIX::setlocale (POSIX::LC_ALL (), '');
        }
        $orig_function->(@_);  # this is the line 126 ###########
      };
  ************

  With wayland not setting xwayland authorization
   (https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1541135.html),
  and gksudo been deprecated (https://bugs.launchpad.net/ubuntu/+source/gksu/+bug/1712471),
  pkexec also fail to get a display.

  So back to 'sudo' to try using gui app, which is not encouraged, as
  ibus warns not being 'root'.

  ProblemType: Bug
  DistroRelease: Ubuntu 17.10
  Package: perl 5.26.0-5
  ProcVersionSignature: Ubuntu 4.12.0-12.13-generic 4.12.8
  Uname: Linux 4.12.0-12-generic x86_64
  ApportVersion: 2.20.6-0ubuntu6
  Architecture: amd64
  CurrentDesktop: GNOME
  Date: Wed Aug 23 07:37:48 2017
  EcryptfsInUse: Yes
  SourcePackage: perl
  UpgradeStatus: No upgrade log present (probably fresh install)

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



More information about the foundations-bugs mailing list