Android
android
All
all
Windows
windows
Web
web
Linux
linux
Others
others

How to Fix Ugly Ubuntu Login Resolution Issues in Multi-Monitor Setups

| Comments

If you install Ubuntu in a multi-monitor environment, earlier, you had to face a lot of issues. But now Ubuntu have fixed most of those issues. But one major issues still persists! If you try to login to an Ubuntu machine which have multiple monitors, the Uubntu Greeter (Login Screen) will have a smaller resolution that doesn’t fit the monitor. Sometimes it will be stretched or crushed. In simple terms, it will look a lot ugly! Is there a fix for this? Yes!

Fixed Ubuntu Login in a Multi-Monitor Setup Fixed Ubuntu Login in a Multi-Monitor Setup

Currently I have a 19 inch and a 23 inch monitor. If I install Ubuntu in my machine, both the monitors will get stretched in the login screen. They won’t get the correct resolutions and will look like hell. This bug haunts many people. Many dual monitor setups won’t get correct resolutions in the login screen. Actually, it won’t give you the correct resolution even in the desktop. But we can fix it simply by changing display settings. But…

How to fix the Ubuntu login screen resolution?

  • First, open the terminal and run Xrandr and get the ids of the connected monitors :
1
xrandr
  •  You will get an output like this :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
pubudu@pc1:~$ xrandr
Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 32767 x 32767
VGA1 connected 1366x768+1920+0 (normal left inverted right x axis y axis) 410mm x 230mm
   1366x768       59.8*+
   1024x768       75.1     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        72.8     75.0     66.7     60.0  
   720x400        70.1  
HDMI1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 287mm
   1920x1080      60.0*+   50.0  
   1680x1050      59.9  
   1600x900       60.0  
   1280x1024      75.0     60.0  
   1440x900       59.9  
   1280x800       59.9  
   1152x864       75.0  
   1280x720       50.0     60.0  
   1024x768       75.1     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   720x576        50.0  
   720x480        59.9  
   640x480        72.8     75.0     66.7     60.0  
   720x400        70.1  
HDMI2 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
  • Check the marked lines in the above output (line number 3 and 10). At the start of those lines, you can find the ID of the attached monitors. (In front of attached monitors you will see “connected”). For me, the IDs of my two monitors are VGA1 and HDMI1. Note them down and also note down the current resolution (in front of the ID and the word “connected”)

  • Next, you have to create a script. Open the terminal and enter  the following command to create the script file :

1
sudo gedit /usr/share/lightdmxrandr.sh
  •  Then paste the following code in the file :
1
2
#!/bin/sh
xrandr --output HDMI1 --primary --mode 1920x1080 --output VGA1 --mode 1366x768 --right-of HDMI1
  • Replace “HDMI1” and “VGA1” with the IDs of your own monitor IDs. Also replace the resolution with your own values. If  you have more monitors, add another part to the end of the second line like “–output VGA2 –mode 1366x768 –right-of VGA1”. Change the VGA1, VGA2 and the resolutions accordingly.

  • Now, make the file executable with the following command :

1
sudo chmod a+rx /usr/share/lightdmxrandr.sh
  •  After that, open the lightdm.conf :
1
sudo gedit /etc/lightdm/lightdm.conf
  • And add the following line to the end of the file which will make sure that the system will run our script in the login screen :
1
display-setup-script=/usr/share/lightdmxrandr.sh
  • Finally, reboot your system!

Got it fixed? Working perfectly? Great! Now, before thanking me, thank sudo-juice.com for coming up with a solution. In the script he used, he only fixed the resolution of the primary monitor. This will work for some but for people like me, it won’t. I  had to fix the second monitor as well. The script I have given here can be used for any number of monitors! Hope it fixed your issues. If not, please leave a comment and let us know. We will try our best to fix it!

Comments