Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Excuse me if this has been answered already, but I couldn't find any questions quite matching my issue.

On the odd occasion, usually after incorrectly restarting my computer, my login screen resolution is not the default 1440x900, but I think 1600x900. Now, I have this monitor that's really bad at handling resolutions it's not designed to handle, and will show a silly "wrong resolution" box jumping around the screen.

Is there any way to make the login screen load a 1440x900 resolution no matter what? I'm running Ubuntu 11.10 with Unity and LightDM.

share|improve this question
add comment

7 Answers

up vote 21 down vote accepted

You can make a script for this (source LightDM Resolution).

  1. Firstly we need to find out what your monitors identifier is. Open up a terminal, start typing "terminal" in your unity dash to see the option or press ctrl+alt+t
  2. Type/copy this command to show your display details:

    xrandr -q
    

    If you only have one monitor you will see a line in the output like the following ( probably with some different values, its the identifier at the start we are after):

    DVI-0 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 473mm x 296mm
    

    The screen identifier is DVI-0 in this case

  3. Open up your favourite text editor, lets use gedit for this example, press alt+f2 and type "gedit"

  4. Type/copy this in:

    #!/bin/sh
    xrandr --output DVI-0 --primary --mode 1440x900
    

    Save this on your desktop as "lightdmxrandr.sh"

  5. You may want to test the script before we put it into practice. Back in the terminal navigate to where we just saved it:

    cd ~/Desktop
    

    Now we need to make it executable:

    chmod a+rx lightdmxrandr.sh
    

    Now run it:

    ./lightdmxrandr.sh
    

    (If your screen automatically auto-corrects after log in you probably won't see a difference so you may want to use a test resolution that is different but you know works while testing)

  6. Now lets move the little script we made:

    sudo mv ~/Desktop/lightdmxrandr.sh /usr/share/.
    

    If you don't use sudo you may get a permission error (I use this folder out of personal preference)

  7. We need to now run this in lightdm, navigate to the correct folder:

    cd /etc/lightdm
    
  8. Open up the lightdm conf file:

    sudo gedit lightdm.conf
    
  9. Now add the the instruction to run your script after the last line and save:

    display-setup-script=/usr/share/lightdmxrandr.sh
    

Now reboot and that should set the correct resolution on your lightdm log in screen.

(these instructions might look long but they don't take long at all)

share|improve this answer
1  
Thanks! I use Leon's script mentioned below. askubuntu.com/a/88882/28071 –  beanaroo Mar 2 '12 at 13:21
    
That's a nice script, think I'll store that for future use! –  captain_G Mar 2 '12 at 21:07
    
Unfortunately this just breaks things in Ubuntu 13.04. Probably because they have been making some massive changes to the OS. –  pthurmond Sep 23 '13 at 15:24
    
Also doesn't work with Ubuntu 13.10 + NVIDIA driver 319: The script is executed but the resolution doesn't change - probably because the NVIDIA driver overrides it. –  speakr Nov 5 '13 at 8:12
add comment

You can instead of creating script, just add to file /etc/lightdm/lightdm.conf a line like this:

display-setup-script=xrandr --output default --mode 1280x720

Before inserting make sure that command works, because with wrong command, lightdm will not start.

share|improve this answer
add comment

I found a very simple workaround that works perfectly for me running 13.04. (update: now 13.10) on a laptop with a 24" external screen that is not permanently connected.

I'll just copy from here

  1. log in
  2. use xrandr or the Displays control utility to configure your monitors how you'd like them to be configured in the login screen
  3. copy ~/.config/monitors.xml to /var/lib/lightdm/.config

Since I already had my monitors configured properly I just had to do step 3.

Some other answers given here worked for me but only in a specific scenario while running risk of an unusable system in other scenarios (LOW GRAPHICS MODE ERROR). For example with the external monitor permanently connected (accepted answer by @captain_G) or with always the same device connected to the output used for the external monitor (script by @Axlrod). It seems that @MarcoV's answer is the most generic solution, however it does still involve scripting rules.

share|improve this answer
1  
Much simpler than the other answers... I wonder why it doesn't have more votes. Well, it has mine. –  aap Oct 27 '13 at 14:28
    
Then again, although it does help the login screen, it would be nice if other users didn't have to set up the display resolution again. –  aap Oct 27 '13 at 18:41
    
Strangely, did not work for me (on Debian). What component would read the monitors.xml file? Some kind of settings daemon? –  Joachim Breitner Oct 28 '13 at 10:13
    
Joachim, I just found this workaround in the bug discussion that I linked to. There's not a lot of explanation given on why/how it works and I didn't put much research into it. I guess it's the unity-greeter daemon. Could it be that you are using a Nvidia card? @aap Yes, I was also surprised to find an easy workaround after having tried all the other solutions given here without satisfactory results. I didn't test with multiple users. –  Tobold Oct 28 '13 at 11:26
    
This worked awesomely and was super easy. Thanks! –  Omegamormegil Dec 22 '13 at 1:42
add comment

I use different displays connected to my HDMI ports (one on dock) and the laptop display. In order to resolve LightDM login resolution bug I've written a script beginning from what written in this topic. #

#!/bin/bash
XCOM01=`xrandr -q | grep 'HDMI1 connected'`
XCOM02=`xrandr -q | grep 'HDMI2 connected'`
XCOM1=`xrandr --output HDMI1 --primary --auto`
XCOM2=`xrandr --output HDMI2 --primary --auto`
XCOM3=`xrandr --output LVDS1 --primary --auto`
# if the external monitor HDMI1 is connected, then we tell XRANDR to set up use it for login
if [ -n "$XCOM01" ] || [ ! "$XCOM01" = "" ]; then echo $XCOM1
# if the external monitor HDMI2 is connected, then we tell XRANDR to set up use it for login
else if [ -n "$XCOM02" ] || [ ! "$XCOM02" = "" ]; then echo $XCOM2
# if both the external monitors are disconnected, then we tell XRANDR to output to the laptop screen
else echo $XCOM3
fi
fi
exit 0;

Now the resolution is correct in the different situations, but the greeter panel occupies a space on the top-left of the screen equal to the previous wrong resolution!! What can I do?

share|improve this answer
add comment

What I've found to be useful was a post on the Ubuntu guide website . I tried so many things in Ubuntu 11.10 and even tried to use simply GNOME Classic. The resolution was always 1024x768 and when I manually set it to 1440x900 it was "virtual", I mean I had to scroll with the mouse to explore the entire desktop that was beyond the real screen dimensions.

In the Terminal I ran this command:

sudo gedit /etc/default/grub

The text editor can take a while to load. Once it loaded, I edited the line

GRUB_GFXMODE=1024x768

and changed it to:

GRUB_GFXMODE=1440x900

After that I tried to reinstall VESA drivers (in this computer I have a GeForce 260 GTX). I know that the better way is to use Nvidia official drivers, but using them the problem was always the same... Sure, I think, now performance will be worse.

So, checking Nvidia X Server Settings panel I verified that my resolution was added and, switching to it, it made the screen in the right look. Actually I'm using Ubuntu 11.10 but in GNOME Classic.

I'm a newbie of Linux so hope I've written decent things.

share|improve this answer
add comment

For a multi monitor setup where you might disconnect your laptop and use without, here is a simple solution:

run:

xrandr

Get the devices you are using laptop is usually LVDS1, and for me I have a DP2 (displayport 2) it could be HDMI1 or anything else, just find the ones with resolutions listed next to them.

Create this small bash file:

#!/bin/bash

mode="$(xrandr -q|grep -A1 "DP2 connected"| tail -1 |awk '{ print $1 }')"
if [ -n "$mode" ]; then
  xrandr --output LVDS1 --off
  xrandr --output DP2 --primary --mode 2540x1440
fi

Replace LVDS1 with your laptop monitor connection.

Replace DP2 with your external monitor connection.

Place bash script in /usr/bin/local/

chmod +x the script

edit /etc/lightdm/lightdm.conf

Add

display-setup-script=/path/to/my/script

Reboot.

The resolution change will only happen when you are actually at that display now.

If you have multiple places with different monitors / resolutions on same connector you will have to put more intelligence in your bash script.

share|improve this answer
add comment

I've created this script to make it more dynamic (multiple workspaces / different monitors).

Only annoyance: when you log in from lightdm, the screen still flashes like it wants to change resolution :s

share|improve this answer
1  
Paste was not found. –  Tobold Aug 13 '13 at 8:13
    
Indeed; if you still have a local copy of the script please consider re-uploading it. –  WChargin Sep 25 '13 at 13:18
    
I've uploaded the script to github. I don't know why paste.ubuntu.com removed it :( –  Leon Dec 8 '13 at 20:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.