25

I rotated my screen, and once I login, it works fine. But, the greeter (login) screen hasn't got the message that things are rotated 90 degrees. How can I change the rotation of the login screen?

enter image description here

UPDATE: lock screen is in correct position. I only see this when I boot, or log out.

2
  • None of the earlier answers here seems to be valid for 16.04... (Tried switching between Noveau or Nvidia 361). I can see the 'arandr' set it right, but it is just the second later reset back to the "standard".
    – Hannu
    Aug 15, 2016 at 16:00
  • 1
    @Hannu Please see my comment below under askubuntu.com/questions/408302/….
    – jbrock
    Aug 22, 2016 at 2:11

8 Answers 8

22
+50

Add this line to the /etc/lightdm/lightdm.conf file (in the [SeatDefaults] section):

greeter-setup-script=/etc/lightdm/greeter_setup.sh

Then make the file /etc/lightdm/greeter_setup.sh with the following contents:

#!/bin/bash
xrandr -o left
exit 0

Then make it executable with sudo chmod +x /etc/lightdm/greeter_setup.sh. Then reboot.

2
  • 4
    Changed to xrandr -o right. worked perfect.
    – j0h
    Jan 24, 2014 at 23:00
  • Adding the above mentioned script (without explicit exit 0) to /etc/lightdm/pre-greeter.d did the trick for me. Jun 15, 2018 at 12:14
21

Another option that should work is to copy ~/.config/monitors.xml to /var/lib/lightdm/.config .

This certainly works for my monitor position and resolution information, so I would assume it would work for rotation too.

Edit: For maximum flexibility, one could make a symbolic link between the above:

sudo su
cd /var/lib/lightdm/.config
ln -s /home/<your_user>/.config/monitors.xml .
chown -h lightdm:lightdm monitors.xml
exit

This way, if your monitor setup changes in the future, it will automatically reflected to the login screen. Notice the necessary -h flag on the chown command, as explained in chown is not changing symbolic link.

4
  • I will look into it, This is the sort of method I was trying to figure out.
    – j0h
    Jan 24, 2014 at 22:59
  • 1
    Making the link didn't work for me, I did the permission thing as described but it still told me that the permissions were wrong. Copying the file worked fine.
    – LovesTha
    Jun 17, 2015 at 22:15
  • 3
    One important note: symlink here won't work if your home directory is encrypted, as that file won't be accessible until after you login.
    – alienth
    Nov 28, 2016 at 6:02
  • 1
    On a fresh install of Ubuntu 20.04, one needs to copy ~/.config/monitors.xml to /var/lib/gdm3/ instead of /var/lib/lightdm/.config/. Jun 5, 2020 at 15:14
12

14.04 and above

Falconer's answer helped me very much, but lightdm changed for Ubuntu Trusty 14.04. There is no longer a /etc/lightdm/lightdm.conf file on my system. lightdm has now gone the "Debian way" and had its configuration broken up into a conf.d directory. You now need to create the following file:

/etc/lightdm/lightdm.conf.d/80-display-setup.conf

[SeatDefaults]
display-setup-script=xrandr -o right

As suggested in Electric Head's answer, the xrandr command can go right in this file, no need to create a separate script.

If you want a xrandr command that deals with multiple monitors, you can use arandr to generate it for you. My xrandr command actually ends up being:

xrandr --output DVI-1 --mode 1920x1080 --pos 1080x0 --rotate left --output DVI-0 --mode 1920x1080 --pos 0x0 --rotate right

To get that I used the following commands:

  • sudo apt-get install arandr
  • arandr
  • Use the GUI to configure your monitors like you want them:

    arandr
  • Use "Layout" -> "Save As" to save it to a file that contains your monitor configuration command.

With this in place, my monitors are properly rotated when I log in as well, so there is no need to do additional configuration in Gnome, XFCE, or KDE. The only other place that I need to configure monitor rotation is in virtual framebuffer terminals, as explained in How do I rotate my display when not using an X Server?

1
  • FWIW, My clean 32-bit 14.04 install has no /etc/lightdm/lightdm.conf.d/ directory and creating one then following the rest of the instructions here didn't work. The instructions in Electric Head's answer did work, though. I'm not sure why one worked and not the other, but just wanted to leave this comment for posterity's sake in case someone else encounters the same situation as I had.
    – reirab
    Jan 12, 2015 at 22:53
8

falconer pretty much nailed it but I'd like to point out a simplification.

You can put an xrandr command directly in /etc/lightdm/lightdm.conf as a system hook. You don't need to create a shell command to call a separate script containing a shell command (though of course you can if you see a reason to do so). Also, there's no mention of /etc/lightdm/lightdm.conf.d/ in man lightdm and I didn't have either this or lightdm.conf on my system. So, although I'm sure it probably does work as suggested by Stephen, again, you don't need to do this.

So, if it doesn't exist already, something along the lines of the following in /etc/lightdm/lightdm.conf (sudo, obviously) should work just fine:

[SeatDefaults]
display-setup-script=xrandr --output DVI-1 --auto --rotate left

See man xrandr for configuration options.

BTW: I could probably have got away with comments/edits here but I don't have the rep and I did want to add the sources for this information.

Version

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:   trusty

References

3
  • In 16.04 I needed to first create the file named lightdm.conf. Then it worked. Thanks for this.
    – jbrock
    Aug 22, 2016 at 0:14
  • I also used [Seat:*] instead of [SeatDefaults]. wiki.ubuntu.com/LightDM
    – jbrock
    Aug 22, 2016 at 2:21
  • I've got it working now, with the above and adding; I had monitors.xml SOFT-LINKED into my normal user's monitors.xml - this was the culprit; as I COPIED the file in place instead, it began working. In my opinion this setting should be selectable in "System Settings > Display"
    – Hannu
    Aug 27, 2016 at 9:43
3

16.04

The only fix that works for me is to copy ~/.config/monitors.xml to /var/lib/lightdm/.config/, similar to the method in Steve Dee's answer, but with a copy of the file rather than just a symlink to it. Making a symbolic link doesn't work.

Neither falconer's nor Stephen Ostermiller's answer worked for me. I just saw the correctly rotated screen for 2 seconds after boot, then it rotated back to horizontal orientation.

2
  • I edited the answer. The purpose was to make it easy for users of 16.04 to find a solution. Jan 30, 2017 at 14:08
  • 1
    This is the only one that worked for me as well! Ostermiller's answer gave me a permissions error, even when the file in my home was read to all.
    – Alex
    Dec 3, 2017 at 16:58
1

I had the same issue with the incorrect greeter screen in Ubuntu 18.04 on a vertical monitor. I tried some of the mentioned xrandr commands as indicated in other replies, but these did not work for me. I then followed the reply which advised to copy the ~/.config/monitors.xml file to the /var/lib/gdm3/.config directory. After rebooting the greeter screen still had the incorrect orientation. My next step was to look to the contents of the /var/lib/gdm3/.config/monitors.xml file. I noticed that it contained a history of various monitors and configurations which I have used over the years. I edited this file to only contain the setup of the current configuration.

The structure of the monitors.xml file is that it contains one set of <monitors> and </monitors> tags, at the beginning and end of the file. In between these tags are one or more set(s) of <configuration> and </configuration> tags. Each of these sections contain one or more set(s) of <logicalmonitor> and </logicalmonitor> tags. Each of these sections specify one monitor, with parameters such as brand and type, orientation (if not horizontal), width, height, x, y and refresh rate. It also specifies if a monitor is the primary monitor. In my file was the current setup listed near the bottom of the file. I removed all <configuration> </configuration> sections which did not describe my current setup. The result looks like this:

<monitors version="2">
  <configuration>
    <logicalmonitor>
      .. primary monitor specification (vertical)
      <primary>yes</primary>
      <transform>
        <rotation>left</rotation>
        <flipped>no</flipped>
      </transform>
    </logicalmonitor>
    <logicalmonitor>
      .. secondary monitor specification (horizontal)
    </logicalmonitor>
  </configuration>
</monitors>

Now I rebooted my computer. This time the screener window did have the correct orientation. I guess that the history as captured in the original monitors.xml file was causing issues.

1
  • Copying ~/.config/monitors.xml to /var/lib/gdm3/ applies the user settings to the login screen. Jun 5, 2020 at 15:12
0

Have you tried xrandr -o value? As a value use either left or right

Also you can create a custom shortcut by following this HOW TO

0

Same question and my results in 18.10:

falconer's answer is good. Let me add 2 details that I had to figure out in 18.10:

  • Instead of [SeatDefaults] current versions expect [Seat:*]
  • More importantly: I had to experiment a little with the above script using logger and then xmessage to conclude, that it does get called, it does set things right, but then its effect is unfortunately undone by unity-greeter.

I tried other greeters, and they all honor the solution and start up nicely rotated, except the default unity-greeter. I ended up using slick-greeter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .