ubuntu18.04 install a virtual display, you can remote desktop without connecting the display



Host configuration

  • System: Ubuntu 18.04
  • Graphics: Intel integrated graphics

Enable remote control

Note that if the teamviewer has a login account, through the account link, it does not matter whether there is the remote desktop control that comes with Ubuntu.
If teamviewer enters a randomly generated password or clicks "Receive / Confirm" on the host to allow the remote desktop to control the link, then of course there must be Ubuntu's remote desktop control service running, first through the VNC-Viewer link control; Get the password or click to receive, then teamviewer can link.

Why use Teamviewer instead of the built-in remote desktop control software? – Because Teamviewer is relatively fast (data will be compressed when transferring desktop images and then transferred on the network).
Even if they are all on the LAN, Teamviewer is faster.


Install software and support

Install the software that makes Ubuntu use a virtual display:

$ sudo apt-get install  xserver-xorg-core-hwe-18.04
$ sudo apt-get install  xserver-xorg-video-dummy-hwe-18.04  --fix-missing

Modify / create configuration file (the virtual display will be used by default):

$ sudo vim /usr/share/X11/xorg.conf.d/xorg.conf
Section "Device"
    Identifier  "Configured Video Device"
    Driver      "dummy"
EndSection
Section "Monitor"
    Identifier  "Configured Monitor"
    HorizSync 31.5-48.5
    VertRefresh 50-70
EndSection
Section "Screen"
    Identifier  "Default Screen"
    Monitor     "Configured Monitor"
    Device      "Configured Video Device"
    DefaultDepth 24
    SubSection "Display"
    Depth 24
    Modes "1920x1080"
    EndSubSection
EndSection
~
~
~
:wq
$

Note: Although the configuration says "1920x1080", it actually supports "1360x768" at most

n/a

How to support 1920x1080 is temporarily unclear; I think 1360x768 is enough, so I haven't studied it deeply.

Support 1920x1080, see Reference below 3.

Restart to take effect


other

Related commands:

xrandr: After using the virtual display, use the xrandr command to view the display information as follows (this display result is slightly different from the original physical display):

xrandr -q 
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 320 x 240, current 1360 x 768, maximum 1360 x 768
default connected primary 1360x768+0+0 0mm x 0mm
   1360x768      60.00* 
   1280x720      60.00  
   1024x768      60.00  
   1024x576      60.00  
   960x540       60.00  
   800x600       60.00    56.00  
   640x480       60.00  
   684x384       60.00  
   680x384       60.00  
   640x360       60.00  
   512x384       60.00  
   512x288       60.00  
   480x270       60.00  
   400x300       60.00    56.00  
   320x240       60.00

     
     
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

Xvfb: X Virtual Framebuffer
may consider using Xvfb to create virtual displays in automated testing.
The specific usage is beyond the scope of this article.


Precautions

After restarting, even if the monitor is connected, no signal will be output to the monitor!
However, the VNC-Viewer can be linked to the Ubuntu host for "remote" desktop control, just as before installing the software and modifying the configuration file according to this article.



Reference

  1. How to use Ubuntu 18.04 on VNC without display attached?
  2. Add Fake Display when No Monitor is Plugged In
  3. How to run X server using xserver-xorg-video-dummy driver on Ubuntu
Published 63 original articles · praised 7 · views 3396

Guess you like

Origin blog.csdn.net/weixin_44523062/article/details/105405019