Score:0

Xrandr: can't open display (trying to add fake display)

mm flag

I've installed Ubuntu 22.04.2 LTS on my PC. There's a scenario that I need to access this PC using Moonlight and Sunshine when there's no monitor connected to my GPU. Sunshine is the host streaming service and Moonlight the client service. Sunshine uses Xorg and PulseAudio. I've started Sunshine successfully on my PC when there's a monitor connected to my GPU. Only then I'm able to connect to my PC via Moonlight.

If there's no monitor connected Xorg fails to start and so does Sunshine. I've done some research and I know it's possible to fake a dummy screen with some Xorg configuration and an edid.bin file.

I disconnected the monitor beforehand and got access to my PC via a SSH session. The steps I followed:

  1. I've downloaded this edid.bin file for my screen
  2. I ran the following command: sudo nvidia-xconfig -a --allow-empty-initial-configuration --use-display-device="DP-0" --connected-monitor="DP-0" --custom-edid="DP-0:/home/$USER/edid-2.bin"
  3. I looked in the /etc/X11/ directory and found there's a file created called xorg.conf
  4. The contents of the file looks like this:
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 525.105.17

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce RTX 3060 Ti"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "AllowEmptyInitialConfiguration" "True"
    Option         "UseDisplayDevice" "DP-0"
    Option         "CustomEDID" "DP-0:/home/lucas/edid-2.bin"
    Option         "ConnectedMonitor" "DP-0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

  1. I've checked if Xorg is running by running the following command: ps aux | grep xorg:
root        1241  0.1  0.1 25349916 53660 tty1   Sl+  15:48   0:00 /usr/lib/xorg/Xorg vt1 -displayfd 3 -auth /run/user/127/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -novtswitch -verbose 3
lucas       2392  0.0  0.0   9216  2432 pts/0    S+   15:50   0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox xorg
  1. I've checked the /var/log/Xorg.0.log file and found no errors. I also validated the screen was correctly connected.

But after running the command xrandr it returns the Can't open display error. I've tried display number 0 to 10 and only at xrandr --display :0 it returns: Authorization required, but no authorization protocol specified. Can't open display :0

I've also tried to edit the .Xauthority file by running the following command: xauth add :0 . $(xxd -l 16 -p /dev/urandom). But the xrandr command returned the Invalid MIT-MAGIC-COOKIE-1 key error

Afterwards I deleted the /etc/X11/xorg.conf file and the .Xauthority file. Then connected my monitor again and everything works fine again using my monitor. Also those files I deleted weren't regenerated. How's is it even possible to run Xorg without those files?

So does anyone have an idea how to properly fake this Xorg screen when no monitor is connected so that I can launch Sunshine and connect via Moonlight to my PC? If you need some more information; please ask!

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.