Disable Wayland Graphics on Ubuntu

I recently upgraded to Ubuntu 22.04 LTS system. Overall the upgrade went smooth, but there was one thing that was off. That was the monitor setup. The computer that I have has a HDMI and a VGA port on it for video output. I have two of the same monitor and created a script that allows me to override the system default resolution for the monitor that is connected to the VGA port. What I did to address the different screen resolutions was to have a script to run on startup that would set the resolution on the VGA output to the 1920x1080 resolution. It defaults to 1080x720 resolution.

After doing the upgrade to Ubuntu 22.04, the script no longer would work. When I manually would run the script, command by command, it would show the below output.

$ xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
X Error of failed request:  BadName (named color or font does not exist)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  16 (RRCreateMode)
  Serial number of failed request:  40
  Current serial number in output stream:  40

After hours of searching the output text from the command, I did not find anything that would help me resolve this issue. All of the articles that I was finding, was providing steps on how to resolve the issue with an Nvidia graphics card.

I went to the system properties to see what graphics card that my system had. On the About screen, it said that I had Mesa Intel(R) HD Graphics 2500 and that the Windowing System was Wayland. Meaning all of the steps that I was finding about the Nvidia graphics card, would not be of any use to me or computer.

After doing some more researchg about Wayland and Intel Graphics, I finally found the answer to the problem. It mentioned to edit the /etc/gdm3/custom.conf file.

sudo nano /etc/gdm3/custom.conf

Inside of this file, I had to uncomment the below line in the file.

WaylandEnable=false

By default, the line is commented out. When it is commented out, it is the same as the value as being set to true. Once you have done that, restart your system.

The script that I created below, is what I had before the OS upgrade that would run when the resolution change after doing some flickering.

#!/bin/bash

# steps were taken from https://askubuntu.com/questions/493165/ubuntu-14-04-unknown-display-nvidia-graphics
# and placed into a script

# https://www.reddit.com/r/Ubuntu/comments/pzm1et/comment/hynamso/

PATH=/usr/bin/:${PATH}
OLD_IFS=$IFS

# get the mode details from the system
# cvt 1920 1080

# configure the new mode based on the resolution size from previous step
xrandr --newmode "1920x1080"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

# Type xrandr -q to list your screen outputs

xrandr --addmode VGA-1 "1920x1080"
xrandr --output VGA-1 --mode "1920x1080"

Hopefully this helps anybody else that has encountered the same issue that I have after upgrading to Ubuntu 22.04 LTS.

Posted: 2022-10-18
Author: Kenny Robinson, @almostengr