Skip to content

Instantly share code, notes, and snippets.

@Koasing
Last active October 24, 2017 07:19
Show Gist options
  • Save Koasing/6a8ba3b996beba9533afe34284983ca5 to your computer and use it in GitHub Desktop.
Save Koasing/6a8ba3b996beba9533afe34284983ca5 to your computer and use it in GitHub Desktop.
Change preferred screen resolution of Lubuntu on VMware

Change preferred screen resolution of Lubuntu on VMware

Symptom

On some Display Manager events (login, screen-lock, etc) screen resolution changes to 800x600 forcefully, even though user setting is different.

LightDM's display-setup-script or .config/autostart methods does not fix this problem. These methods changes resolution after specified events by executing xrandr command, but other events (escpecially screen-lock) reset resolution to 800x600 and annoy me.

I experienced this symptom on Lubuntu 17.04 and 17.10, both installed on VMware WS 12. I think other ubuntu and its derivatives may have similar symptom.

Reason

The symptom occurs because Lubuntu preferrs 800x600 screen resolution on VMware WS/Player.

$ xrandr -q
Screen 0: minimum 1 x 1, current 1920 x 1200, maximum 16384 x 16384
Virtual1 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   800x600       60.00 +  60.32  
...
   1920x1200     59.88*
...
   640x480       59.94  
Virtual2 disconnected (normal left inverted right x axis y axis)
...

The plus sign + after screen resolution (800x600@60.00 in this example) is preferred resolution sign. Because 800x600 is preferred, LightDM changes screen resolution to it when some events are occured.

Solution

The following process changes preferred resolution to 1920x1200. Do with root priviledge. (use sudo)

  1. Create X11 config file

Because you may be already running X server, append :2 to specify new session number.

# Xorg :2 -configure
...
Your xorg.conf file is /root/xorg.conf.new

To test the server, run 'X -config /root/xorg.conf.new'
  1. Edit X11 config file

Open created file with your preferred text editor (nano or vi), and remove all sections except Section "Monitor", Section "Device" and Section "Screen".

Then specify Option "PreferredMode" "1920x1200" into Section "Monitor". You may change 1920x1200 to your preferred one. The result should look like:

Section "Monitor"
	Identifier   "Monitor0"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
	Option       "Primary" "true"
	Option       "PreferredMode" "1920x1200"
EndSection

Section "Device"
	...blahblah...
EndSection

Section "Screen"
	...blahblah...
EndSection

(I also appended Option "Primary", which forces that the monitor is primary display.)

  1. Move to correct location

By default, Lubuntu does not create xorg.conf.d directory. Create it then copy the conf file.

# mkdir /etc/X11/xorg.conf.d
# cp xorg.conf.new /etc/X11/xorg.conf.d/10-monitor.conf
  1. Reboot and the symptom should be fixed.
$ xrandr -q
Screen 0: minimum 1 x 1, current 1920 x 1200, maximum 16384 x 16384
Virtual1 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1920x1200     59.88*+
   800x600       60.00 +  60.32  
...
   640x480       59.94  
Virtual2 disconnected (normal left inverted right x axis y axis)
...

Problem

If Lubuntu does not show proper graphic environment after reboot;

  1. Press Ctrl+Alt+F1 to change to console environment
  2. Login with your ID/PW
  3. Delete /etc/X11/xorg.conf.d/10-monitor.conf
  4. Reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment