Invalid MIT-MAGIC-COOKIE-1 keyUnable to init server: Could not connect: Connection refused

Bug #1712089 reported by dino99 on 2017-08-21
574
This bug affects 99 people
Affects Status Importance Assigned to Milestone
synaptic (Ubuntu)
High
Unassigned

Bug Description

List of pkexec'ed applications is located in bug 1713313.
List of packages which use su-to-root and gksu/gksudo is located in bug 1713311.

-----------------------------------------------------------------------------
pkexec'ed applications may be healed with "xhost +si:localuser:root" placed in XDG autostart as follows:

cat <<EOF | sudo tee /etc/xdg/autostart/xhost.desktop
[Desktop Entry]
Name=xhost
Comment=Fix graphical root applications
Exec="xhost +si:localuser:root"
Terminal=false
Type=Application
EOF

-----------------------------------------------------------------------------

Posting here what gnome says about porting to wayland, and their tests:

GNOME Applications under Wayland
GTK+ has a Wayland backend. If it was enabled at compile-time, you can run a GTK+ application under Wayland simply by:

GDK_BACKEND=wayland gnome-calculator
Applications that use Clutter or clutter-gtk also need the Clutter Wayland backend enabled:

GDK_BACKEND=wayland CLUTTER_BACKEND=wayland cheese

https://wiki.gnome.org/Initiatives/Wayland/Applications

======> so hope the settings are well set at compile time; maybe a rebuilt to get sure all apps are ok.

********************************************************************************************************************************************

With the today packages upgrade, switching from X11 to wayland, synaptic refuse to load/open:

from the icon into the dash-to-dock, nothing happen
from the terminal:

sudo synaptic
[sudo] password for oem:
Invalid MIT-MAGIC-COOKIE-1 keyUnable to init server: Could not connect: Connection refused

(synaptic:2154): Gtk-WARNING **: cannot open display: :0

Previous days already have switching some packages to wayland, but synaptic was still working. Its only with the today upgrades, after a cold reboot, that synaptic gui is broken.

Today possibly sources problem:

Unpacking console-setup-linux (1.142ubuntu7) over (1.142ubuntu5) ...

Unpacking console-setup (1.142ubuntu7) over (1.142ubuntu5) ...

Unpacking keyboard-configuration (1.142ubuntu7) over (1.142ubuntu5) ...

Unpacking gnome-session-bin (3.24.1-0ubuntu22) over (3.24.1-0ubuntu21) ...

Unpacking gdm3 (3.25.90.1-0ubuntu2) over (3.25.90.1-0ubuntu1) ...

Unpacking libgdm1 (3.25.90.1-0ubuntu2) over (3.25.90.1-0ubuntu1) ...

Unpacking gir1.2-gdm-1.0 (3.25.90.1-0ubuntu2) over (3.25.90.1-0ubuntu1) ...

Unpacking ubuntu-session (3.24.1-0ubuntu22) over (3.24.1-0ubuntu21) ...

Unpacking gnome-session (3.24.1-0ubuntu22) over (3.24.1-0ubuntu21) ...
...
Unpacking gnome-session-common (3.24.1-0ubuntu22) over (3.24.1-0ubuntu21) ...
Setting up keyboard-configuration (1.142ubuntu7) ...

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: synaptic 0.84.2
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: Mon Aug 21 16:21:47 2017
EcryptfsInUse: Yes
SourcePackage: synaptic
UpgradeStatus: No upgrade log present (probably fresh install)

dino99 (9d9) wrote :
dino99 (9d9) wrote :

Workaround typed into a terminal: xhost +si:localuser:root

then 'sudo synaptic' works as usual

description: updated
Jean-Baptiste Lallement (jibel) wrote :
tags: added: wayland
Changed in synaptic (Ubuntu):
importance: Undecided → High
status: New → Triaged
John Pye (jdpipe) wrote :

Annoying -- the developers over at Fedora seem to suggest that there is an unwillingness to provide support for any GUI that runs as root. Surely a problem for many admin tools like this?

Workaround is easy though:

command-line:
xhost + && sudo synaptic && xhost -

Probably there is something similar that could be done to change the launcher for synaptic, along similar lines?

dino99 (9d9) wrote :

Discussed on Debian mailing list:
https://<email address hidden>/msg1541135.html

(Xwayland authorization not configured)

Norbert (nrbrtx) wrote :

cat <<EOF | sudo tee /etc/xdg/autostart/xhost.desktop
[Desktop Entry]
Name=xhost
Comment=Fix graphical root applications
Exec="xhost +si:localuser:root"
Terminal=false
Type=Application
EOF

Is it more elegant?

Norbert (nrbrtx) wrote :

Just installed Artful x86 on USB-flash.

Without xhost commands Synaptic does not start with
$ synaptic-pkexec
No protocol specified
Unable to init server: Could not connect: Connection refused

(synaptic:1688): Gtk-WARNING **: cannot open display: :0

After setting xhost Synaptic starts.

As I predict zenmap (as root) is affected too (see bug 1713311).

Norbert (nrbrtx) wrote :

Just installed Artful x86 on USB-flash.

Without xhost commands Synaptic does not start with
$ synaptic-pkexec
No protocol specified
Unable to init server: Could not connect: Connection refused

(synaptic:1688): Gtk-WARNING **: cannot open display: :0

After setting xhost Synaptic starts.
Gparted and backintime (see 1713313) may be fixed with xhost command.

As I predict zenmap (as root) and other at least 18 applications too (see bug 1713311). They use su-to-root from menu package. Setting "xhost +si:localuser:root" does not help for them (produce another messages: in console "Error copying '/home/artful/.Xauthority' to '/tmp/libgksu-VXhFz5': No such file or directory
" and window with "Failed to run zenmap as user root.
Unable to copy the user's Xauthorization file.").

I'm not an expert, but it seems that `su-to-root` must be changed to `pkexec` anywhere to lower user disappointment.

dino99 (9d9) on 2017-08-27
description: updated
dino99 (9d9) on 2017-08-27
description: updated
PeterPall (peterpall) wrote :

In artful the problem seems no more be limited to wayland, but to extend to all kinds of gnome session.

Norbert (nrbrtx) wrote :

@PeterPall (peterpall)
The full list of pkexec'ed applications is located in bug 1713313. It is long.

Norbert (nrbrtx) wrote :

Ubuntu 17.10 with all updates, bug is not fixed. Still can't use Synaptic on Wayland.

matej (matejmartinovic) wrote :

Ubuntu 17.10 beta installed on 6.10.2017:
Still the same problem, not only with synaptic but also octave wouldn't work properly, gave similar error.

Solution was, as posted by dino99 to type: xhost +si:localuser:root.

Norbert (nrbrtx) wrote :

@matej
please describe when and why GNU Octave needs root access.
You can post answer here, or mark bug 1713313 as affecting Octave package (use "Also affects distribution/package" link) with corresponding comment.

description: updated
Download full text (6.3 KiB)

Affects Bleachbit too. Ubuntu 11.10 vanilla gnome-session.

On Fri, Oct 6, 2017 at 6:25 AM Norbert <email address hidden> wrote:

> @matej
> please describe when and why GNU Octave needs root access.
> You can post answer here, or mark bug 1713313 as affecting Octave package
> (use "Also affects distribution/package" link) with corresponding comment.
>
> ** Description changed:
>
> + The full list of pkexec'ed applications is located in bug 1713313. It is
> + long.
> +
> Posting here what gnome says about porting to wayland, and their tests:
>
> GNOME Applications under Wayland
> GTK+ has a Wayland backend. If it was enabled at compile-time, you can
> run a GTK+ application under Wayland simply by:
>
> GDK_BACKEND=wayland gnome-calculator
> Applications that use Clutter or clutter-gtk also need the Clutter
> Wayland backend enabled:
>
> GDK_BACKEND=wayland CLUTTER_BACKEND=wayland cheese
>
> https://wiki.gnome.org/Initiatives/Wayland/Applications
>
> ======> so hope the settings are well set at compile time; maybe a
> rebuilt to get sure all apps are ok.
>
>
> ********************************************************************************************************************************************
>
> With the today packages upgrade, switching from X11 to wayland, synaptic
> refuse to load/open:
>
> from the icon into the dash-to-dock, nothing happen
> from the terminal:
>
> sudo synaptic
> [sudo] password for oem:
> Invalid MIT-MAGIC-COOKIE-1 keyUnable to init server: Could not connect:
> Connection refused
>
> (synaptic:2154): Gtk-WARNING **: cannot open display: :0
>
> Previous days already have switching some packages to wayland, but
> synaptic was still working. Its only with the today upgrades, after a
> cold reboot, that synaptic gui is broken.
>
> Today possibly sources problem:
>
> Unpacking console-setup-linux (1.142ubuntu7) over (1.142ubuntu5) ...
>
> Unpacking console-setup (1.142ubuntu7) over (1.142ubuntu5) ...
>
> Unpacking keyboard-configuration (1.142ubuntu7) over (1.142ubuntu5) ...
>
> Unpacking gnome-session-bin (3.24.1-0ubuntu22) over (3.24.1-0ubuntu21)
> ...
>
> Unpacking gdm3 (3.25.90.1-0ubuntu2) over (3.25.90.1-0ubuntu1) ...
>
> Unpacking libgdm1 (3.25.90.1-0ubuntu2) over (3.25.90.1-0ubuntu1) ...
>
> Unpacking gir1.2-gdm-1.0 (3.25.90.1-0ubuntu2) over (3.25.90.1-0ubuntu1)
> ...
>
> Unpacking ubuntu-session (3.24.1-0ubuntu22) over (3.24.1-0ubuntu21) ...
>
> Unpacking gnome-session (3.24.1-0ubuntu22) over (3.24.1-0ubuntu21) ...
> ...
> Unpacking gnome-session-common (3.24.1-0ubuntu22) over
> (3.24.1-0ubuntu21) ...
> Setting up keyboard-configuration (1.142ubuntu7) ...
>
> ProblemType: Bug
> DistroRelease: Ubuntu 17.10
> Package: synaptic 0.84.2
> 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: Mon Aug 21 16:21:47 2017
> EcryptfsInUse: Yes
> SourcePackage: synaptic
> UpgradeStatus: No upgrade log present (probably fresh install)
>
> --
> You received this bug notification because you are subsc...

Read more...

Norbert (nrbrtx) on 2017-10-06
description: updated
description: updated
Norbert (nrbrtx) wrote :

Got this warning message on "dpkg-reconfigure keyboard-configuration":

$ sudo dpkg-reconfigure keyboard-configuration
[sudo] password for artful:
Invalid MIT-MAGIC-COOKIE-1 keyCannot open display ":0"
Your console font configuration will be updated the next time your system
boots. If you want to update it now, run 'setupcon' from a virtual console.
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.125ubuntu11) ...
update-initramfs: Generating /boot/initrd.img-4.13.0-12-generic

Should we add `debconf` to bug-reports?

Mark (1aunchpad-nct) wrote :

According to https://bugzilla.redhat.com/show_bug.cgi?id=1274451 there are no plans for Wayland to support running graphical applications as root so that bug has been closed as WONTFIX. The correct fix is for Synaptic, and other graphical apps needing root, to be rewritten to run the GUI as a normal user and to use "polkit" for the parts where they need root access.

Download full text (4.4 KiB)

Thanks a lot! I've got a script that I run on each login to fix that.

On Sun, Oct 22, 2017 at 8:01 PM Mark <email address hidden> wrote:

> According to https://bugzilla.redhat.com/show_bug.cgi?id=1274451 there
> are no plans for Wayland to support running graphical applications as
> root so that bug has been closed as WONTFIX. The correct fix is for
> Synaptic, and other graphical apps needing root, to be rewritten to run
> the GUI as a normal user and to use "polkit" for the parts where they
> need root access.
>
>
> ** Bug watch added: Red Hat Bugzilla #1274451
> https://bugzilla.redhat.com/show_bug.cgi?id=1274451
>
> --
> You received this bug notification because you are subscribed to a
> duplicate bug report (1705955).
> https://bugs.launchpad.net/bugs/1712089
>
> Title:
> Invalid MIT-MAGIC-COOKIE-1 keyUnable to init server: Could not
> connect: Connection refused
>
> Status in synaptic package in Ubuntu:
> Triaged
>
> Bug description:
> List of pkexec'ed applications is located in bug 1713313.
> List of packages which use su-to-root and gksu/gksudo is located in bug
> 1713311.
>
>
> -----------------------------------------------------------------------------
> pkexec'ed applications may be healed with "xhost +si:localuser:root"
> placed in XDG autostart as follows:
>
> cat <<EOF | sudo tee /etc/xdg/autostart/xhost.desktop
> [Desktop Entry]
> Name=xhost
> Comment=Fix graphical root applications
> Exec="xhost +si:localuser:root"
> Terminal=false
> Type=Application
> EOF
>
>
> -----------------------------------------------------------------------------
>
> Posting here what gnome says about porting to wayland, and their
> tests:
>
> GNOME Applications under Wayland
> GTK+ has a Wayland backend. If it was enabled at compile-time, you can
> run a GTK+ application under Wayland simply by:
>
> GDK_BACKEND=wayland gnome-calculator
> Applications that use Clutter or clutter-gtk also need the Clutter
> Wayland backend enabled:
>
> GDK_BACKEND=wayland CLUTTER_BACKEND=wayland cheese
>
> https://wiki.gnome.org/Initiatives/Wayland/Applications
>
> ======> so hope the settings are well set at compile time; maybe a
> rebuilt to get sure all apps are ok.
>
>
> ********************************************************************************************************************************************
>
> With the today packages upgrade, switching from X11 to wayland,
> synaptic refuse to load/open:
>
> from the icon into the dash-to-dock, nothing happen
> from the terminal:
>
> sudo synaptic
> [sudo] password for oem:
> Invalid MIT-MAGIC-COOKIE-1 keyUnable to init server: Could not connect:
> Connection refused
>
> (synaptic:2154): Gtk-WARNING **: cannot open display: :0
>
> Previous days already have switching some packages to wayland, but
> synaptic was still working. Its only with the today upgrades, after a
> cold reboot, that synaptic gui is broken.
>
> Today possibly sources problem:
>
> Unpacking console-setup-linux (1.142ubuntu7) over (1.142ubuntu5) ...
>
> Unpacking console-setup (1.142ubuntu7) over (1.142ubuntu5) ...
>
> Unpacking keyboard-configuration (1...

Read more...

cirrus (andreas-kahl) 19 hours ago
information type: Public → Public Security
To post a comment you must log in.
This report contains Public Security information  Edit
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

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