5

I've been trying to set up a virtual display with Xorg, but there's just no virtual display in xrandr.

This seems to be totally ignored:

Section "Device"
        Identifier "Device1"
        Driver     "intel"
        Option     "VirtualHeads" "1" 
EndSection

Specs:

  • OS: Debian Testing (Bullseye)
  • Nvidia proprietary driver version: 440.82
  • CPU: Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz

lspci

xrandr --verbose

xorg.log

xorg.conf

I've also tried adding this to the xorg.conf with no success (I've tried Device1 as well):

Section "Screen"
     Identifier      "VirtualScreen0"
     Device          "Device0"
     SubSection "Display"
            Virtual         1600 900
     EndSubSection
EndSection

Why: I want to use my laptop as a second display using VNC.

I've spent half of a day trying to figure this out, but with no success. I feel like I've tried everything. Does anyone have any clue how to get this working?

Thank you very much.

1 Answer 1

10

The Device section with VirtualHeads is being ignored because you do not have an Intel card (your xorg.log indicates you have NVidia). Unfortunately the nvidia driver doesn't support virtual screens (the modesetting driver that's recommended for intel cards nowadays doesn't support it either, btw), and it's not possible to use the dummy driver without breaking xrandr in the process (you'd need to have a static "xinerama" configuration in xorg.conf and that's not something you want to do in 2020).

Fortunately it's possible to (ab)use the DisplayLink evdi kernel module to add virtual outputs to any Xorg driver that has the Source Output xrandr provider. The process is as follows:

  1. Install evdi, either via apt install evdi-dkms or, if you get build errors because your kernel is too new, using this make target from DisplayLink's git repo.
  2. Load the kernel module:
    modprobe evdi initial_device_count=2
    
    You may then add
    options evdi initial_device_count=2
    
    to /etc/modprobe.d/local-evdi.conf to persist this across reboots.
  3. Restart X, you should now see two additional Sink Output providers in xrandr --listproviders
  4. Enable the new output:
    xrandr --setprovideroutputsource 1 0 --setprovideroutputsource 2 0
    
    You'll need to do this whenever you restart X, so put it to some autostart or something.
  5. Add the desired output resolution to the xrandr configuration
    xrandr --addmode DVI-I-1-1 1920x1080
    
  6. Enable the new output:
    xrandr --output DVI-I-1-1 --mode 1920x1080 --right-of HDMI-0
    

Now there's a second dummy screen to the right of your primary one and you can start a VNC server there. Hope it works for you! :-)

10
  • Thank you for clarification. I've tried what you suggested and sadly nothing changed. The output of xrandr --verbose is still the same. This is my current xorg.conf and this is my current xorg.log. May 7, 2020 at 8:17
  • Oh, you're right, I just tried it myself and it's not as easy as I thought. I'll edit the answer with a working solution. May 7, 2020 at 9:24
  • Edited my answer with an alternative solution that I actually tested and confirmed. Hope it works! May 7, 2020 at 9:40
  • I've followed your instruction. When I run xrandr --output DVI-I-1-1 --mode 1920x1080 --right-of HDMI-0 my computer froze, at that moment I had to leave. I come back in an hour or so and the virtual display was there, but there were artefacts around the cursor. I decided to try to restart my PC to see if it persists. I run the command that froze my PC before and it happened again. I waited for 30 minutes and then surrendered. I SSHed into the PC from my Notebook and retrieved the Xorg.log. Any idea what could be the problem. Thanks for the help. May 7, 2020 at 15:58
  • Oh. :-( Unfortunately I don't have any further ideas. It's possible that it only works reliably with intel, or maybe it's something else entirely. I'm sorry. May 7, 2020 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.