I've installed a new Ubuntu 22.04 server with Gnome on a VirtualBox system and the size of the screen is reset to 800x600 on each reboot (both in the login screen and once logged in).
I change the screen resolution to say 1920x1600 and that works great. I can use the system for days without an issue.
The next time I reboot, though, that larger resolution is lost. It will be reset back to the 800x600.
Am I doing something wrong?
Note 1: I can see that the ~/.config/monitors.xml
is there and properly defined:
<monitors version="2">
<configuration>
<logicalmonitor>
<x>0</x>
<y>0</y>
<scale>2</scale>
<primary>yes</primary>
<monitor>
<monitorspec>
<connector>Virtual-1</connector>
<vendor>unknown</vendor>
<product>unknown</product>
<serial>unknown</serial>
</monitorspec>
<mode>
<width>1920</width>
<height>1200</height>
<rate>59.884601593017578</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
</monitors>
Note 2: As mentioned in a few places, I can copy the monitors.xml
file to /var/lib/gdm3/.config/.
and the Login screen works as expected. But once logged in, that resolution is lost again.
sudo cp ~/.config/monitors.xml /var/lib/gdm3/.config/.
Note 3: I have other versions of Ubuntu (18.04, 20.04) with similar setups and the resolution sticks just fine.
Note 4: I have a single "monitor".
Updates:
When I run xrandr --verbose
, I see modes such as this one:
1920x1440 (0x53b) 233.500MHz -HSync +VSync *current +preferred
h: width 1920 start 2064 end 2264 total 2608 skew 0 clock 89.53KHz
v: height 1440 start 1443 end 1447 total 1493 clock 59.97Hz
I transformed that into a script like so:
xrandr --newmode "1920x1440_59.97" 233.50 1920 2064 2264 2608 1440 1443 1447 1493 -hsync +vsync
xrandr --addmode XWAYLAND0 1920x1440_59.97
xrandr --output XWAYLAND0 --mode 1920x1440_59.97
But the first and last xrandr
generate errors:
$ sh xrandr1.sh
X Error of failed request: BadName (named color or font does not exist)
Major opcode of failed request: 139 (RANDR)
Minor opcode of failed request: 16 (RRCreateMode)
Serial number of failed request: 20
Current serial number in output stream: 20
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 139 (RANDR)
Minor opcode of failed request: 7 (RRSetScreenSize)
Serial number of failed request: 22
Current serial number in output stream: 23
Now I've seen some people having issues with XWAYLAND0
. Maybe that's what I'm running into...
Some logs found in the /var/log/syslog file:
Sep 15 23:31:47 ubuntu22 colord[2535]: failed to get edid data: EDID length is too small
Sep 15 23:31:47 ubuntu22 dbus-daemon[1214]: [system] Successfully activated service 'org.freedesktop.ColorManager'
Sep 15 23:31:47 ubuntu22 systemd[1]: Started Manage, Install and Generate Color Profiles.
Sep 15 23:31:47 ubuntu22 xbrlapi.desktop[2550]: openConnection: connect: No such file or directory
Sep 15 23:31:47 ubuntu22 xbrlapi.desktop[2550]: cannot connect to braille devices daemon brltty at :0
Sep 15 23:31:47 ubuntu22 /usr/libexec/gdm-wayland-session[2196]: dbus-daemon[2196]: [session uid=130 pid=2196] Successfully activated service 'org.gnome.ScreenSaver'
Sep 15 23:31:48 ubuntu22 gsd-color[2356]: failed to get edid: unable to get EDID for output
Sep 15 23:31:48 ubuntu22 gsd-color[2356]: unable to get EDID for xrandr-Virtual-1: unable to get EDID for output
Sep 17 01:10:40 ubuntu22 gnome-shell[2665]: XWAYLAND: mode 1024x600 is not available
Sep 17 01:16:20 ubuntu22 gnome-shell[2665]: message repeated 2 times: [ XWAYLAND: mode 1024x600 is not available]
The last one seems to indicate that by default the system expects a display named Virtual-1. Unfortunately, my display seems to be named XWAYLAND0 instead.
In that regard, I also found these:
Sep 16 02:36:12 ubuntu22 gnome-shell[2303]: Registering session with GDM
Sep 16 02:36:12 ubuntu22 gnome-shell[1764]: Connection to xwayland lost
Sep 16 02:36:12 ubuntu22 gnome-session[1742]: gnome-session-binary[1742]: WARNING: Lost name on bus: org.gnome.SessionManager
Sep 16 02:36:12 ubuntu22 gnome-session-binary[1742]: WARNING: Lost name on bus: org.gnome.SessionManager
For that one, I can find a bug on launchpad.
I tried to turn off wayland but that did not help...
[daemon]
# Uncomment the line below to force the login screen to use Xorg
WaylandEnable=false
...in that the screen still comes up with the wrong resolution on a reboot. However, the xrandr
command now works. If you'd like to make it work with Wayland, you may be able to use the gnome-randr.py script. Note that I did a reboot after changing the WaylandEnable=false
(I think it goes without saying).
In the "not elegant but works" category of fixes -
I faced this too with a VM that was a clone of a netbook with an odd screen size. I couldn't get the VM to retain the screen size setting. So I wrote a script to resize the screen and added the script to the startup items.
In my case the script was
Your values will likely differ.