How To Rotate The Screen in Ubuntu With The Nvidia Driver

May 30, 2010 by
Filed under: gnome, HowTo, linux, Ubuntu 

If you're using the proprietary Nvidia graphics driver in Ubuntu Linux, your system has the ability to rotate the video display. Why would you want to do this? Well, I have an HP w2207 wide screen monitor that can rotate into portrait mode. This can be handy for editing long documents or working with portrait images in the GIMP.

Enable Nvidia Screen Rotation

Now, for some reason, screen rotation is not enabled my default in Ubuntu's implementation of the Nvidia graphics drive, but that's easy enough to change. You just need to add one line to your xorg.conf file. First, we'll make a backup of the file.

cd /etc/X11
sudo cp xorg.conf xorg.conf.bak

Now we'll edit the file.
sudo gedit xorg.conf

Now find the Device section that includes the line:

	Driver	"nvidia"


Now add the line:

Affiliate Link
	Option	"RandRRotation"	"on"


This is what my device section looks like after the edit (your file may have more lines in it).

Section "Device"
	Identifier	"Default Device"
	Driver	"nvidia"
	Option	"NoLogo"	"True"
	Option	"RandRRotation"	"on"
EndSection


Now save the file, log out, and log back in (this is to restart the X server).

Rotate the screen with xrandr

Now that you have screen rotation enabled, you can rotate the screen with the xrandr command.
To rotate to the left, use:

xrandr -o left

To go back to normal, use:
xrandr -o normal

To rotate right:
xrandr -o right

Or to flip the screen upside down:
xrandr -o inverted

GUI Configuration Tools

There are also some handy tools for the GUI if you prefer. There is a GNOME panel applet (Display Geometry Switcher) that you can install.

sudo apt-get install gnome-randr-applet

There is also grandr.
sudo apt-get install grandr

This will add an item to the menu under System→Administration→Multiple Screens.

Comments

23 Responses to “How To Rotate The Screen in Ubuntu With The Nvidia Driver”

  1. mrG says:

    oops, I meant 12.04 -- also the gnome-randr-applet and grandr are no longer in the apt catalog

    • Linerd says:

      Thanks for the comments. I've pretty much given up on Unity. Too many things are broken and I can't get used to the interface. I'm now using Kubuntu 12.04 on my desktop and Mint 13 on my netbook.

  2. mrG says:

    As of Ubuntu 12.05, it seems the xrandr method is broken under Unity :( -- I can rotate the screen using the xorg.conf or by using the desktop screens admin utility, but xrandr -o right will turn the screen for a fraction of a second, and then it reverts to landscape. Anyone have any ideas what might be thwarting this approach?

  3. Ruvi says:

    Well it worked, and i am happy about it!
    though I couldn't find "driver "nvidia"" section there was only one section on my xorg.conf file, so i added it there it there and viola it worked. Thanx

  4. Ryan Sinn says:

    With modern xorg / nvidia the configuration actually needs to be:


    Option "RandRRotation" "true"

    "on" is invalid.

  5. mrG says:

    This worked in so far as it enables the rotation option on the screen menu, but attempting to set the orientation with grandr gives the error that the user set size is larger than the screen size.

    In a previous revision of Unity the screen config gave me the option to place an icon on the desktop to rotate the screen, but this options does not appear now and the gnome applet you mention here is no longer found in the 11.10 apt collection. Any idea where it went?

    • Linerd says:

      I'm still running 10.04 on my main machine. I've messed around with 11.10 a bit, but I haven't gotten into it too far. I didn't mess with 11.04. Sorry I can't help. I guess you can add it to the list of things that you can't do in Unity.

  6. Just after installing Ubuntu 11.10, I thought that the issue of screen rotation on nvidia drivers was solved but trying those drivers offered by Ubuntu, did not do the trick, Now that I discovered this workaround my Ubuntu 11.10 is now perfect for me. I have one of those weird HP Pavilion xt2110us Tablet PC Notebooks and Ubuntu worked like a charm. I just asigned the commands with the keyboard application and get all set.

    Thank you

    Good work. :-)

  7. The right/left and above/below are flipped respectively. above is now left.

    Works nice but I also have 2 monitors and would like one landscape and other horizontal.
    my 32" doubles as a ps3 monitor and I can't rotate that, or can I?

    Nice work! :-)

  8. v santhosh says:

    My mouse pointer works in a weird way. I have two monitors and rotated both of them but mouse behaves in a weird way. I have to bring the pointer below the first screen to get it to the second screen which is undesirable. I would want to move the monitor sideways.

  9. coakley says:

    How do I arrange set up so one screen is landscape and the other is horizontal? Right now it flips both.

    • anuj says:

      I also have 2 monitors and have been trying to get one landscape and other horizontal. Tried searching a lot in net to find a solution but couldnt. Does anybody have any idea how to do tht?

    • Matt says:

      I think that the only hope for doing this (at least with the current version of xorg) is to set them up as separate X screens, and even then I'm not sure how to do it/if it is possible. I've done quite a lot of looking around on this, and concluded that it is not possible to do when using twinview or Xinerama.

      It's frustrating, since windoze can do it no problem.

  10. Joe says:

    Bravo! Thank you! Works with Ubuntu 10.10

  11. gameroff says:

    thanks man...

  12. Johannes says:

    In my case it did work only when RandRRotation was in the "Screen" section of xorg.conf:

    Section "Screen"
    ...
    Option "RandRRotation" "True"
    ....

    More details here - somewhat complementary to your post:
    http://www.johannes-eva.net/ubuntu-linux-external-monitor-nvidia-rotate

  13. mlongval says:

    Thanks,

    Just what I needed to fix my system up.

  14. Ian says:

    tried this with success until i log out, upon login it is sideways as before, basically the setting do no stay for both methods, have a nvida gforce 8500 sand two monitors in portrait mode

    • Linerd says:

      You could add something to your session startup programs. Go to System->Preferences->Startup Applications. Click on Add. Give it whatever name you want. In the command field, just enter whichever command you use to set your portrait orientation, (for example, xrandr -o left), then click Save. Now log out and log back in. Your desktop should now be rotated in the proper orientation. If you're not set to auto login, the login screen will still be in its normal orientation rather than portrait. I don't know how to take care of that.

  15. Sean says:

    Worked nicely for me, after I noticed that there we 2 "Device" sections in my xorg.conf

  16. Aras says:

    Thanks!
    This helped me out a lot today.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>