I'm using a CLI only interface with the pi zero W, and wanted to use an older monitor, which doesn't have the ability to rotate the screen itself. Since it's command line only the "$DISPLAY" variable is empty, so setting display_rotate= {0,1,2,3} in /boot/config.txt does nothing.

I was wondering if there are alternatives to this, or if I'm better off using windows WLS to go headless

2 Answers 2


Did you try
put it in config.txt

  • Somewhat simpler :/
    – goldilocks
    Jan 16, 2022 at 20:33

Although I haven't tried it, this should work, since CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y is in the default kernel config, at least for the 64-bit 5.10.52 I checked.1 Another clue would be the existence of /sys/class/graphics/fbcon/rotate and rotate_all, which is how the rotation can be changed -- eg. from sudo bash (because sudo does not apply to a normal redirect)

echo 1 > /sys/class/graphics/fbcon/rotate_all 

Should do a quarter clockwise rotation (valid values are 0, 1, 2, 3). The difference between rotate and rotate_all is that each virtual console (there are 6 accessible by default) has its own framebuffer, and the former only rotates the current one (which should be fine, but if you want to automate this at boot you should have it apply to all).

  1. To do that, from a writable directory:

     sudo modprobe configs
     cp /proc/config.gz .
     gunzip config.gz
     grep FRAMEBUFFER_CONSOLE config

    You should get something like:

  • This works on my raspberry pi 2 (not zero), with the official touch screen
    – Philippe
    Apr 2, 2023 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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