Graphical snaps can't run in Gnome 3.38 Wayland sessions (can't open X display)

Bug #1897224 reported by Martin Vysny
196
This bug affects 37 people
Affects Status Importance Assigned to Milestone
Mutter
Unknown
Unknown
snapd
Fix Released
Undecided
Zygmunt Krynicki
mutter (Ubuntu)
Fix Released
High
Unassigned
Groovy
Fix Released
High
Unassigned
Hirsute
Fix Released
High
Unassigned
snapd (Ubuntu)
Won't Fix
High
Unassigned
Groovy
Won't Fix
High
Unassigned
Hirsute
Won't Fix
High
Unassigned

Bug Description

[Impact]

 * Users who select the Wayland session on Ubuntu 20.10 cannot run snap
   confined X11 applications, due to gnome-shell no longer listening on an
   abstract socket for connections.

 * The fix, which has been accepted into upstream's gnome-3-38 branch
   reverts the change removing the abstract socket, and fixes the bug that
   prompted it's removal:

   https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1508

[Test Case]

 * Start with a stock Ubuntu 20.10 desktop install.

 * At the GDM login screen, after selecting your user account use the gear
   icon to select the "Ubuntu on Wayland" session, and log in.

 * Ensure Chromium is installed by running "sudo snap install chromium".

 * Try to run "chromium" from the terminal. Without the fix, it will fail
   with the error "Unable to open X display". With the fix applied, it
   will launch as normal.

[Regression Potential]

 * The patch modifies the logic gnome-shell uses to launch Xwayland. So
   there is a potential that the change could break X11 application
   support on the Wayland session.

 * The default configuration for gnome-shell is to launch Xwayland on
   session start, so it should be immediately obvious if there are
   problems.

 * In addition to checking snapped X11 apps like Chromium, verify that a
   few classic X11 apps still launch correctly (e.g. xterm, xeyes, etc).

[Other Info]

 * Running "ss -xlp | grep Xwayland" should show that it is listening on
   both "/tmp/.X11-unix/X0" (the regular unix domain socket) and
   "@/tmp/.X11-unix/X0" (the abstract socket).

---
I'm trying to run chromium installed via snap in Ubuntu 20.10 when running Ubuntu Wayland session. Unfortunately, chromium wouldn't start:

> chromium
[49244:49244:0925/094607.732169:ERROR:browser_main_loop.cc(1417)] Unable to open X display.

I am able to run Firefox just fine (assuming that Firefox still runs on xwayland) and also Intellij snap works fine.

ProblemType: Bug
DistroRelease: Ubuntu 20.10
ProcVersionSignature: Ubuntu 5.8.0-19.20-generic 5.8.8
Uname: Linux 5.8.0-19-generic x86_64
ApportVersion: 2.20.11-0ubuntu47
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
Date: Fri Sep 25 09:45:16 2020
InstallationDate: Installed on 2016-09-05 (1480 days ago)
InstallationMedia: Ubuntu-Server 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160719)
Snap: chromium 85.0.4183.121 (latest/stable)
SnapSource: ubuntu/+source/chromium-browser
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Martin Vysny (vyzivus) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in chromium-browser (Ubuntu):
status: New → Confirmed
Olivier Tilloy (osomon)
summary: - chromium wayland won't start: Unable to open X display
+ [snap] chromium wayland won't start: Unable to open X display
Revision history for this message
Olivier Tilloy (osomon) wrote : Re: [snap] chromium wayland won't start in Ubunt 20.10: Unable to open X display

This is a regression in Ubuntu 20.10 (launching the chromium snap in 20.04 in a wayland session works as expected).

summary: - [snap] chromium wayland won't start: Unable to open X display
+ [snap] chromium wayland won't start in Ubunt 20.10: Unable to open X
+ display
Changed in chromium-browser (Ubuntu):
importance: Undecided → Medium
summary: - [snap] chromium wayland won't start in Ubunt 20.10: Unable to open X
+ [snap] chromium wayland won't start in Ubuntu 20.10: Unable to open X
display
Revision history for this message
Sebastien Bacher (seb128) wrote : Re: [snap] chromium wayland won't start in Ubuntu 20.10: Unable to open X display

it's not specific to chromium, seems an issue with snaps on wayland in 20.10 (and other distros)

https://forum.snapcraft.io/t/apps-wont-run-and-crash-on-gnome-wayland/20322/6

tags: added: rls-gg-incoming
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Xwayland is serving display ":0" and legacy X apps can use it just fine (like xterm, xeyes, xclock, bitmap). So that means the problem is probably the chromium binary. And since that's just a symlink to /usr/bin/snap this appears to be a snapd bug. Maybe.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Probably a confinement issue and not just snapd clobbering $DISPLAY

Changed in snapd (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Changed in mutter (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
importance: Undecided → High
status: New → In Progress
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Back on the subject of this bug, it may be related to changes in the fd numbers of -listen and -displayfd passed to Xwayland in mutter 3.38. If that's relevant at all then it's probably still a snapd issue.

Changed in mutter (Ubuntu):
status: In Progress → Invalid
assignee: Daniel van Vugt (vanvugt) → nobody
summary: - [snap] chromium wayland won't start in Ubuntu 20.10: Unable to open X
- display
+ [snap] chromium won't start on Xwayland in Ubuntu 20.10: Unable to open
+ X display
Changed in snapd:
status: New → Confirmed
Revision history for this message
James Henstridge (jamesh) wrote : Re: [snap] chromium won't start on Xwayland in Ubuntu 20.10: Unable to open X display

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1424 is definitely the culprit here. Snaps depend on access to the abstract namespace socket to function correctly.

Inside the sandboxes, snaps see a private /tmp that is under their complete control. So there is no /tmp/.X11-unix directory there. They can see the abstract namespace socket though, which the client libraries will use automatically.

Revision history for this message
James Henstridge (jamesh) wrote :

Looking at the reasoning behind that change, Mutter introduced lazy initialisation of Xwayland: binding the two sockets, and starting Xwayland when someone connected to the abstract namespace socket. Flatpak apps apparently can't speak to the abstract namespace socket, so would hang forever when started since the connection to the non-abstract /tmp/.X11-unix socket was never accepted.

Rather than fixing the initialisation logic to start Xwayland on connect to either socket, they dropped the abstract namespace socket. I'll talk to the snapd folks about it, but this sounds like it should be dealt with on the Mutter side.

Changed in mutter (Ubuntu):
status: Invalid → Confirmed
Revision history for this message
James Henstridge (jamesh) wrote :

I've filed https://gitlab.gnome.org/GNOME/mutter/-/issues/1454 upstream about this regression.

summary: - [snap] chromium won't start on Xwayland in Ubuntu 20.10: Unable to open
- X display
+ Graphical snaps can't run in Gnome 3.38 Wayland sessions (can't open X
+ display)
no longer affects: chromium-browser (Ubuntu)
Revision history for this message
James Henstridge (jamesh) wrote :

I had a go at fixing this in https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1508 -- taking the patches from that MR and applying them to the Groovy mutter source package gave me a Wayland session that supported X11 snaps again.

It is probably worth waiting for a review from upstream before going further. I've done the testing they asked for with the "autostart-xwayland" feature enabled, so hopefully that will come soon.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Fix committed upstream to mutter 3.38.2, although still no fix on master (mutter 40).

Changed in mutter (Ubuntu):
status: Confirmed → Fix Committed
tags: added: fixed-in-3.38.2 fixed-upstream
Changed in snapd (Ubuntu):
status: Confirmed → Won't Fix
Revision history for this message
Marius Gedminas (mgedmin) wrote :

I've just upgraded to groovy and hit this bug. For now I'm using socat as a workaround:

    socat abstract-listen:/tmp/.X11-unix/X0,reuseaddr,fork unix:/tmp/.X11-unix/X0

This works, but is rather slow (and probably also opens a security hole on multiuser machines).

Changed in mutter (Ubuntu):
status: Fix Committed → In Progress
Changed in mutter (Ubuntu Groovy):
status: Fix Committed → In Progress
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

missing SRU description

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

The snapd side of this fix is baking in https://github.com/snapcore/snapd/pull/9530

Changed in snapd:
status: Confirmed → In Progress
assignee: nobody → Zygmunt Krynicki (zyga)
Revision history for this message
James Henstridge (jamesh) wrote :

I've updated the description with the SRU bug template. I think this includes all the relevant info?

description: updated
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Martin, or anyone else affected,

Accepted mutter into groovy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/mutter/3.38.1-2ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-groovy to verification-done-groovy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-groovy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in mutter (Ubuntu Groovy):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-groovy
Revision history for this message
geez (geez) wrote :

I have tested the package, and tested with several snaps including Chromium.

```
[email protected]wesley-desktop:~$ snap run spotify
Warning: GTK2 does not support Wayland!
Gtk-Message: 09:18:25.239: Failed to load module "gail"
Gtk-Message: 09:18:25.239: Failed to load module "atk-bridge"

(spotify:3046): Gtk-WARNING **: 09:18:25.240: cannot open display: :0
$ snap run chromium
[3214:3214:1028/091834.916711:ERROR:browser_main_loop.cc(1426)] Unable to open X display.
$ snap run teams-for-linux

(teams-for-linux:3363): Gtk-WARNING **: 09:18:47.405: cannot open display: :0
$ sudo aptitude versions mutter
[sudo] password for:
Package mutter:
p A 3.38.1-1ubuntu1 groovy 500
i A 3.38.1-2ubuntu1 100
$
```

tags: added: verification-failed-groovy
removed: verification-needed-groovy
Revision history for this message
geez (geez) wrote :

Other relevant info I forgot:

- xeyes runs fine
- sockets:

$ ss -xlp | grep Xwayland
u_str LISTEN 0 1 /tmp/.X11-unix/X0 53665 * 0 users:(("Xwayland",pid=2539,fd=4))
u_str LISTEN 0 1 /tmp/.X11-unix/X1 53666 * 0 users:(("Xwayland",pid=2539,fd=6))

Revision history for this message
Miguel Rodríguez (migrax) wrote :

I have the updated mutter package (3.38.1-2ubuntu1) and chromium snap is working fine again.

Open sockets:
u_str LISTEN 0 1 @/tmp/.X11-unix/X0 64514 * 0 users:(("Xwayland",pid=4667,fd=4))
u_str LISTEN 0 1 @/tmp/.X11-unix/X1 64516 * 0 users:(("Xwayland",pid=4667,fd=7))
u_str LISTEN 0 1 /tmp/.X11-unix/X0 64515 * 0 users:(("Xwayland",pid=4667,fd=5))

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Sounds like more votes/testers are required.

tags: added: verification-needed-groovy
removed: verification-failed-groovy
Revision history for this message
Iain Lane (laney) wrote :

I was running libmutter-7-0 3.38.1-1ubuntu1. I could reproduce the initial bug of not being able to launch Chromium from the snap. After upgrading to 3.38.1-2ubuntu1, now I can launch it fine.

Additionally, ss shows that Xwayland is listening on the abstract socket too.

[email protected]> ss -xlp | grep Xwayland
u_str LISTEN 0 1 /tmp/.X11-unix/X0 71964 * 0 users:(("Xwayland",pid=3713,fd=5))
u_str LISTEN 0 1 @/tmp/.X11-unix/X0 71963 * 0 users:(("Xwayland",pid=3713,fd=4))
u_str LISTEN 0 1 @/tmp/.X11-unix/X1 71965 * 0 users:(("Xwayland",pid=3713,fd=7))

Revision history for this message
geez (geez) wrote :

Seeing as the issue was solved for two other people, I had another go - this time explicitly installing all mutter-related packages from -proposed (and not just 'mutter'):

$ aptitude upgrade libmutter-7-0 mutter mutter-common

Lo and behold, the socket showed up:

$ sudo ss -xlp | grep Xwayland
u_str LISTEN 0 1 @/tmp/.X11-unix/X0 60747 * 0 users:(("Xwayland",pid=2371,fd=4))
u_str LISTEN 0 1 @/tmp/.X11-unix/X1 60749 * 0 users:(("Xwayland",pid=2371,fd=7))
u_str LISTEN 0 1 /tmp/.X11-unix/X0 60748 * 0 users:(("Xwayland",pid=2371,fd=5))

and I can confirm that my graphical snaps all work again. I suspect that in my first try, not all packages were upgraded. I'm not sure, but perhaps that points at a dependency issue with the packages in -proposed.

tags: added: verification-done-groovy
removed: verification-needed verification-needed-groovy
Revision history for this message
Matthias Jordan (matjordan) wrote :

The bug affects me, too. I just installed the three above mentioned mutter packages (libmutter-7-0 mutter mutter-common) and now Chromium is working again. Thanks for the fix!

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

geez,

That's a common mistake... When we ask people to test a mutter update we actually mean 'libmutter' that's used by gnome-shell.

Revision history for this message
Bickhaus (bickhaus) wrote :

As geez did above, I installed libmutter-7-0, mutter, and mutter-common from groovy-proposed. Zoom now opens and seems to run fine, which is the snap that, for me, previously did not open. There seems to be a draw issue that I have never had before though. When I close the application, the window closes, then the title bar and window outline reappear for a second or two, prior to closing for good.

Revision history for this message
Josh (joshstoik) wrote :

Updating to groovy-proposed libmutter-7-0, mutter, and mutter-common fixed the display issues with the Irfanview (WINE) snap. Woo!

Revision history for this message
Phil Hughes (phil-hughes) wrote :

I can also confirm that after installing libmutter-7-0 from groovy-proposed, 3 snaps that wouldn't run before now run (chromium, keepassxc, vlc).

Revision history for this message
Marius Gedminas (mgedmin) wrote :

I don't know if you need more confirmations, but upgrading to mutter + libmitter from groovy-proposed fixed my chromium problem too.

(The only weird bit was how I was unconsensually logged out during the upgrade, but that could've been plymouth or some other package.)

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mutter - 3.38.1-2ubuntu1

---------------
mutter (3.38.1-2ubuntu1) groovy; urgency=medium

  * Merge with debian, including various upstream fixes. Remaining changes:
    - debian/gbp.conf: update upstream branch to point to ubuntu/master
    - debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch:
      + X11: Add support for fractional scaling using Randr

mutter (3.38.1-2) unstable; urgency=medium

  * debian/patches: Wayland start Xwayland on public X11 sockets as well
    (LP: #1897224)
  * debian/patches: Don't override window tile monitor (LP: #1900009)
  * debian/patches: Fix resizing issues (LP: #1878293)

 -- Marco Trevisan (Treviño) <email address hidden> Fri, 23 Oct 2020 12:43:24 +0200

Changed in mutter (Ubuntu Hirsute):
status: In Progress → Fix Released
Revision history for this message
Peter L Jones (peter-drealm) wrote :

Hi,

I'm running focal (20.04.1 LTS) -- and hit this only just now when upgrading to the new LTS.

So this is to confirm this affects the LTS release and I'd like to ask for it back-ported. :)

Thanks,

-- Peter

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

This bug does not exist in Ubuntu 20.04 because the code that was deleted to cause this bug is NOT deleted in Ubuntu 20.04.

You are experiencing a different problem so please open a new bug.

Revision history for this message
Jordan Williams (jwillikers) wrote :

The KeePassXC and Stretchly snaps were not running under Wayland on Groovy. The mutter 3.38.1-2ubuntu1 package from groovy-proposed fixed the issue so that both of these snaps work again.

Revision history for this message
sharifm (motawally) wrote :

For a substantial amount of users Wayland is important as it has better performance and battery for integrated graphics. Having this bug unfixed and breaking graphical snaps including chromium (which does not have an apt package alternative) forces users to revert to X11/Xorg.

What is the mechanism to increase the importance of this bug and expedite the release of the fix which has been available (unreleased) for almost a month. This was a known issue on release day of Groovy. How can I help?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

There is no mechanism to make it come faster. It's already on the way as a proposed groovy update:

https://launchpad.net/ubuntu/+source/mutter/3.38.1-2ubuntu1

You can't get faster than that.

Revision history for this message
Dustin Nisbet-Jones (d.nisbetjones) wrote :

I installed the Groovy-proposed updates, including:
Package mutter:
p A 3.38.1-1ubuntu1 groovy 500
i A 3.38.1-2ubuntu1 100

Running a Snap results in the same error:
$ joplin-james-carroll.joplin
(joplin:40222): Gtk-WARNING **: 07:02:09.027: cannot open display: :0

$ chromium
[43799:43799:1123/070612.587261:ERROR:browser_main_loop.cc(1434)] Unable to open X display.

Revision history for this message
Dustin Nisbet-Jones (d.nisbetjones) wrote :

Scratch #38. It needed a reboot and now everything works fine.

Revision history for this message
Antonin Vecera (antonin.vecera) wrote :

Is it possible to say (approximately) when the update will come to regular Groovy release?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It appears the update is being blocked by bug 1878293. Let's see if I can unblock it...

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mutter - 3.38.1-2ubuntu1

---------------
mutter (3.38.1-2ubuntu1) groovy; urgency=medium

  * Merge with debian, including various upstream fixes. Remaining changes:
    - debian/gbp.conf: update upstream branch to point to ubuntu/master
    - debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch:
      + X11: Add support for fractional scaling using Randr

mutter (3.38.1-2) unstable; urgency=medium

  * debian/patches: Wayland start Xwayland on public X11 sockets as well
    (LP: #1897224)
  * debian/patches: Don't override window tile monitor (LP: #1900009)
  * debian/patches: Fix resizing issues (LP: #1878293)

 -- Marco Trevisan (Treviño) <email address hidden> Fri, 23 Oct 2020 12:43:24 +0200

Changed in mutter (Ubuntu Groovy):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for mutter has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Samuele Pedroni (pedronis) wrote :

this was also addressed in snapd in https://github.com/snapcore/snapd/pull/9530 in 2.48

Changed in snapd:
status: In Progress → Won't Fix
status: Won't Fix → Fix Committed
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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