20

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.

  • 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 '16 at 16:00
  • 1
    @Hannu Please see my comment below under askubuntu.com/questions/408302/…. – jbrock Aug 22 '16 at 2:11
19
+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.

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

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.

  • I will look into it, This is the sort of method I was trying to figure out. – j0h Jan 24 '14 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 '15 at 22:15
  • 2
    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 '16 at 6:02
11

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?

  • 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 '15 at 22:53
7

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

  • In 16.04 I needed to first create the file named lightdm.conf. Then it worked. Thanks for this. – jbrock Aug 22 '16 at 0:14
  • I also used [Seat:*] instead of [SeatDefaults]. wiki.ubuntu.com/LightDM – jbrock Aug 22 '16 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 '16 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.

  • I edited the answer. The purpose was to make it easy for users of 16.04 to find a solution. – ondrejandrej Jan 30 '17 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 '17 at 16:58
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.

protected by Community Dec 16 '14 at 14: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.