Hi all,
EDIT 2:
Despite all the documentation saying that ‘rotate_all’ is a thing, it doesn’t seem to work for me, but ‘rotate’ does. I suppose this could change at some point though.
The good news is that from my limited understanding of unix, rotate seems to be doing what I expected rotate_all would be required to achieve. That is to say, setting just rotate and not rotate_all, seems to result in all local consoles being rotated anyway (i.e. alt + f1, alt + f2, etc are all rotated the same).
EDIT - SOLUTION
See here also for dev side of things: Enable framebuffer console rotation · Issue #1342 · clearlinux/distribution · GitHub
Kernel requirements:
In Clear Linux these requirements should be met in the 'lts' and 'native' kernels from 5.3.6-849 onwards. If you want to check though, read on.
The kernel must be compiled with at least this:
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
And may also require these (and possible others) to support the framebuffer rotation capability:
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
You can find your current kernel version using:
uname -a | cut -d" " -f3
Then search the kernel build source for the above statements, the source is located here at the time of writing:
/usr/lib/kernel/config-<YOUR-KERNEL-VERSION}>
The above smashed into a quick one liner so you can check:
kver=$(uname -a | cut -d" " -f3) && sudo grep -i framebuffer /usr/lib/kernel/config-$kver
Assuming your kernel is good to go, there are two main options, the time/duration for which you want to apply the rotation, and which of the local consoles you want to influence.
Console Options:
You can choose to rotate just the active local (i.e. not X-Window) console, or else all local consoles with 'rotate' and 'rotate_all' respectively.
Read more here:
https://github.com/spotify/linux/blob/master/Documentation/fb/fbcon.txt
Or, here:
https://www.kernel.org/doc/Documentation/fb/fbcon.txt
Time/Duration Options:
Here's some commands so you can immediately try rotating the console in your current session.
Within a session until the end of the session (Temporary):
Default (landscape)
sudo bash -c "echo -e '0' > /sys/class/graphics/fbcon/rotate"; sudo bash -c "echo -e '0' > /sys/class/graphics/fbcon/rotate_all"
90 degrees clockwise (i.e. right, portrait):
sudo bash -c "echo -e '1' > /sys/class/graphics/fbcon/rotate"
and/or
sudo bash -c "echo -e '1' > /sys/class/graphics/fbcon/rotate_all"
180 degree inversion (i.e. upside down, inverted landscape):
sudo bash -c "echo -e '2' > /sys/class/graphics/fbcon/rotate"
and/or
sudo bash -c "echo -e '2' > /sys/class/graphics/fbcon/rotate_all"
90 degrees counter clockwise (i.e. left, portrait):
sudo bash -c "echo -e '3' > /sys/class/graphics/fbcon/rotate"
and/or
sudo bash -c "echo -e '3' > /sys/class/graphics/fbcon/rotate_all"
From boot for an entire session until it ends (unless overriden with one of the above) (Temporary):
Use space bar to bring up the systemd boot manager on start up. Once it is open, select the kernel you wish to boot and press 'e' to edit the command line options for the session. Append one of the choices below to your kernel parameters.
Default (landscape)
(append nothing, unless you wish to override a change that was made using the automatically parsed kernel boot parameters with clr-boot-manager; in which case append one or more of the options below)
fbcon=rotate:0
and/or
fbcon=rotate_all:0
90 degrees clockwise (i.e. right, portrait):
fbcon=rotate:1
and/or
fbcon=rotate_all:1
180 degree inversion (i.e. upside down, inverted landscape):
fbcon=rotate:2
and/or
fbcon=rotate_all:2
90 degrees counter clockwise (i.e. left, portrait):
fbcon=rotate:3
and/or
fbcon=rotate_all:3
For all future sessions from boot up (Permanent):
This relies on using the Clear Linux boot loader. Some quick and dirty steps are below, alternatively read (with your head presumably on a weird angle) the output of man clr-boot-manager. Once in the man page, type the following line to quickly get to the relevant section:
/CONFIGURATION
My quick guide:
If you haven't already created the relevant directory for the Clear linux boot manager to parse for kernel parameters, you will need to do that first and change to the directory:
sudo mkdir /etc/kernel/cmdline.d
Create a file named whatever you think is approriate and edit away with your favourite text editor, just make sure the file ends with '.conf'.
Alternatively, use the line below and just modify the number to match your rotate requirements:
0 - normal orientation (0 degree)
1 - clockwise orientation (90 degrees)
2 - upside down orientation (180 degrees)
3 - counterclockwise orientation (270 degrees)
sudo touch /etc/kernel/cmdline.d/fbcon-rotation.conf && sudo bash -c "echo -e 'fbcon=rotate:3' > /etc/kernel/cmdline.d/fbcon-rotation.conf" && sudo clr-boot-manager update
Overrides:
Short term, use one of the session based methods outlines earlier.
Longer term, but without losing your cmdline.d/*.conf commands, either edit the relevant files and comment out the line with #, or use the following:
/etc/kernel/cmdline-removal.d/*.conf
A set of files that will be used to modify the kernel commandline by removing string matches from the final consoli‐
dated commandline (removal happens after the content from cmdline and cmdline.d/*.conf files are added). The matches
are made on a per line basis so multiple different removals should be placed on their own line or file.
This is my first time working on a native (tty?) rather than virtual CLI (vty?). The machine is connected to a portrait monitor and I’m unable to work out how to rotate the CLI output to match.
Reading around on other Linux distros suggest the answer lies in setting fbcon’s rotate_all value to 3. I tried to do this via sysctl -w, but was unable to find the value. I also tried a bit of a brute force approach using:
sudo bash -c ‘echo 3 > /sys/class/graphics/fbcon/rotate_all’
This appears to work without error, but has no effect.
I’m guessing this fbcon variable needs to be assigned in a kernel boot parameter, but I’m unsure how to achieve that in Clear, can anyone help?
Thanks