"Cannot open display" after session type changed Wayland->X11


I know that this error message is not new in this forum…

Way to reproduce (Ubuntu 20.04, GNOME):

  • boot
  • choose a Wayland GNOME session in GDM
  • use Firefox snap as you can before @oSoMoN achieve to make his patch available by Mozilla in v88 :slight_smile:
  • log out
  • choose a X session in GDM
  • try to launch Firefox snap

I get:

~$ firefox
Error: cannot open display: :0

But, and because of the actual issues in FF snap with Wayland, I tried:

~$ DISABLE_WAYLAND=1 firefox

and FF does launch. I feel I have the same issue with the excellent Xournal++ snap too, because I have to swap Wayland->X11 for screen sharing much often. (It could be damn cool that Focal could one day make available pipewire!)

So, does this deserve a launchpad bug report? Against which package?

I’m not sure what “as you can before @oSoMoN achieve to make his patch available by Mozilla in v88” means.

But, unless that causes the problem, this sounds like a problem with the firefox snap. Log an issue with the maintainer (Mozilla I guess), not on launchpad.

No I don’t think it’s Firefox related.
We got a bug in FF snap since it allows to start FF in Wayland mode. And Olivier has patched the snap in Bugzilla.

And this made me using this env variable before firefox command. So this made me discover that modifying this env variable allows to not having this “cannot open display”.

I will try this when I hit the same issue with Xournal++ snap.

This is known issue which happens because gnome session manager doesn’t remove wayland socket on logout which tricks apps to try to use wayland even when actual session is x11 (after re-login).

See https://gitlab.gnome.org/GNOME/gnome-session/-/issues/75


Ouch! Thanks for pointing this BR.