Failed to install org.gnome.Platform: Unable to connect to system bus

I have WSL 2:

wsl -l -v
  NAME                   STATE           VERSION
* Debian                 Running         2
  docker-desktop-data    Stopped         2
  docker-desktop         Stopped         2

However I am having a problem installing a GNOME-based app:

$ flatpak install flathub com.github.geigi.cozy
Looking for matches…
Required runtime for com.github.geigi.cozy/x86_64/stable (runtime/org.gnome.Platform/x86_64/40) found in remote flathub
Do you want to install it? [Y/n]: Y

com.github.geigi.cozy permissions:
    ipc        network        fallback-x11          pulseaudio            wayland
    x11        dri            file access [1]       dbus access [2]       bus ownership [3]

    [1] host, xdg-run/gvfs, xdg-run/gvfsd
    [2] org.freedesktop.Notifications, org.gtk.vfs.*
    [3] org.mpris.MediaPlayer2.Cozy


        ID                                           Arch           Branch         Remote          Download
 1. [✗] org.gnome.Platform                           x86_64         40             flathub           349.5 MB / 363.9 MB
 2. [ ] org.gnome.Platform.Locale                    x86_64         40             flathub         < 333.8 MB (partial)
 3. [ ] org.freedesktop.Platform.GL.default          x86_64         20.08          flathub         < 106.4 MB
 4. [ ] org.freedesktop.Platform.openh264            x86_64         2.0            flathub           < 1.5 MB
 5. [ ] com.github.geigi.cozy                        x86_64         stable         flathub           < 4.1 MB
 6. [ ] com.github.geigi.cozy.Locale                 x86_64         stable         flathub         < 373.4 kB (partial)

Error: Unable to connect to system bus
error: Failed to install org.gnome.Platform: Unable to connect to system bus

What's the current workaround to install GNOME-based apps with WSL 2?


A couple of likely issues that you are facing. I go into great detail on it in this Ask Ubuntu answer, so I'm not going to repeat everything here, but at a high level:

Issue #1: Gnome requires Systemd, which WSL doesn't support directly

There are several scripts out there to enable Systemd on WSL. See this SO question for some options.

At a basic level, this involves creating a new namespace where Systemd can be PID1, entering that namespace, and then running your apps and commands from inside that namespace. That's what my AU answer that I linked above covers. That technique does have limitations, though, which is what the more complex scripts such as Genie and WSL2 Hacks attempt to handle.

Issue #2: WSL2 doesn't include GUI app support by default

If you have Windows 11, you can use WSLg, or you can use one of the alternative solutions in this SO question (or several other questions and answers across the Stack Exchange network).