Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanted to change my desktop screen resolution to 1366x768. But my VESA drivers(AMD REDWOOD) did not detect that resolution. So I created a shell script as follows:-

xrandr --newmode "1368x768_60.00"   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync  
xrandr --addmode DVI-0 1368x768_60.00  
xrandr --output DisplayPort-0 --off --output DVI-0 --mode 1368x768_60.00 --pos 0x0 --rotate normal --output HDMI-0 --off

I saved it as in /usr/bin and made it executable. Then I added the following lines to /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf(which is the equivalent of the well known /etc/lightdm/lightdm.conf . I am using the above file as I am on 14.04 where there is no /etc/lightdm/lightdm.conf .) :-


and saved it. In theory this should have changed both the login screen resolution and desktop screen resolution to 1366x768 . But surprisingly this changed only the login screen resolution. The desktop resolution was not changed. Later I added the script to Startup applications and that changed my desktop resolution.

So I want to know why the edits I made to lightdm.conf file(or rather the 50-ubuntu.conf file) did not affect my desktop resolution. Is this some kind of bug that has to be reported at launchpad or is it wrong to say that edits in lightdm will affect desktop screen?

PS:- In my opinion this is not just specific to Ubuntu 14.04.

share|improve this question
up vote 10 down vote accepted

I tried a similar thing and after some debugging I think I figured out what's going on. Your script probably is run and probably does set the resolution correctly. However, since it is run by the login manager, it runs before Unity has finished setting up your desktop environment and Unity reads its own settings and resets the resolution to what you had. So, I think that what happens is:

  1. lightdm correctly runs your script
  2. This sets your desired resolution
  3. Unity launches, reads its settings and reverts to the default resolution you have there
  4. Your resolution goes back to what it was before

Now, this happens because the VESA driver does not detect your desired resolution automatically. This means that when you change the resolution from the Displays section of Unity's settings, you are giving it a resolution that is not available unless you run the xrandr commands. Therefore, this is ignored next time you restart and Unity reverts to the default resolution.

So, what you need to do is make the resolution available to Unity, then set it as default and let it handle it. To do so, you must first add this line to /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf:


Then, make sure that /usr/bin/ looks like this:

xrandr --newmode "1368x768_60.00"   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync  
xrandr --addmode DVI-0 1368x768_60.00  

Note that I am not actually setting the resolution, only making it available. Once you have done this restart, then log in. The new resolution should now be available in Settings => Displays. If so, choose it there, log out and log back in again and the resolution should be set correctly.It should now persist across reboots.

Alternative approaches:

  1. Create an /etc/X11/xorg.conf file that lists your desired resolution. Something like this:

    Section "Monitor"
        Identifier    "Monitor0"
        Modeline "1368x768_60.00"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync
    Section "Screen"
        Identifier     "Screen0"
        Device         "Card0"
        Monitor        "Monitor0"
        SubSection "Display"
            Modes       "1368x768_60.00"
    Section "Device"
        Identifier    "Card0"
        Driver        "vesa"
  2. Add the script that runs the xrandr commands to your session's startup applications.

share|improve this answer
Editing the files under /usr/share/lightdm/lightdm.conf.d/ is the wrong way of changing lightdm.conf. The LightDM project page says that system admins can override the default configuration in /etc/lightdm/lightdm.conf.d/ or /etc/lightdm/lightdm.conf You shouldn't edit files under /usr/share/lightdm/ because while it might work for a while it's liable to get overwritten by package updates Source: LightDM project page Please correct your answer – happyskeptic Sep 29 '14 at 9:43
I don't have enough reputation to add a simple comment, but I wanted to point out that the sh file needs to be given the permission to execute. The OP mentioned that he/she had done this, but terdon's answer did not include it in the steps. If it's not executable then you will have to drop down to a command prompt because it will not log in (at least it did not for me). It was a simple oversight on my part, but just in case anyone else overlooks that step I wanted to reiterate it here. – Kirk Spencer Apr 12 '15 at 23:57

protected by Community Oct 10 '15 at 4:36

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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