3

What I'd like to do is have

  • a container (OCI container, preferably) that works without a host session manager interface exposed "into" it, and
  • runs a wayland compositor
  • has a >= gnome40 session including all the UI elements in it
  • allows for remote display and interaction via RDP or VNC

So, that dictates/suggests as tooling, respectively:

  • podman
  • mutter (as that what Gnome would want)
  • gnome-shell
  • gnome-remote-desktop, which comes with Gnome42

What I'm currently doing is

podman run -it --rm -p 9999:9999 ubuntu:22.04
#           ^---------------------------------Interactive
#               ^-----------------------------Don't keep state after finishing
#                    ^------------------------We'll need a port fwd into the container for RDP/VNC
#                                ^------------Not a great fan of Canonical, but 22.04 brings Gnome42

root@container$> apt update; apt install -y mutter gnome-remote-desktop gnome-shell
[… [success]]

root@container$> mutter --no-x11 --wayland --headless --virtual-monitor 1600x1000 
mutter-Message: 10:30:35.151: Running Mutter (using mutter 42.0) as a Wayland display server
mutter-Message: 10:30:35.191: Created surfaceless renderer without GPU
mutter-Message: 10:30:35.205: Disabling DMA buffer screen sharing (not hardware accelerated)
mutter-Message: 10:30:35.205: Added virtual monitor Meta-0

(mutter:13413): mutter-WARNING **: 10:30:35.211: WL: error: XDG_RUNTIME_DIR not set in the environment
(mutter:13413): mutter-ERROR **: 10:30:35.211: Failed to create socket
root@container$> export XDG_RUNTIME_DIR=/run/user/0/ ; mkdir -p ${XDG_RUNTIME_DIR}
root@container$> mutter --no-x11 --wayland --headless --virtual-monitor 1600x1000 
mutter-Message: 10:30:47.657: Running Mutter (using mutter 42.0) as a Wayland display server
mutter-Message: 10:30:47.698: Created surfaceless renderer without GPU
mutter-Message: 10:30:47.712: Disabling DMA buffer screen sharing (not hardware accelerated)
mutter-Message: 10:30:47.712: Added virtual monitor Meta-0
mutter-Message: 10:30:47.717: Using Wayland display name 'wayland-0'
**
mutter:ERROR:../src/wayland/meta-wayland.c:379:set_gnome_env: assertion failed: (session_bus)
Bail out! mutter:ERROR:../src/wayland/meta-wayland.c:379:set_gnome_env: assertion failed: (session_bus)

[1]+  Aborted                 (core dumped) mutter --sm-disable --no-x11 --wayland --headless --virtual-monitor 1600x1000

Not quite sure where to go from here. Should I be starting a gnome shell directly?

# fresh container to avoid any conflicts
root@7396d1bb8693:/> gnome-shell --no-x11 --wayland --headless --virtual-monitor 1600x1000
mutter-Message: 10:45:06.276: Running GNOME Shell (using mutter 42.0) as a Wayland display server
mutter-Message: 10:45:06.323: Created surfaceless renderer without GPU
mutter-Message: 10:45:06.337: Disabling DMA buffer screen sharing (not hardware accelerated)
mutter-Message: 10:45:06.338: Added virtual monitor Meta-0
Failed to connect to session bus: Cannot autolaunch D-Bus without X11 $DISPLAYroot@7396d1bb8693:/>

Doesn't work either.

  • How do I start a headless gnome wayland session in an unprivileged container?

1 Answer 1

1
+400

I managed to get the following working on GitHub actions (not sure if it's as unpriviledged as OCI, so maybe it cannot work fully for you):

  run: |
    sudo apt-get install mutter dbus-x11;
    dbus-launch --auto-syntax > dbus-env;
    source dbus-env;
    mutter --no-x11 --headless --virtual-monitor 1920x1080 &

the source dbus-env will setup the right environment variables for further processes to connect to the display.

2
  • Ah that might just work, actually :) Gotta experiment, but with XDG_RUNTIME_DIR set you can actually start a mutter session and run a gnome-remote-desktop with that. Nice! Commented Feb 10, 2023 at 13:30
  • this brought me much forward! Commented Feb 10, 2023 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .