On Saturday dinner time I decided to bump my Ubuntu 19.04 release to Ubuntu 20.04. What could go wrong?!
Well, here I am on a completely fresh installation. So it turns out: quite a lot.
I knew I was ballsed when the upgrade process failed in the terminal. I did an
apt-get update and it seemed to think I was already on 20.04. As soon as I rebooted, of course, the OS never came back up. Sad times.
Anyway, tons of other difficulties aside, the issues I hit upon when finally re-installed were not that new to me when it comes to Linux:
In particular, I had two.
Firstly, the mini-display port to display port cable just inexplicably died on me. This completely threw me as all of a sudden my main monitor – a Dell P2715Q – seemed to be working, but the screen was black. I knew something was amiss as when I turned on the screen, Ubuntu would make it my main display but of course, it was all dark so I couldn’t see the log in prompt, or stuff like that.
Long story short – after a full re-install – I realised the cable was at fault. Sad times, and more hours lost.
But that’s fixed now. All it took was a new display port to display port cable, which very fortunately, I had in the spare parts box.
Portrait Mode Problems
A new one on me for Ubuntu 20.04.
I have another 27″ Dell monitor, a U2713HMt, which isn’t 4k. And has therefore been relegated to my second monitor.
I’ve never had issues with this monitor. It is always detected as my primary during install, so I have to install with my head tilted 90 degrees… or just turn the monitor back round, but aside from that, it’s been really solid.
Incidentally, having a 27″ screen at 2560×1440 makes a really nice super big terminal window if you are a massive nerd like me, and spend a lot of time in such places.
Anyway, Ubuntu 20.04 did not like putting this monitor into Portrait Right.
The issues I hit were that it would allow me to specify the setting, but when applied, it would either revert, or kill the monitor entirely.
Fixing Ubuntu 20.04 Portrait Mode Problems
Unfortunately I have not found a fix for the “Screen Display” menu. It won’t take the setting directly.
However, there is a workaround that seems to be working about 95% of the time for me.
sudo apt install arandr
Firstly, I installed arandr. This is a GUI for the more cryptic XRandR. If you’re a whizz with XRandR you can likely do the next bit from there directly somehow. And likely you don’t need blog posts like this to get your PC working properly. Fair play to you.
For the rest of us…
When installed, run
arandr but run it as you, not sudo.
Make your monitor setup look how you want it. It’s intuitive enough. The cable names and types are labelled sufficiently that you should be able to figure out what is what.
The “Outputs” section is used to select the individual monitors and then modify them as needed. I just needed to make DVI-I-1 into Orientation “Left”.
Once done, choose “Save As…” and this give your file a name. I called mine
Oh, the wit.
The reason we didn’t run this as
sudo is because this file will, by default, be saved to your home directory, e.g.
You should be able to Apply this script now (from arandr) and your monitors should be correctly displaying.
However, this won’t last between reboots.
In order to persist between reboots, I used a “startup application” entry.
To get to this, hit the super key and type “Startup”, and then I entered the following:
Giving me this:
So far, it’s worked every time except once, when it didn’t. For which I have no reason.
But hey, that’s Ubuntu baby. If you want an easy life, blow 3 grand on a Mac.
Edit: Less than 24 hours later, I have found that when resuming from sleep, I need to re-run the script. Not ideal. To make this as easy as possible, I moved the shell script to my desktop, and updated the start up script location above to point to the new location. Now, I just double click the file on my desktop whenever I resume and the monitors are out of whack.
18 thoughts on “Ubuntu 20.04 Portrait Mode Monitor Problems”
Thanks, just what I needed!
This is ridiculous. What kind of testing does Canonical do before releasing an LTS desktop release?
It’s a ridiculous bug, but this is a great workaround.
In my case I have my AVR/TV connected to the PC, so each time I turn it on/off the monitor setup gets messed on my PC. I’ve created a keyboard shortcut to launch the xrandr script.
Thanks for the tip.
Nice, I like the idea of a keyboard shortcut.
I’m definitely still experiencing this as of today / right now, unfortunately.
Having a software solution is preferable to a previous issue I’ve had with Ubuntu and my main monitor not waking up. I was pulling out the power cable, and re-plugging back in. That worked, but it feels like one day it won’t / the monitor will go pop.
Glad I could help in some way, anyway.
I just gave up. I upgraded ubuntu 20.04 from 16.04. My second monitor just don’t work in vertical mode. I miss Unity… So I installed ubuntu-unity-desktop instead. Then everything is coming back… Once this rediculous bug is fixed, I’m open to change to the default gnome desktop. BTW, I just upgraded my cpu to I7 9700K, my GPU is Titan RTX. Ubuntu is the official OS for nvidia AI system, why often bugs there?
My GPU is ancient now – a GTX970. When I got it, I had issues with drivers on Linux as it was very new. Seemingly the older the card, the better the support.
That said, my main 4K monitor is now as old as the GPU (approx), and I *still* (even this morning) have issues with it when using Linux. It always works when I dual boot back to Windows for gaming. But on Linux, maybe 3 out of 10 times, it just won’t work without being physically unplugged and replugged in. And even then it’s hit and miss.
I honestly don’t know why there are so many bugs. But I still believe Linux is the best working environment for me. The only comparable alternative is Mac, but for that you need to buy their hardware and all their peripherals (mouse, keyboard, trackpad), which I don’t have the cash for, unfortunately.
In reply to your edit…. sleep is for the dead! 😉
I’ve tried to solve this issue by setting up the monitors in Nvidia Control Panel and save the X Configuration File, the result was crashing everything at login in the next reboot. So I needed to go to recovery mode and reinstall everything.
I have ubuntu 20.4 installed in my laptop with MX150 and I didnt experienced the issue, my PC runs with GTX 770.
I can get my monitor to work in portrait mode by lowering the resolution, it seems like it doesn’t change the resolution to 1080×1920 from 1920×1080 on my end. 1024×768 works, but 1280×720 does not.
Thanks for publishing your issue.
Unfortunately, this was not enough for me, because I have screens with different refresh rates.
Here’s how I resolved it, on a fresh Ubuntu 20.04.1 install, RTX 2080 and nvidia drivers 440.100.
My left screen is rotated left (@60 Hz) and my main screen is horizontal but @165 Hz.
So I had to solve the rotation issue AND different refresh rates.
– There was an error message when using nvidia-settings (sudo or not), when trying to save the config: “No package ‘xorg-server’ found”.
– The problem was the same as described here: https://bugs.launchpad.net/ubuntu/+source/nvidia-settings/+bug/1822937.
– Some packages (*-dev) were not installed, so as advised on previous link, I installed: pkg-config make xutils-dev libtool xserver-xorg-dev libx11-dev libxi-dev libxrandr-dev libxinerama-dev libudev-dev.
– sudo nvidia-settings was then OK, no more error messages, still no changes in Gnome, though.
– In nvidia-settings, I followed advice from here: https://www.reddit.com/r/Ubuntu/comments/bfnc4y/ubuntu_194_where_do_i_save_x_configuration_file/, meaning I checked “Force Full Composition Pipeline” option on each screen. This is also described here: https://wiki.archlinux.org/index.php/NVIDIA/Troubleshooting#Avoid_screen_tearing.
– I edited monitors.xml config file in /var/lib/gdm3/.config/ folder and adjusted according to my needs. I found some elements on this thread: https://askubuntu.com/questions/1230570/cant-rotate-monitor-on-20-04/1247763#1247763
With this technique, no need for a script, monitors layout is respected pre-login and post-login.
Things I have not tested or seen a difference:
– not tested: /var/lib/gdm3/.config/monitors.xml should apply system-wide, for all users.
– not tested: using only ~/.config/monitors.xml
– not seen a difference, since I changed multiple parameters at the same time (this is bad practice when troubleshooting): using ENVVARS in /etc/environment, as described here: https://www.reddit.com/r/Ubuntu/comments/cegacx/issues_with_dual_monitors_with_different_refresh/.
Things to take care of:
– Refresh rates in monitors.xml need to be respected, you cannot guess them and put a round number like 165
Awesome, thanks for sharing. I’m still having a bunch of issues with my monitors – the exact problem has changed in a recent update. I think all my screens are at 60hz though, so can’t be differing refresh rates.
Here is a very nice solution to this issue: remove “monitor.xml” file from “~/.config” folder and reconfigure your monitors again to circumvent anymore headache! this at least helps you to keep on with your tasks.
Hello friends, will You help me with a small issue? I’ve been using two monitors, one of them in vector orientation. This monitor is secondary and as main one is the horizontal monitor. Everything is OK during common using of Ubuntu, but after start of computer I see loggin offer turned to vertical orientation and on the secondary monitor. If I use both the monitors in horizontal orientation via Settings, the loggin offer will occurre on the right one, on the main…that’s completely right. I want to see the loggin offer in horizontal orientation and on monitor MAIN, so that means on monitor nr.1…Pitty, that I cannot aplly pictures…
“If you want an easy life, blow 3 grand on a Mac.”
We have very different definitions of easy…
I get so frustrated every time I try to use a Mac.
Other than that, this was helpful, even in Ubuntu 16.04. Thank you.
Thanks Mike, glad I could help.
I use Linux / OSX / Windows 10 in that order, almost daily. Admittedly windows only for gaming. Of all three, Windows has the best multi monitor support, hands down. It truly just works, even with my three monitor / portrait mode setup.
OSX works, but is quirky. It’s largely plug and play, but it seems to do alright with remembering where everything should be, even when unplugging everything and coming back a while later (it’s a laptop, after all).
Linux… no. I use a USB desktop switch and toggle between rigs multiple times a day. Every time I switch, I need to run this `triple.sh` script, as the portrait mode monitor never comes back. Also, Chrome crashes every single time. I suspect that’s somehow resolution related, but have never tracked it down, nor would I really know where to start.
But honestly, I wouldn’t go back. Ubuntu has been a fantastic desktop and server environment for me. Very happy I made the switch all those years ago.
I solved it by installing these packages on 20.04LTS
pkg-config make xutils-dev libtool xserver-xorg-dev libx11-dev libxi-dev libxrandr-dev libxinerama-dev libudev-dev
Once I installed those, the X.org file save option worked and fixed my configuration.
Be prepared for more fun as / when you update to 21.10 🙂