• Marconius

    First of all, Thanks! Helped a lot.

    Second, should your shell script actually read:
    #!/bin/sh
    xrandr -output DVI-0 -primary -mode 1680×1050
    ?

    Third, do you think that Ubuntu should work towards automating this process for users that don’t feel comfortable using the terminal and writing shell scripts?

    Using multiple screens is pretty common and I’m pretty sure that I haven’t seen a desktop screen that uses resolutions under the 1024×800 (what was set as the max res for my VGA output) in the past four years at least. Maybe it’s just an issue with some screens not communicating properly with Ubuntu? eg: my screen shows up as “unknown” in the displays settings dialog.

  • Gareth

    Thanks for pointing that out Marconius, I’ve edited the post. Having that script on one line would have just commented out the xrandr command!

    I think its a difficult one for Ubuntu, because the log in screen is like a different application in itself (LightDM), but if they decide to incorporate it we might end up with a Unity dashboard situation – which I wasn’t too impressed with.

    Did you prefer the log in screens on previous versions? (GDM)

  • Marconius

    I think I am a little confused. Is lightdm only for generating the login screen? I was talking about the “displays” preferences not automatically offering the right resolution settings for my screen.

    I like the login screen in Oneiric. I especially like the really fat asterisks.

  • Gareth

    Techincally LightDM is a display manager, but the only *visible* part you see is the log in screen.

    I know what you are saying about the display preferences though, they are quite poor. Have you downloaded the proprietary drivers for your graphics card? (ATI Catalyst or Nvidia equivalent)

    Though in my experience these can go one of 2 ways, really well and you get increased graphics performance, or really bad and you end up spending a day trying to completely remove it and the junk it leaves behind!

    Trying to change the standard colour settings is an even harder task, I don’t think Ubuntu supports it at all at the moment! (anybody correct me if I’m wrong!)

    It can only get better though!

  • Sebastian Mitterle

    Hey! Thanks for this tutorial. I acutally use ARandR to generate the display setup script. It’s in the repositories.

  • Evan Rosenlieb

    Hello there!

    Thank you for the tutorial. I am brand new to linux and just spent a couple hours just getting My computer to be running at 1280×768 (which is obviously a little bit of a non-standard resolution, but hey I inherited it from my Grandpa so what are you going to do)

    I am trying to use this method so that the change will be made default. I have already tried restarting and it does not restart with the correct resolution.

    When I try to do step 6 of the tutorial and actually run the file, however, I get the error message: ¨cannot find mode 1280×768¨

    I know that there is indeed a 1280×768 mode, as I just created it and am indeed using as I write this message. Any Ideas about why this is happening?

    • Anonymous

      Creating modes using “-newmode” or “-addmode” is not a permanent change, if I remember commands you have used here need to be placed in your /etc/profile file. I haven’t tested this yet but let me know if putting the code in /etc/profile doesn’t work and I’ll try look into it further.

      Hope you’re enjoying your linux experience!

  • Daniel Doyle

    Hello there,

    I tried this in Ubuntu 12.04. It worked, however lightdm did not stretch to the full screen resolution, only the purple dotted background did… Any ideas?

    Cheers

    • Hi Daniel,

      I’ve managed to recreate this issue. Seems a bit weird, personally I think its a bug with LightDM not resizing the background (as the dots are overlayed) – I used a script with a dual monitor set up that also reacted a bit odd, it would move the log in box to the screen with the cursor and switch the backgrounds around.

      I’ll keep digging, though I’m guessing it will be fixed by the release of 12.04 because its a bit sloppy in my opinion!!

    • Grestus

      Hi,
      try something like this:
      xrandr -output LVDS -auto -output VGA-0 -auto -right-of LVDS -output HDMI-0 -auto -right-of LVDS

      So far I tested this with no external monitor and with monitor connected to VGA, and in both cases effect was correct. I hope it will also work with monitor connected to HDMI.

      • Grestus

        one more note:
        I’ve just checked that if you use -left-of instead of -right-of then all lightdm elements will be put on external monitor, which in my case is main then I use it.

    • mixer_gr

      this happened because you have the second monitor that is smaller
      i disable smaller monitor with the -off key during log in process

      something like:
      xrandr -output HDMI2 -primary -mode 1920×1080 -output LVDS1 -off

  • 222

    warning: output DVI-0 not found; ignoring
    ? ? what is that?

    • It sounds like you don’t have a DVI connection. Did you try the “xrandr -q” command to check your connections?

  • Kostas Lagogianis

    Thank you very much for a simple and nice guide that works! Thumbs up!

  • Ian Campbell

    Awesome, using this guide I was finally able to get VMware to resize the logon screen to match the resolution of the monitor. Thanks for the great work.

  • Pavel Nichkov

    Hi,
    I use Ubuntu 12.04, Supra 32″ TV as a display.
    The script works fine, however it does not run from within the /etc/lightdm/lightdm.conf
    Anyway, thanks a lot!

    • gnecht

      It doesn’t work in my lightdm.conf either. (Instead of Ubuntu, I have Debian 7.1.0 PowerPC on an iBook G3/466 SE Firewire/Clamshell.) What could I be missing that would prevent the script from running?

      • gnecht

        Found my answer. The display-setup-script command needs to be in the [SeatDefaults] section in the lightdm.conf file. After moving it there, it works.

  • Carl Vancil

    I did a variant on this formula, for a VMWare ESXi hosted VM running Ubuntu 12.04:

    xrandr -output default -primary -mode 1024×768

    This works!

  • Carsten Corleis

    Thank you very much! This fixed it for me! I have a older 1680×1050 monitor and the Login-screen came always up in 1980×1080, so the left side with the login-box was “cut off” and not visible and i had to type my password “blindfolded” all the time. Now it works!

  • jma

    Yay, fixed! LDM used the wrong refresh rate which kept shifting the picture off to the left. Added ‘-refresh 60’ to xrandr’s args.

  • Starhockey

    I did this, and it smushed my login box, background and top bar to the top left of the screen when logging in.
    The “lightdm dots” however cover my whole screen, and my mouse can go everywhere.

    Once i log in, its fine though…

    Thoughts?

  • gravothermal

    If the resolution you set in the script is not one of the ones listed in xrandr -q, then next time you restart your system will fail to boot. Learned this the hard way. So *do not skip* the testing phase prior to reboot!

  • Spatial Models

    I’ve written this script:

    #!/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, but the greeter covers only partially the screen. If I open and close the laptop screen everything become perfect.. very strange!

  • kachan64

    Do I have to do this all the time when each time a VGA cable is connected to different screen sizes?

    • Probably so. shouldn’t be too much of an issue as I think in most cases you wouldn’t be using a different monitor every time you boot up. The problem we are trying to fix here is LightDM not auto resizing the log in screen – this fix is setting hardcoded resolutions.

  • Pingback: How To Fix Ugly Ubuntu Login Resolution Issues in Multi-Monitor Setups()

  • ActionParsnip

    You don’t need the ‘.sh’ extension, this isn’t windows

    • haha incredibly fair comment!

      • ActionParsnip

        also, gksudo for GUI apps, not sudo.

  • Dan

    ****WARNING**** for people like myself who aren’t Linux guru’s

    I tried this as described above to lower the login screen res which was defaulting to 4k on my new UHD screen and which was too small, I tested the new resolution switcher script as described in this article and it worked just fine so I proceeded to set it up to be used a boot time .

    However, after moving the script and creating the appropriate call to it as described above I was greeted by a black screen where the login screen would normally appear. Not good for someone who is unfamiliar with what to do to recover this situation.

    The above technique really should come with warnings so that new users or people who are not overly tech savvy don’t end up in a situation they struggle to recover from.. thankfully I have several PC’s so was able to use another PC to google for a solution.

    • Brian

      Didn’t work for me either. Running Lubuntu 14.04 on old XP machine. Now I can’t get into lubuntu to edit out or remove the advised changes

  • Pingback: How To Fix Ugly Ubuntu Login Resolution Issues in Multi-Monitor Setups – Tech Hamlet()

  • Newbie

    This works for me, but as soon as I log out in order to log in with another user, it stops working. The login screen goes back to another resolution that I do not desire. That is, it works when I switch on my computer, but it doesn’t work the second time I try to log in. Besides, I am using Ubuntu 14.04, so the file I edit is /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf. Does anybody know which file I have to edit and what do I have to type? Sorry for my English.

  • Ciryon Galador

    Part 3 and 4 has made my Graphical interface crash on reboot, I had to edit back lightdm.conf to suppress the line then reboot…after reboot, the login screen was on correct resolution so the tuto is half correct, half screwed for me.

  • Mariano Álvarez

    this works just fine, dont say it’s wrong just because you dont know how to apply

  • Gaetano G

    Not workin in Xubuntu 16.04.1