Add Fake Display when No Monitor is Plugged In

281,719

Solution 1

Found a way to do it without requiring a dummy plug: Ubuntu Headless VNC VESA 800x600 Resolution Fix ~ Andy Hawkins @ June 12, 2011

Basically install a dummy driver:

sudo apt-get install xserver-xorg-video-dummy

Then write it in the /usr/share/X11/xorg.conf.d/xorg.conf (or possibly /etc/X11/xorg.conf) file (create one, if it does not exist):

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 "1024x800"
    EndSubSection
EndSection

Then restart the computer.

Solution 2

Specify the resolution on a Ubuntu 14.04 desktop without a monitor connected:

From the xrandr man page:

--fb widthxheight
   Reconfigures the screen to the specified size. All configured 
   monitors must fit within this size. When this option is not 
   provided, xrandr computes the smallest screen size that will 
   hold the set of configured outputs; this option provides a 
   way to override that behaviour.

Therefore use the command after connecting:

xrandr --fb 1280x1024

Solution 3

Hardware Solution

This is a hardware solution/workaround which may work for some graphics hardware/driver. Also could be better, if you need to plug physical monitor frequently, so you don't have to restart X Server like with dummy/vesa/fb driver (static configuration).

  • Either you buy a Dummy VGA (or DVI analog) plug or some calling it Dummy Dongle.

  • Or just build it, use 3 resistors of around 75 Ohm (a standard) at the VGA output: 1→6, 2→7, 3→8.

    +/- 10 Ohm may work without any problem. Some cards work with just one resistor. (Like my Intel, 2→7 or 3→8, will detected as a monitor). By the way, this is standard impedance which implemented in the VGA monitors.

Reference: How to create dummy plugs for your graphics cards.

Users who are curious to read more about monitor & its resolution detection, I would recommend reading about VESA DDC & EDID too.

Solution 4

Consider Xvfb which is probably least likely to mess up the display when you actually plug in a real monitor

The following commands will start lightdm on a fake display with ID 1 and resolution 1024x76

export DISPLAY=:1
Xvfb :1 -screen 0 1024x768x16 &
sleep 1

#exec gnome-session & # use gnome-session instead of lightdm
exec lightdm-session &

Solution 5

For me no one of the above solution works. To add a new device/screen VIRTUAL1, what has worked for me is :

  • Install the packet xserver-xorg-video-dummy
  • Update xorg.conf

All details are here : Add Fake Display when No Monitor is Plugged In

Info : for me, it works in editing /etc/X11/xorg.conf instead of /usr/share/X11/xorg.conf.d/xorg.conf

Share:
281,719

Related videos on Youtube

John Chapman
Author by

John Chapman

I am a software engineer living in Phoenix, AZ. I thrive on the challenge of writing code to overcome the impossible, annoying, or otherwise difficult obstacles. I am a Software Development Engineer at Amazon.com. Buy my books: SharePoint 2013 WCM Advanced Cookbook and Automating Microsoft Azure with PowerShell http://www.johnchapman.net http://twitter.com/chapmanjw

Updated on September 18, 2022

Comments

  • John Chapman
    John Chapman over 1 year

    I have an Ubuntu 14.04 server that has no external monitor connected. I use NoMachine to remote control the machine. When I do so, the Unity/Gnome interface doesn't see any monitors connected, so I can only use 800x600 when connecting with NoMachine. If I plug in a monitor, I can set the resolution to whatever size the NoMachine window is on the remote computer.

    Is there a way to create a "fake" monitor device on Ubuntu so I can set a desktop resolution in Unity/Gnome?

    • Areeb Soo Yasir
      Areeb Soo Yasir about 4 years
      For those using a headless VM I normally use this: realtechtalk.com/…
  • John Chapman
    John Chapman about 10 years
    Sounds like an interesting idea. I'll give it a shot.
  • Alexander Taylor
    Alexander Taylor over 9 years
    related info for those using NoMachine who want to change the screen resolution but have a monitor plugged in on the remote site with a different ratio, so really need the dummy driver: ubuntuforums.org/showthread.php?t=1832456 and xpra.org/xorg.conf and when NoMachine says there are no sessions, debug here: /var/log/Xorg.0.log refresh changes: sudo service lightdm restart sudo su sudo /etc/NX/nxserver --restart exit
  • cctan
    cctan almost 9 years
    Please edit the answer, the package is being updated. Try sudo apt-cache search video-dummy.
  • brcebn
    brcebn over 7 years
    Your patch works like a charme. What about a screen not always connected? Because right now, with this patch and a screen, the computer is stuck because X server fails to load.
  • burtsevyg
    burtsevyg over 7 years
    Cool, it's work!
  • Jason Capriotti
    Jason Capriotti about 7 years
    Honestly, this is the simplest way to go. There are plenty of tutorials out there for workarounds, but this just plain works and will save you a lot of time. The DIY option seems solid, but dummy plugs on Amazon are $20. Just make sure you get a good one to support your resolution.
  • ar2015
    ar2015 almost 7 years
    For me it say's: Can't open display
  • Terrance
    Terrance over 6 years
    @ar2015 Run the command as xrandr --fb 1280x1024 -display :0
  • Arthur Kovacs
    Arthur Kovacs over 6 years
    The problem I get now is when I connect a real monitor it won't work. Only if I uninstall all the packages and restart. Couldn't we do a priority thing ?
  • Neinstein
    Neinstein about 6 years
    This broke my Kubuntu 17.10 in a way it wouldn't boot properly until I removed the file with the help of an usb installation. Be careful, have a plan in case this goes wrong. (Admittedly layman here.)
  • Derek
    Derek about 6 years
    Also broke my os. Did not boot. Its remote and now I need to get in a car and drive 1hr. Risky stuff :-)
  • Ludwig Schulze
    Ludwig Schulze over 5 years
    @Derek Which of these was it? (1) Placing the xorg.conf file really broke your ssh server (How???). (2) You had no ssh server set up, VNC to the X session was your only access mode. (3) Random unrelated HW Failure. // Cause I'm going to try the same to a remote machine. I can't imagine how the ssh server will be affected even if the X session will fail to start.
  • soulmachine
    soulmachine over 5 years
    This works for me! However there is a problem that if I attach a real monitor it's always black screen
  • Rufus
    Rufus over 5 years
    @Terrance I am getting No protocol specified Can't open display :0
  • iBug
    iBug almost 5 years
    How can I add two dummy screens in this way?
  • frommelmak
    frommelmak almost 5 years
    For ubuntu 18.04 the package name is xserver-xorg-video-dummy-hwe-18.04 Also solves the same problem with Teamviewer 14
  • sangorys
    sangorys over 4 years
    For me, it works in editing /etc/X11/xorg.conf instead of /usr/share/X11/xorg.conf.d/xorg.conf
  • DedaDev
    DedaDev over 4 years
    Thanks, this helped me to run chrome on Debian without display.
  • Sam-Graham
    Sam-Graham over 4 years
    Seconding @frommelmak had to install server-xorg-video-dummy-hwe-18.04 and the config, then everything worked.
  • Vik
    Vik over 4 years
    @Sam-Graham what exactly worked for you? I installed the dummy package install server-xorg-video-dummy-hwe-18.04, things work great when no monitor is attached. However when I plug in a monitor I get a black screen with a blinking cursor.
  • Sam-Graham
    Sam-Graham over 4 years
    @Vik I was in the same boat as frommelmak and was connecting using Teamviewer. I had the same issue as you with the monitor being blank if you plugged in a real one. I had to set it up to auto login as well in my case, which might fix your issue, as mine seemed to get stuck on the login screen. Hope this helps.
  • Darius
    Darius over 4 years
    This should no longer be accepted solution. It's bricking too many OS's for people. including mine :)
  • petrosmm
    petrosmm about 4 years
    I finally have enough points to comment. I had luck with the following answer: askubuntu.com/questions/1085161/…
  • nospam2k
    nospam2k about 4 years
    I'm not sure this is actually breaking anything other then when connecting a monitor. I had the same problem and just powered off the machine was accessible remotely. I have the ability to power off the machine remotely so that could be why I was not stuck. But bottom line, I don't think it is a fair assessment that this breaks remote access, even with a monitor connected. It may be hanging trying to shutdown during reboot.
  • BirdOfPrey
    BirdOfPrey almost 4 years
    Tested with Ubuntu 20.04LTS and TeamViewer and its working fine! /etc/X11/xorg.conf path worked for me too.
  • Jeff Barnett
    Jeff Barnett over 3 years
    THis worked great for me but how do I get a regular screen back when I connect a monitor?
  • therealak12
    therealak12 over 3 years
    Did you linked this page in this page? Or I am wrong?
  • Jako
    Jako over 3 years
    Thanks, with this I was able to start a xfreerdp client open a rpd session at boot without user interaction (in order to start a X program at startup)
  • grrigore
    grrigore over 3 years
    Does this work on Ubuntu 20.04? In my case it didn' but I might miss something..
  • Heng Sengthai
    Heng Sengthai over 3 years
    This method will break some display and it will be blank or stuck with some logo. I solved this by turn off pc and turn on then pressed F1 until I see some menu, then select "Advanced options for ubuntu" then select "Ubuntu, with Linux *** (recovery mode)", then choose "root ", so you mini terminal exist in the bottom, then you can go to remove the file you create by "cd /usr/share/X11/xorg.conf.d" or "cd /etc/X11/", then "rm -rf xorg.conf", then "reboot". Booom!! Welcome back to your lovely display! XD
  • FantomX1
    FantomX1 about 3 years
    Did not work for me though due to could not parse ""1600x900_60.00"" message but maybe works, but causes graphics artifacts/glitches at the screen, had to remove it, askubuntu.com/questions/1231824/… some apps crashed or were transparent also
  • Sanket Sonavane
    Sanket Sonavane about 3 years
    I just installed the dummy driver and created an empty xorg.conf file /usr/share/X11/xorg.conf.d/xorg.conf that works as a solution. when i have a monitor connected it displays on monitor, but when i boot it without a monitor i can ssh from another machine. did this for ubuntu 19.04 running on my intel nuc. works flawless.
  • Sanket Sonavane
    Sanket Sonavane about 3 years
    earlier i had edited the xorg.conf with above details and i could see loading till ubuntu progress bar and post that nothing but i was able to ssh into my machine. so i edited the xorg.conf at that time and deleted all its content and saved it. glad it worked.
  • Ramon Poca
    Ramon Poca about 3 years
    Generate a xrandr line with cvt. e.g. cvt 1920 1080 gave me Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync. Also beware of the $ at the end.
  • Rohit Parte
    Rohit Parte about 3 years
    This worked very well on Linux mint 19.04! Thanks!
  • Merve Sahin
    Merve Sahin about 3 years
    Unfortunately, this did not work on my Ubuntu 20.04. I get strange glitches and the extended display size is incorrect.
  • Mina Michael
    Mina Michael almost 3 years
    I think it's important to include information on how to undo this.
  • Montag
    Montag almost 3 years
    2021-08-11 - This worked perfectly for my raspberry pi 4. I can now boot gui without a monitor connected (or boot headlessly if we want to). I thought that it would be important to add this since others seem to be trying to find a way to do it with Raspberry Pi's. I put mine straight in /etc/X11/xorg.conf (had to make the file). For new coders, or people new to this ecosystem, you have to use sudo to make and work with files there. (sudo nano xorg.conf). Good Luck!
  • Dimetry
    Dimetry over 2 years
    Doesn't work for my Ubuntu 21.04
  • Mark
    Mark over 2 years
    @Terrance I also get the error No protocol specified Can't open display :0. I'm not using Wayland, but of course I'm connected via SSH. Is there a solution for this?
  • Mark
    Mark over 2 years
    @Terrance, I'm already connecting using -X or -Y and I've already enabled the X11Forwarding option. I bet the display is :0 because it's the only that returns No protocol specified, :1 returns only Can't open display. Anyway I'm using gdm3 in X11 mode (no Wayland)
  • Mark
    Mark over 2 years
    By the way, I'm not sure using X forwarding is useful here. I don't want to forward the X output on my local machine, just "force" X11 to produce an output even without a monitor, so a VNC connection can render the desktop and not just a blank screen.
  • Terrance
    Terrance over 2 years
    @Mark Deleted my last comment as I was having difficulty understanding what I wrote. Anyways, the command is giving you that because it is trying to run in the SSH session and not for the system itself. Add the command somewhere in startup on the server you are trying to VNC to so that it sets the fake display during its bootup.
  • Terrance
    Terrance over 2 years
    To all that come here to this answer, please DO NOT RUN this command from an SSH session as it tries to run it in the SSH and not on the system itself. If you VNC to the system, then you can run it in a terminal window in the VNC. It is best to add this command in the answer to your startup on the system that you are VNCing to.
  • PatrickReagan
    PatrickReagan over 2 years
    Doesn't work for my Ubuntu 20.04
  • jave.web
    jave.web about 2 years
    @JasonCapriotti what do you mean by "but * are $20"? That's expensive for this type of little thing. You can buy 3 resistors 75Ohm for under a $1 (for cents...)
  • Admin
    Admin almost 2 years
    You just saved me after hours of wall head-beating.