Optimus on Ubuntu 18.04 is a step backwards ... but I found the first good solution

Edit: see here for the MathieuGras-TimRichardson solution:

I have two Optimus laptops, a Thinkpad P50 and a W520. I have just spent two hours testing 18.04 and it was a shocking experience.
prime sync is broken on both, despite a released fix.
EDIT: it works, but configuration is different, see below

But that’s nothing compared to the problems with prime-select.
This command line tool turns off or on the nvidia card.
On 17.10 and as far back as 16.04, it moves some libraries around, executes quickly and it works. You never ever end up with an unbootable machine. This is interesting to note, because not a single one of those things is true at the moment.

to change between intel-only and hybrid mode, it seems to install and uninstall packages, and it rebuilds the initramfs. This is very slow. But worse, if I leave it in intel mode and go to discrete graphics in the bios, the greeter doesn’t start, it just loops flashing the screen black and colorful very fast.

I have reported a new bug and suggested that the prime sync bug is not fixed. I have other strange situations: once I booted into discrete graphics, had my external monitors working, but had tearing on the laptop panel and nvidia settings said the nvidia driver was not loaded. How that is possible I have no idea. The tearing indicates that prime output is happening, but you’d think with discrete mode set in bios the intel card should be invisible, so I always thought. This is so weird I didn’t report a bug. Although perhaps that was just nouveau.

In 17.10 I permanently set prime-select intel and turn on discrete when back at my desk, which starts the machine in full nvidia mode (I don’t use hybrid graphics in nvidia mode because audio to my display port monitor doesn’t work).

That sure doesn’t work anymore. I thought I’d see if I can get to intel-only mode by blacklisting nvidia but that didn’t work: I have no external monitors, but judging by power consumption, the nvidia card was not turned off.

I think the cause of these problems is the multi-dispatch libglvnd innovation which sounded like it was going to make life better, allowing other distributions to reach the nice experience of Ubuntu. Sad to see that for Ubuntu, it is a disaster. I wonder why the 17.10 method was abandoned.

Is it time to look elsewhere? Bumblebee sounds wrong for me, since I want a Ubuntu 17.10-style multi-monitor experience where three monitors work as one desktop.

I’ve taken a glance at the 18.04 nvidia-prime package and I’m wondering how that should work. It looks like it was made to work with xserver 1.20 and its server-side glxvnd.
It shouldn’t install/uninstall any packages but it runs update-initramfs because it now blacklists the nvidia driver instead of just unloading it.

So I looked a bit deeper and the nvidia-driver packages have changed, split up. This really looks like they’re made for the 1.20 xserver’s glxvnd which isn’t released yet so as a workaround they’re installing/uninstalling the packages for now.

Is it possible to turn the nvidia card off by black listing nouveau and nvidia-drm? It can’t be that easy I suppose. It does the hard stuff well (optimus) but it makes a mess of what seems like the easy stuff: killing the nvidia card.

While it was formerly using bbswitch to turn off the nv gpu, it is now blacklisting nvidia so the nouveau driver can be loaded and trying to turn off the nv gpu using vgaswitcheroo. If that doesn’t work you would have to blacklist nouveau, install bbswitch and create a systemd service that loads it and uses it to turn off the gpu.

Description=Disable Nvidia GPU




modprobe -r nvidia
modprobe bbswitch
echo "OFF" >/proc/acpi/bbswitch
logger Nvidia OFF

And you are lucky… I can’t even boot my laptop with Nvidia privative drivers. I can with nouveau, but then I get about 7 FPS so it’s not really an option.

When Nvidia privative drivers work correctly, the performance is quite good, but overall, I had a far, far better experience using AMD.

prime sync works but there is a subtle change in configuration.

So apologies from me for that part of my flame.

You no longer specify the driver version

So previously you would have this in /etc/modprobe.d/zz-nvidia.conf

options nvidia_390_drm modeset=1

now it is

options nvidia_drm modeset=1

It’s been getting steadily better since 15.10, first prime sync came, then compositors other than the xfce one started working, then gdm3 started working, then ubuntu realised wayland was not ready and x lives on … but 18.04, well, 17.10 is support for three more months which should be time for 18.04.1 and presumably X 1.20…

Anyway, I was wrong about prime sync. It works if you change your config.

The reason for the new approach is something to do with logind not allowing the nvidia modules to be unloaded even if they are not actually used, or something like that:

"Also, prime-select is slow because I had to work around a change of behaviour in logind, which broke bbswitch. So, now I have to load nouveau just to disable the NVIDIA GPU. This is the bug report:


this is the root cause for it being slow. It seems that the only way to turn off the nvidia card means that the nvidia drivers are removed from initramfs which means if you boot the machine in discrete mode with reinstalling the nvidia drivers, it blows up. Obviously the developers never encounter this hardware in their daily life or maybe there is nothing that can be done until the systemd bug is fixed (systemd devs think it is fixed but reporters say it is not fixed).

That reason seems bogus to me. The logind locking nvidia-drm problem is well known, was also arising during playing around with the hdmi audio device. This is only present after stopping the xserver, not on reboot. Replacing a method that required a reboot due to logind with another method requiring an initrd rebuild and a reboot doesn’t make sense to me. I rather suspect the change was due to ubuntu folks wanting to get rid of bbswitch since it is an unmaintained OOT module in favor of some standard kernel method, which is nouveau and vgaswitcheroo. Still, the way they’re doing it now doesn’t look smart to me.

The logind bug report goes back a while, I did wonder why it was not a 17.10 issue.

Ugly bug reports and issues are starting to pile up in askubuntu etc, even for users of xubuntu which at least avoid the gdm issues (gdm still doesn’t start with modeset = 1)

I’ve played with 18.04 more today, it’s just a non starter for me (often literally). All I want is a way to turn off the nvidia card when I’m on battery, a way to use Nvidia at my desk with a fast switch , and never having a machine that doesn’t start the greeter. I even have the advantage of a partial mux (I can swap between hybrid and dedicated nvidia). Ubuntu 17.10 was the pinnacle of what Linux has to offer , I didn’t find anything has good as prime-select.

So now what? Windows (I didn’t walk away from macos for Windows) ,sell the laptop and get intel only, but I like my big Thinkpad, find some way of fixing 18.04 (unlikely). Which leaves: find another distribution which runs modern nvidia drivers and has a working prime-select without needing to install nouveau just to turn off the card. I guess people here know more about that than anyone else … open to ideas.

Is it possible to have a login option (a kernel) which has the nvidia driver, and one which doesn’t, so choosing a kernel from the grub boot menu would me choose whether I wanted intel or nvidia?

Reverting the module loading/gpu poweroff behaviour is not the problem but the new fs layout of the nvidia driver, switching glx/opengl. It doesn’t use the debian alternatives system anymore.

ok, well we’re all going to die. I think the old prime-select module was pretty neat like digital watches, but the rest of the world must not agree. Ubuntu has now made it horrible, timing their big changes for an LTS release, good one, and other distributions don’t seem to do it, focusing on Bumblebee which solves a different problem.
I’m getting close to buying a T480S and forgetting about nvidia but I’ll see how miserable this makes me over the next few months.

Didn’t you have a Fermi anyway?
distant laughter

The Fermi (if that’s what a 1000M Quadro is) is in my old W520, a $250 computer I bought to see what Linux would be like before ditching the Macs. It’s a great machine, a quadcore with an 8MB level 1 cache (for $250 in perfect working order). I was easily convinced.
Out of respect I put 24GB and an SSD in it. The keyboard …

But the main computer is a P50 with a maxwell quadro. With every iteration of ubuntu it’s been getting better. I’ve tweaked libinput for a great touchpad experience.

And then this iceberg comes along, to mix my metaphors.

@generix you use gentoo as daily driver?

18.04 LTS is due for release on Thursday coming. I believe caffe comes ready installed.

I shall see if I can get DIGITS to work with it

OK, well I have no idea what DIGITS is.[Google Search … ok, I think that’s off topic]

Linux Mint 18.3 has an even better prime-select option than ubuntu 17.10. You don’t need to restart the machine to change profiles, going either way. You can easily upgrade to x 1.19.5 (via the hwe update like ubuntu LTS) which means prime sync works, and it’s supported to 2021 so even if Mint feels that with Mint 19 it must follow ubuntu 18.04 and this wonderful new prime-select method, I can ignore it for a while. And I like cinnamon, so I guess this is what I will do.
EDIT: MInt 18.3 gets the gold medal for the best Optimus support (for my use case: multi-monitor at desk, good battery life when away from desk)
In hybrid mode, it changes both ways without needing a reboot (despite the revised message in the ubuntu prime-select tool warning a reboot is needed), it supports prime sync and it uses the ubuntu PPA for the latest nvidia drivers (maintained by the same team that I flamed in this thread), so it’s basically ubuntu 17.10 but better and supported until 2021. I couldn’t get arch or fedora working as conveniently as this.

Hi. I’m using Kubuntu 18.04 and am now unable to power down the Nvidia GPU when I switch to the Intel GPU (using sudo prime-select intel). I’ve read all the posts here but am still scratching my head wondering what the conclusion is. Is it still broken for now and waiting for an update? Is it broken permanently with no chance of a fix in the near future? Is there something users can manually do to power down the Nvidia GPU when in Intel GPU mode? Should I just go back to 17.10 (or even 16.04) for now?

I want to avoid using Linux Mint if possible, but if things are working on Mint (as per @TimRichardson’s post), I might give it a go.