Desktop snaps don't start at all in Xorg sessions if a Wayland session has been used

Bug #1965113 reported by Daniel van Vugt
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Incomplete
Undecided
Unassigned
gnome-session
New
Unknown
gnome-session (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

Firefox 98.0.1-2 snap doesn't start at all in Xorg sessions.

$ /snap/bin/firefox
Error: cannot open display: :0

$ echo $DISPLAY
:0

And other X11 apps still work just fine.

Tags: jammy snap x11
Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Could you share the output of

$ snap connections firefox

it's working fine here but could it be that somehow the x11 interface isn't connected for you?

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

And today it just works.

Changed in firefox (Ubuntu):
status: New → Invalid
status: Invalid → New
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Failing again. It only fails in Xorg sessions after I've launched it in a Wayland session and then logged out.

1. Log into a Wayland session and launch Firefox.
2. Log into a Xorg session and Firefox can't start.

'snap connections firefox' shows as connected?;

  x11 firefox:x11 :x11

Rebooting fixes the problem. I can launch Firefox again.

summary: - Firefox 98.0.1-2 snap doesn't start at all in Xorg sessions
+ Firefox 98.0.1-2 snap doesn't start at all in Xorg sessions if a Wayland
+ session has been used
Revision history for this message
Olivier Tilloy (osomon) wrote : Re: Firefox 98.0.1-2 snap doesn't start at all in Xorg sessions if a Wayland session has been used

That's a known issue, see https://forum.snapcraft.io/t/cannot-open-display-after-session-type-changed-wayland-x11/23838. The problem appears to be partly in gnome-session (https://gitlab.gnome.org/GNOME/gnome-session/-/issues/75), partly in the snapcraft desktop extensions that assume a wayland session if there's a lingering wayland socket (https://github.com/snapcore/snapcraft/blob/main/extensions/desktop/common/desktop-exports#L240).

It is not specific to the firefox snap, and it can be worked around by running the apps with DISABLE_WAYLAND=1.

affects: firefox (Ubuntu) → gnome-session (Ubuntu)
summary: - Firefox 98.0.1-2 snap doesn't start at all in Xorg sessions if a Wayland
- session has been used
+ Desktop snaps don't start at all in Xorg sessions if a Wayland session
+ has been used
Changed in gnome-session (Ubuntu):
importance: Undecided → Medium
Changed in gnome-session (Ubuntu):
status: New → Triaged
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Is there a better way to detect a wayland session?

Changed in snapcraft:
status: New → Incomplete
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It looks like the presence of environment $WAYLAND_DISPLAY should work.

You can't rely on $DISPLAY to detect X11 because that exists in both Xorg and Wayland sessions thanks to Xwayland.

Changed in gnome-session:
status: Unknown → New
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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