I have turned my monitor physically in portrait position. I adjusted Settings -> Displays so that the layout for my desktop is okay, but the login screen is still landscape.
I read that this problem could be fixed with following instructions:
sudo cp ~/.config/monitors.xml /var/lib/gdm3/.config/
sudo chown gdm:gdm /var/lib/gdm3/.config/monitors.xml
sudo systemctl restart gdm3
But to no avail, it just does not work. No matter if I reboot or even completely turn off and back on computer. The login screen remains in landscape position.
However gdm displays proper login screen when returning from suspend. This is of course logical since it is not providing multi-user login. Lock screen works as well.
I had my doubts for the monitors.xml solution, since there were no existing monitors.xml file in /var/lib/gdm3/.config/ directory. I even looked into gdm source code and there is no references to monitors.xml at all. So how should restarting could change login screen position according to monitors.xml from user desktop settings.
This is a displaymanager problem which is run by gdm, not a desktop manager problem which has user configuration in ~/.config/monitors.xml. Copying that file into /var/lib/gdm3/.config/ (or anywhere else for that matter) is doomed to fail, I bet it has never worked. The code in gdm is intrested in login screen only for things like user selection, password, fingerprint and id card, not basic geometric transformations like rotate, flip and scale that you find in desktop manager user settings, ~/.config/monitors.xml.
So what now? I guess I have to accept that login screen in gdm-land is carved into stone as landscape position , just like BIOS does.