45

I have a widescreen monitor that rotates. I'm trying to use it in 'landscape' mode (vertical). This is easy in the GUI.

How do I rotate my display when I am not running an X Server or when I am viewing a Virtual Console / Terminal.

Kurtis
  • 593

2 Answers2

84

You can rotate your virtual framebuffers using fbcon. 0 through 3 to represent the various rotations:

  • 0 - Normal rotation
  • 1 - Rotate clockwise
  • 2 - Rotate upside down
  • 3 - Rotate counter-clockwise

These can be set from the command line by putting a value into the correct system file. Rotate the current framebuffer:

echo 1 | sudo tee /sys/class/graphics/fbcon/rotate

Rotate all virtual framebuffers:

echo 1 | sudo tee /sys/class/graphics/fbcon/rotate_all

If you want this to happen automatically when you start your system, you need to modify your boot loader configuration to give it the correct options. In /etc/default/grub add fbcon=rotate:1 to the GRUB_CMDLINE_LINUX line:

GRUB_CMDLINE_LINUX="fbcon=rotate:1"

(Don't forget to run sudo update-grub after changing this file.)

Sources: Rotate Screen, not running X windows, Rotate console on startup (Debian)

  • 2
    Relies on CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y – Ciro Santilli OurBigBook.com May 05 '18 at 10:38
  • Confirmed this work in virtualbox linux client too!! – John Siu Jul 18 '19 at 16:34
  • Does not work in NVIDIA Jetson Nano supplied Ubuntu. /sys/class/graphics/fbcon/rotate content will not change. rotate_all makes access denied even as root. – Tõnu Samuel Oct 03 '19 at 04:27
  • It isn't a real file and it doesn't have contents. You can't read that "file". You can only write to it. Have you tried the command exactly with copy and paste? – Stephen Ostermiller Oct 03 '19 at 10:35
  • Works for me in Debian 9 on an Intel IGP. What a joy to have a "portrait mode" full HD console :-) – frr Dec 11 '19 at 08:39
  • For those interested, I own a Lenovo Yoga, which when busy in command line mode i use "upside down" from tty, with tmux. The answer worked wonders. For those who change modes frequently, one can add an alias in the ./bashrc file: I added, based on this answer:

    alias rotate_default='echo 0 | sudo tee /sys/class/graphics/fbcon/rotate'

    and

    alias rotate_upsidedown='echo 2 | sudo tee /sys/class/graphics/fbcon/rotate'

    – Nopey Apr 05 '20 at 03:15
  • Works for using me Ubuntu 20 on RasPi 3. – schilli Jan 28 '21 at 17:19
  • What about two monitors setup? My main monitor is in rotation 0, the other one I would like to have in rotation 3, but only one fb0 is in graphics... – piotao Sep 09 '22 at 21:55
-10

You can only rotate your display with some kind of X server. A virtual console as well as framebuffer has no support for rotating.

But maybe you can run some small X window manager like awesome and a terminal in full-screen mode. In this case you would get the rotation feature and it still feels like a console.

qbi
  • 19,125