81

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?

1

9 Answers 9

97

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"
    # Default is 4MiB, this sets it to 16MiB
    VideoRam    16384
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 your X session by logging out.

26
  • 3
    Please edit the answer, the package is being updated. Try sudo apt-cache search video-dummy.
    – cctan
    Commented Aug 12, 2015 at 9:56
  • 2
    Creating the file /usr/share/X11/xorg.conf.d/xorg.conf with this content, or the one from xpra.org/xorg.conf, my Ubuntu does not boot anymore (it gets stuck with the Ubuntu logo screen before the login screen). What can be the problem? Commented Aug 23, 2016 at 21:40
  • 3
    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 ? Commented Jan 19, 2018 at 12:22
  • 22
    Also broke my os. Did not boot. Its remote and now I need to get in a car and drive 1hr. Risky stuff :-)
    – Derek
    Commented Apr 7, 2018 at 17:49
  • 12
    This should no longer be accepted solution. It's bricking too many OS's for people. including mine :)
    – Darius
    Commented Dec 30, 2019 at 10:38
27

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
11
  • Cool, it's work!
    – burtsevyg
    Commented Sep 26, 2016 at 10:02
  • 8
    For me it say's: Can't open display
    – ar2015
    Commented Jun 2, 2017 at 7:05
  • 7
    @ar2015 Run the command as xrandr --fb 1280x1024 -display :0
    – Terrance
    Commented Oct 29, 2017 at 23:45
  • 1
    @Terrance I am getting No protocol specified Can't open display :0
    – Rufus
    Commented Jan 22, 2019 at 6:57
  • 2
    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.
    – Terrance
    Commented Oct 25, 2021 at 14:54
22

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 &

Probably relevant

4
  • 2
    Thanks, this helped me to run chrome on Debian without display.
    – DedaDev
    Commented Nov 2, 2019 at 12:37
  • 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)
    – Jako
    Commented Sep 25, 2020 at 6:16
  • You just saved me after hours of wall head-beating. Commented Jun 27, 2022 at 8:06
  • This is great for GPU benchmarking. I have been spending hours finding a way to unlock the FPS limit in X11 in order to get my actual GPU performance, but no luck. But your solution is what I'm looking for
    – Hzz
    Commented May 10 at 8:56
17

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.

4
  • 1
    Sounds like an interesting idea. I'll give it a shot. Commented Apr 27, 2014 at 19:10
  • 3
    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. Commented Feb 22, 2017 at 21:19
  • 1
    @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...)
    – jave.web
    Commented Mar 2, 2022 at 4:23
  • 1
    Thanks for recommending this. I bought a €5 dummy adapter from Amazon even though the accepted answer works for me and I can successfully connect via TeamViewer to my device. However, this solution prevents physical displays from working, and I'm worried some day my network might get messed up and prevent access to the device. Thus your solution is a great option for me.
    – Thijmen
    Commented Oct 24, 2022 at 11:47
6

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

3
  • Tested with Ubuntu 20.04LTS and TeamViewer and its working fine! /etc/X11/xorg.conf path worked for me too. Commented Aug 16, 2020 at 20:38
  • 2
    THis worked great for me but how do I get a regular screen back when I connect a monitor? Commented Sep 15, 2020 at 2:06
  • 11
    Did you linked this page in this page? Or I am wrong? Commented Sep 15, 2020 at 9:46
5

I'm on Ubuntu 18.04, this is how I solved it:

I've created the virtual display using the answer to this question: https://unix.stackexchange.com/questions/378373/add-virtual-output-to-xorg

Create a 20-intel.conf file:

sudo vi /usr/share/X11/xorg.conf.d/20-intel.conf

Add the following configuration information into the file:

Section "Device"
    Identifier "intelgpu0"
    Driver "intel"
    Option "VirtualHeads" "2"
EndSection

This tells the Intel GPU to create 2 virtual displays. You can change the number of VirtualHeads to your needs.

Then I made a shell script (don't forget to set executable) and put that in Startup Applications:

#! /bin/bash

/usr/bin/xrandr -d :0 --output VIRTUAL1 --primary --auto
/usr/bin/xrandr --newmode "1600x900_60.00" 118.25 1600 1696 1856 2112 900$
/usr/bin/xrandr --addmode VIRTUAL1 "1600x900_60.00"
/usr/bin/xrandr

That way, VIRTUAL1 is set as output and connected. At boot, a new mode (found using "cvt 1600 900") is being created and appointed to VIRTUAL1.

Only issue with this is: dock is missing at reboot... Haven't solved that yet.

3
  • 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
    – FantomX1
    Commented Feb 22, 2021 at 12:12
  • 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.
    – Ramon Poca
    Commented Apr 15, 2021 at 15:46
  • Unfortunately, this did not work on my Ubuntu 20.04. I get strange glitches and the extended display size is incorrect. Commented May 11, 2021 at 14:18
1

John Chapman's answer didn't work for me. I can suggest this link for a fixed dummy display with 1024x768 24bit. I can successfully connect to my pc without any display attached. My system is Ubuntu 16.04. You should install VESA video driver.

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

Code is in your /usr/share/X11/xorg.conf.d/xorg.conf file or /etc/X11/xorg.conf file

Section "Device"
Identifier    "Configured Video Device"
Driver        "vesa"
EndSection

Section "Monitor"
    Identifier    "Configured Monitor"
    HorizSync 42.0 - 52.0 
    VertRefresh 55.0 - 65.0 
    Modeline "1024x768" 60.80  1024 1056 1128 1272   768  768  770  796
    Modeline "800x600" 38.21 800 832 976 1008 600 612 618 631
    Modeline "640x480" 24.11 640 672 760 792 480 490 495 50
EndSection

Section "Screen"
    Identifier    "Default Screen"
    Monitor        "Configured Monitor"
    Device        "Configured Video Device"
    DefaultDepth    24
    Subsection "Display"
        Depth       24
        Modes       "1024x768" "800x600" "640x480"
       EndSubsection
EndSection
1

This works as an additional monitor/display once there is an existing one

# I think I may have spoken too soon. I was able to create a "virtual" display by adding a new mode to one of the disconnected displays listed in xrandr using

xrandr --addmode VIRTUAL1 1024x768
# I then simply enabled the display like you would normally:

xrandr --output VIRTUAL1 --mode 1024x768 --left-of HDMI3
# Furthermore, combined with x11vnc -clip, I am able to use this to convert my android tablet to a second monitor.  The perfomrance is pretty crappy at the moment, unfortunately, but that's whole other area to be explored.

https://bbs.archlinux.org/viewtopic.php?pid=1410831#p1410831

0

Got it working

Just install the dummy driver

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

dont edit the xorg.conf file I however just created an empty file here

/usr/share/X11/xorg.conf.d/xorg.conf

now when you have a monitor hooked in it will work as earlier but if you boot it without a monitor that should work too and you should be able to ssh into your machine.

hope it works for you too.

tested on ubuntu 19.04 and intel nuc.

4
  • Doesn't work for my Ubuntu 21.04
    – Dimetry
    Commented Aug 22, 2021 at 4:04
  • Doesn't work for my Ubuntu 20.04 Commented Jan 12, 2022 at 20:41
  • Doesn't work for my Ubuntu 22.04 Commented Jul 29, 2022 at 16:41
  • Instead of saying "Doesn't work for my XXXX", I'd rather like to ask what the 2022 way of emulating a display on ubuntu is. I'm running ubuntu inside docker, there's got to be a way to do this! Commented Dec 5, 2022 at 22:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .