You will see those same warning messages if you start Firefox from the
command line in a local session. The only reason you don't normally see
them is that you normally start Firefox from the icon. You will find
that both Firefox and Chrome spew a lot of command-line warnings such as
those, regardless of platform. However, in this case, the warning
messages appear to be a result of how Firefox is deployed as a snap
application. Snap applications are deployed with all of their
dependencies self-contained, which is not the typical way in which Linux
applications are deployed. In fact, the snap back end is proprietary,
so snaps only exist on Ubuntu. Snaps are essentially a closed-source
packaging system on top of an open-source O/S, and they are somewhat
controversial for that reason and others
(
https://www.reddit.com/r/linux/comments/j3ajnf/whats_wrong_with_snaps_why_so_many_people_hate_it/).
The core of the issue is that TurboVNC sessions each create an
independent D-Bus session bus instance. That allows multiple window
manager instances to co-exist simultaneously under the same user
account. However, apparently the snap system expects to use the
systemd-provided D-Bus session bus instance. (More specifically, this
is the case with confined snaps. Unconfined snaps should work as
expected with TurboVNC.) If you google "is not a snap cgroup" and
"dbus_session_bus_address", you'll see that this issue is not specific
to TurboVNC. It exists with all multi-session Linux remote desktop
software (X2Go, etc.), because all multi-session Linux remote desktop
software similarly creates an independent D-Bus session bus instance for
each remote desktop session. You can, in fact, reproduce the issue in a
local session by starting firefox with:
dbus-launch --sh-syntax --exit-with-session firefox
I really believe that this is a limitation of the snap system. If
confined snaps fundamentally cannot work with an independent D-Bus
session bus instance, then the snap system should ignore
DBUS_SESSION_BUS_ADDRESS when launching such applications. But since
snap is a proprietary technology, good luck getting any movement on that.
There are several ways to work around the issue:
1. The most non-intrusive way is to unset DBUS_SESSION_BUS_ADDRESS when
starting snap applications in a TurboVNC session. That forces the
applications to use the systemd-provided D-Bus session bus instance
rather than the D-Bus session bus instance associated with the TurboVNC
session. That means that you will be limited to one simultaneous
instance of each application, but Firefox aggressively disallows more
than one simultaneous instance of itself anyhow.
2. TigerVNC takes a different approach to launching VNC sessions, using
systemd rather than a vncserver script. Their approach is supposedly
more systemd-friendly and doesn't experience this specific issue with
snap applications. However, in my testing, their approach has other
issues. On Ubuntu 22.04 specifically, TigerVNC sessions launched using
the latest official TigerVNC binaries do not display the GNOME 3 GUI
properly. (They just show a blank desktop with no sidebar or taskbar,
and the window decorations are incorrect.) Also, in my testing,
sessions started in that manner sometimes immediately crash on Ubuntu
22.04. I could adopt TigerVNC's approach as an optional means of
starting TurboVNC sessions (replacing the current init.d method of
starting TurboVNC sessions, which is a poorly-documented and rarely-used
legacy of TightVNC.) However, that would take a lot of effort, in part
because I would want to document and test it more thoroughly than
TigerVNC apparently has. At the moment, I'm not convinced that starting
sessions with systemd has any advantages other than addressing this
specific issue, and there are less intrusive ways of addressing this issue.
3. I could add a vncserver/turbovncserver.conf option that causes the
TurboVNC session to forego creating an independent D-Bus session bus
instance. (That is the main reason why TigerVNC doesn't experience this
issue.) That would effectively fix this issue on a per-session basis,
but it would also prevent you from starting multiple TurboVNC sessions
(or a TurboVNC session and a local session) simultaneously under the
same user account (essentially the same limitations as TigerVNC.) Note
that you can already achieve the same effect by copying
/opt/TurboVNC/bin/xstartup.turbovnc to ~/.vnc, editing
~/.vnc/xstartup.turbovnc and commenting out all of the dbus-launch
stuff, and setting $xstartup = "$vncUserDir/xstartup.turbovnc" in
~/.vnc/turbovncserver.conf.
If you ask me, the nicest approach is just to acknowledge that snap
applications are the problem and work around the problem only for those
applications-- or not use snap applications at all, or use Chrome like
65% of the people surfing the web do. The alternative is to
artificially limit the TurboVNC infrastructure for the sole purpose of
supporting a proprietary application deployment system whose authors
couldn't be bothered to test their system with multi-session remote
desktop software.
I am more than happy to implement Item 3 above if that would make you
happy. I can't think of anything else that I can realistically do to
address this at the moment. (Item 2 would take a lot longer and would
probably require some funding.) Hopefully the tome above explains why I
can't just wave a magic wand and make TurboVNC behave in all cases like
a local session. Even if TurboVNC severely sacrificed functionality, as
TigerVNC has done, it still wouldn't behave in all cases like a local
session. Developing TurboVNC is really difficult, because I have to hit
multiple moving targets across multiple distributions and operating
systems. I do the best I can with a very limited budget and a
development team consisting only of me.
DRC