Skip Navigation

Anyone knows how to properly start a multiseat wayland with a desktop environment or window manager running?

Anyone knows how to properly start a multiseat wayland with a desktop environment or window manager running?

I just need simple stuff such as profile initialization of the user and if it's possible to just share the same discrete GPU across multiple seats?

The end result? I want to isolate my current user space from the gaming space where I can just connect using moonlight/sunshine. I want it all headless.

#linux #linuxgaming #wayland #x11 @linux_gaming

10
10 comments
  • How many GPUs do you have? If only one, not possible, at least not easily.

    But, to answer the question, yes I know. It's kind of a mess because the API is very much designed around display managers. Basically you need to call some DBus functions after authenticating the user but before dropping privileges to register the user with logind. The result of that is some permissions are modified to your user so the compositor has access to keyboard, GPU, mouse, etc. That makes running two sessions of the same user really hard because that lets the compositor try to grab the same resources as the other session.

    Here's the script I had made, but I ended up just using a VM for a while since I wanted to also isolate installed packages and whatnot so it's barely enough to start gamescope.

    #!/usr/bin/env python3
    import os
    import dbus
    
    sysbus = dbus.SystemBus()
    
    login = sysbus.get_object(
            "org.freedesktop.login1",
            "/org/freedesktop/login1"
    )
    
    manager = dbus.Interface(login, dbus_interface="org.freedesktop.login1.Manager")
    
    manager.CreateSession(
            1001,           # u uid
            os.getpid(),    # u pid
            "tv",           # s service
            "wayland",      # s type
            "user",         # s class
            "gamescope",    # s desktop
            "seat1",        # s seat_id
            0,              # u vtnr
            "",             # s tty
            "HDMI-A-1",     # s display
            False,          # b remote
            "tv",           # s remote_user
            "localhost",    # s remote_host
            []
    )
    
    os.execve("/usr/bin/fish", ["--login"], { "XDG_SEAT": "seat1" })
    

    Run it with

    sudo systemd-run --system --scope
    

    This will make systemd create a fully detached session from your user, so you can su to a different user, run PAM modules, start the XDG session.

    • @Max_P That looks amazingly promising regardless. I'm still bummed and a bit confused on the one shared GPU business I thought it wouldn't matter if you ran multiple graphical applications regardless or is this imposed by Wayland at the moment? If not wayland would X11 do the same?

      Just throwing questions more out of curiosity.

      How... do you find all these pieces to glue together? Who or what is putting these out there "hey I want to initiate an desktop env"

      Thank you!!

      • How... do you find all these pieces to glue together? Who or what is putting these out there "hey I want to initiate an desktop env"

        Painful reading of the manuals. You really need to know what you're looking for, what keywords to search. I also played around a good bit with SDDM's source code to piece it together/see a working example.

        Some docs

        I'm still bummed and a bit confused on the one shared GPU business I thought it wouldn't matter if you ran multiple graphical applications regardless or is this imposed by Wayland at the moment? If not wayland would X11 do the same?

        It's mostly that on Linux, GPUs are a bit all or nothing at the moment. You can have two sessions running, but only one of them can be active at a time. You can't have one on one monitor and one or another. Well technically you can, but people basically run Sway with a full screen nested compositor on each monitor.

        Technically there's nothing preventing the creation of a headless compositor with GPU acceleration. It's just such a niche use case I don't know of any compositor that lets you do that. They use nested compositors for development, but those still need a window on the parent compositor.

        X11 won't save you there, people use specialized headless servers for that like xvnc (not to confuse with x11vnc which runs as a X11 client) or xephyr because Xorg can't do headless on its own that I know of.

        My use case was barely slightly less niche than yours: I wanted Steam big picture on my TV at all times, independently from my main session so I can just pick up a controller and play. That's possible, I got it to launch, but in the end there was too much mixing in with my daily system I figured I kinda want a clean install with just the necessary packages, so I ended up back with VFIO.

  • You may be interested in a project called "wolf". Its goal is to run graphically accelerated containers using a Wayland compositor that uses gstreamer as the backend instead of a display. After that, wolf serves as your moonlight server. There are hoops to jump through if you're using Nvidia, and the software is very young. But I think it shows promise.

    https://games-on-whales.github.io/wolf/stable/

    I haven't tried it myself yet, if you give it a go, let me know how you get on. 🙂

You've viewed 10 comments.