How to create a virtual monitor/display?

I know that this is a bit of an old thread, but I wanted to reply since I went through the same problem and managed to find a solution that works for me.

I currently have a Linux Mint install on a computer that is acting as a NAS/Home server. While I can do quite a few things through the terminal, there are some occasional things that I need to do that I have an easier time doing through GUIs. I am using the Cinnamon DE, and since Cinnamon added experimental support for Wayland, I setup my server with a monitor attached to auto-login into Wayland Cinnamon. After finishing setup, I detached the monitor. (Since I would only be using GUIs occasionally, I know I could just use X11 Cinnamon, but I wanted Wayland and I was stubborn about it.)

The method I used to get a virtual display working is Kernel mode settings. It can be read more about it here:
wikidotarchlinuxdotorg/title/Kernel_mode_setting

The steps I used to achieve this were:

Step 1: I extracted the edid of the monitor that I would be using on the client into an edid.bin file. Since the monitor I extracted from was 2560x1440@60, I renamed the file qhd.bin.
In addition to extracting edid directly from a monitor, some good edid files can be downloaded from here:
githubdotcom/xi784/EDID-Emulator-Profiles

Step 2: I transferred the qhd.bin file to the headless server and placed it in “/usr/lib/firmware/edid/qhd.bin”. From here on out, the rest of my code was ran on the headless server.

Step 3: Next, I figured out what outputs my gpu on my headless server has by running “ls /sys/class/drm/card*”. This gave the results:
/sys/class/drm/card0@ /sys/class/drm/card0-HDMI-A-1@ /sys/class/drm/card0-HDMI-A-3@ /sys/class/drm/card1-DP-2@ /sys/class/drm/card1-DVI-I-1@
/sys/class/drm/card0-DP-1@ /sys/class/drm/card0-HDMI-A-2@ /sys/class/drm/card1@ /sys/class/drm/card1-DP-3@
I ended up using output “HDMI-A-1” since it was on GPU “card0” ,and from my tests “card1” would not have a visible mouse cursor in Wayland through Moonlight, vs “card0” which did not have this problem. Both cards had visible cursors when using an X11 DE through Moonlight. Having chosen my output, I then ran “sudo nano /etc/default/grub” and changed:
GRUB_CMDLINE_LINUX=“”
to:
GRUB_CMDLINE_LINUX=“drm.edid_firmware=HDMI-A-1:edid/qhd.bin video=HDMI-A-1:1280x720@120e”
The important parts are the last “e” from “video=HDMI-A-1:1280x720@120e” which basically tells the OS to treat the corresponding GPU port as if there is a monitor attached even if a monitor is not attached, and “edid/qhd.bin” from “drm.edid_firmware=HDMI-A-1:edid/qhd.bin” which specifies the edid of the virtual monitor. I also added in “1280x720@120” as an extra resolution and refresh rate.

Step 4: Finally, I ran “sudo update-grub” and then rebooted the headless server. At this point, I head my virtual monitor working, and because of my setup, the virtual monitor was treated as if it was actually hooked up to the GPU. Technically, what I am doing is software edid emulation.

Unfortunate, there is still one last issue that I ran into. The edid I used came from a 2560x1440 monitor, but when using that edid on the HDMI-A or DP GPU outputs, the max resolution of my virtual monitor was 2048x1080. I was able to get 2560x1400 when using the DVI output, but since that was on “card1” that would mean no cursor when using Wayland through Moonlight. On the other hand, using the EDIDs from githubdotcom/xi784/EDID-Emulator-Profiles allowed the GPU ports to max out at their maximum settings, which were 3840x2160@30 for the HDMI-A and 3840x2160@60 for the DP.

3 Likes