Edit: my first answer (kept at the end for posterity) isn't great, so I ended up with the following instead.
Disabling the phantom display in X
I encountered a this issue on a MacBook Pro 5,3 running Ubuntu 20.04, but without the flickering cursor. Running echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
caused my system to freeze for some reason, so I had to find another fix. The one I landed on was to disable the "phantom" display in the X configuration.
First, work out the identifier of the phantom display with xrandr
:
$ xrandr --listmonitors
This should show two displays, one of which is the phantom one. In my case it showed LVDS-1
and LVDS-1-2
. I guessed that LVDS-1-2
was phantom because LVDS-1
had a *
next to it, but I'm not sure if that's the right way to tell. In any case, verify your guess by turning it off with xrandr
:
$ xrandr --output LVDS-1-2 --off
If that works, you can then make it permanent in the X configuration. Create a new file in /usr/share/X11/xorg.conf.d/
:
$ sudoedit /usr/share/X11/xorg.conf.d/01-disable-phantom-screen.conf
...and put the following in it, replacing LVDS-1-2
with the ID of your phantom screen:
Section "Monitor"
Identifier "LVDS-1-2"
Option "Ignore" "true"
EndSection
After this, though, I still had the problem on the login screen (GDM), and in fact it was worse because GDM was showing its UI on the phantom screen. To fix this, force GDM to use X by editing /etc/gdm3/custom.conf
to remove the #
from #WaylandEnable=false
. (If you happen to be using Ubuntu's OEM install mode, there'll also be a /etc/gdm3/custom.conf.oem
file. You'll want to change that, too, so that the fix persists once the end user completes the setup wizard.)
Old answer: disable Nouveau
Like I said above, this answer isn't great (turns out disabling your graphics driver is rather bad for performance), but I've kept it here in case it helps someone.
I disabled vgaswitcheroo
entirely. To do this, add nouveau.modeset=0
to the GRUB_CMDLINE_LINUX_DEFAULT
line in /etc/default/grub
. For example, mine looks like this afterwards:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nouveau.modeset=0"
Then run sudo update-grub
and reboot.
The HybridGraphics page in the community documentation has more details that helped me work this out.