I'm pretty new to Ubuntu but I am currently trying to use a server version to display an application for a stripped down kiosk. I've got Ubuntu booting up into the application I want at startup, however I've run into one issue. I need to change the display orientation from Landscape to Portrait.

So far I haven't had much success and I've searched through the google a bunch without anything working for me. I thought I'd ask here. From my understanding I should be using the xrandr command.

What I've tried so far is:

xrandr which tells me that it Can't open disaply

xrandr -d :0 which gives me the following output

xrandr: Output HDMI1 is not disconnected but has no modes
xrandr: Output HDMI1 is not disconnected but has no modes
xrandr: Output VIRTUAL1 is not disconnected but has no modes
Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 32767 x 32767
VGA1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 490mm x 320mm 1680x1050 59.9**
HDMI1 connected (normal left inverted right x axis y axis)
HDMI2 connected (normal left inverted right x axis y axis) 
VIRTUAL1 connected (normal left inverted right x axis y axis) 

From that I figure I should do something like:

xrandr --output VGA1 --rotate left

However, that responds with Can't open display.

I've tried a few other things but I'm really at a loss here. Any help would be greatly appreciated.


  • Which desktop environment/window manager are you using (if any?) – Wilf Sep 7 '15 at 22:46

You probably need to specify the display to modify/use, using -d again (or --screen?):

xrandr --output VGA1 --rotate normal -d :0

Note that this needs to be done with the display focused on the screen, otherwise it may throw a error like xrandr: Configure crtc 0 failed (e.g. when doing the commands from a TTY) - to fix this the display needs to be focused when the command is run, so for instance with a TTY you could use this command and switch back to the GUI quickly:

sleep 5; xrandr --output VGA1 --rotate normal -d :0

Also, desktop environments often include display settings, you may be able to do this from there.

| improve this answer | |
  • Thank you so much Wilf! You are awesome. I've added this to the script that starts up my application and now it does it automatically! Thanks again! – Mark Sep 8 '15 at 16:38
  • Hey Wilf, I'm hoping you have another quick answer for me. I've switched from using VGA to HDMI. Now whenever I use xrandr -d :0 it just tells me "Can't Open Display" no mater what I put after it. Any ideas? Thanks again! – Mark Oct 27 '15 at 21:51
  • It may be under a different display number (e.g. 1 - probably depends on graphic cards and stuff) - you should be able to see this by running echo $DISPLAY, or looking at the output of the w command – Wilf Oct 28 '15 at 8:48
  • 1
    echo $DISPLAY gave me a blank response and with w I'm not sure what I'm looking for. I was about to go through different display numbers by trial and error (I think I had tried that before without success) and for no apparent reason xrandr -d :0 output properly this time. Thanks for the replies! You're the best. I wonder how long this will work for... – Mark Oct 28 '15 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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