Back to Blog Overview

Troubleshooting Chromium Snap Issues in VNC Environments on Ubuntu

Published on 30.11.2025

When running a VNC server in a cloud or headless environment, particularly on Ubuntu, you might encounter issues when installing graphical applications via Snap, such as Chromium. One common problem occurs because of how Snap handles graphical sessions, leading to errors that prevent applications from starting correctly.

This issue can be frustrating, especially for those setting up lightweight desktop environments (like XFCE4) on virtual machines or EC2 instances for remote desktop access.

The Problem

Users who install graphical applications via Snap, such as Chromium, in a VNC session may encounter errors like this:

WARNING: cannot start document portal: Expected portal at "/run/user/1000/doc", got "/home/ubuntu/.cache/doc" /system.slice/cron.service is not a snap cgroup

These errors indicate that Snap cannot correctly communicate with the desktop environment through dbus and xdg-desktop-portal, services that are essential for graphical apps to interact with the desktop.

This problem typically occurs because the Snap package management system expects a full desktop environment with correctly initialized session managers, something not always present in VNC environments. Snap applications rely on dbus, a message bus that allows applications to communicate with the desktop environment, but this is often missing or misconfigured in headless setups like those on cloud-hosted VNC sessions.

The issue is well-documented in a bug report found on Launchpad (Bug 1951491), which explains that Snap applications like Chromium expect certain services to be running but fail to start due to the minimal configuration of a VNC session.

Common Symptoms

Some typical symptoms of this problem include:

Why Does This Happen?

When running a VNC server (especially in a cloud environment like AWS EC2) without a full desktop session, many of the components needed by Snap applications, such as dbus and session management, may not be initialized or correctly configured. Snap relies heavily on dbus for inter-process communication and for connecting graphical apps to the display system.

In VNC sessions, the environment variables for display settings and dbus sessions might not be properly set, causing applications like Chromium to fail when trying to interact with graphical components. Since these services aren't correctly configured, the document portal (responsible for file selection dialogs, etc.) also fails to start.

The Solution

Fortunately, there is a workaround that can get your graphical Snap applications working in a VNC session. This solution involves manually starting dbus, setting the correct display, and configuring the environment variables Snap expects.

Follow these steps to fix the problem:

  1. Start dbus manually:
  2. Since dbus isn’t automatically running in a VNC session, start it manually using: "dbus-launch"
  3. This command initializes the dbus session that Snap requires to manage graphical applications.
  4. Set the display environment variable:
  5. Ensure that the DISPLAY environment variable is pointing to the correct VNC display. Typically, this is :1 for the first VNC session: "export DISPLAY=:1"
  6. Allow local connections to the display:
  7. VNC sessions may block local connections by default, so you’ll need to allow them by running: "xhost +local:"
  8. This command allows other applications on the same machine to connect to your display.
  9. Set the DBUS_SESSION_BUS_ADDRESS environment variable:
  10. Finally, set the DBUS_SESSION_BUS_ADDRESS to the correct unix:path, which is often missing in VNC sessions: "export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus""

This combination of commands sets up the proper environment for Snap to function within a VNC session.

Putting it All Together

To fix this issue in your VNC session and get Chromium (or any other Snap application) running, you can run the following commands in your terminal:

dbus-launch export DISPLAY=:1 xhost +local: export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"

After running these commands, you should be able to launch Chromium or other graphical Snap applications without encountering errors related to dbus or the document portal.

Why Does This Work?

These commands manually create the necessary environment that Snap applications expect. Here's a breakdown:

This method ensures that the required services and session managers are properly configured for your Snap applications to function, even in a minimal or headless VNC environment.

Conclusion

When running graphical applications via Snap in a VNC environment on Ubuntu, you might face errors due to missing or misconfigured dbus and session management. However, with the workaround outlined above, you can manually set up the environment to ensure these applications run smoothly. This solution is particularly useful for cloud or headless environments like AWS EC2, where graphical sessions are lightweight and not fully configured by default.

By running a few simple commands, you can bypass the common errors with Snap applications and get them functioning within your VNC server, allowing you to use popular apps like Chromium without further hassle.