Thursday, January 14, 2021

Ubuntu 18.04 - Headless Black Screen Fix (VNC or Teamviewer)

I found that when running Ubuntu 18.04 headless, I was presented with a black screen.  This occurred with VNV and Teamviewer.  

Untested Solution - One post stated that you could simply add a VGA adapter/dongle to the video output and it would "trick" the device into thinking a monitor was installed and start up the video/GUI.  I opted for the solution below and it worked beautifully.


Tried, Tested & Validated Solution (at least on my device)

Install Video Dummy Package

  1. SSH into the system
    1. If you didn't get sshd setup already, then hook up a monitor and get it setup. Could just do the fix while connected direct or remote using CLI.
  2. Install xserver-xorg-video-dummy
    sudo apt-get install xserver-xorg-video-dummy
    


Create Default X Windows Configuration File

  1. Create / Edit xorg.conf file
    1. Rename the file if already exists for backup 
      • Note:  I did not have this file and thus just created it.

  1. sudo vi /usr/share/X11/xorg.conf.d/xorg.conf
    
  2. Add the following content to the file
    1. Set the resolution to what you like (whatever resolution the screen is that is used to connect remotely is probably is a good idea)
      • I found the resolution 1920x1080 to be adequate...but that's just me.
    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
    
  3. Save the file