openSUSE / SUSEPrime

Provide nvidia-prime like package for openSUSE
64 stars 11 forks source link

nvidia fails to turn off, module in use #11

Closed mzame closed 4 years ago

mzame commented 5 years ago

I haven't been able to willing to use opensuse because of this error:

modprobe: FATAL: Module nvidia is in use. Failed to power off NVIDIA card Driver configured: intel2

simopil commented 5 years ago

Try to do this (root for all) 1) go into runlevel 3 (systemctl isolate multi-user.target) 2) unload nvidia module (rmmod nvidia-uvm nvidia-drm nvidia-modeset nvidia) Is nvidia module correctly unloaded? Can you post your SUSEPrime log? (prime-select log-view)

timrichardson commented 5 years ago

The readme suggests that the nvidia module should not be built into the boot kernel, so that is loaded on demand. This makes it easier to remove it, but I am pretty sure this approach doesn't allow KMS (ie modeset=1). Optimus users need to use modeset=1 to avoid horrible tearing.

In principle, could the oneshot script run before the display manager starts be the place to unload all nvidia modules and then bbswitch the card off?

timrichardson commented 5 years ago

EDIT. sorry,. new tumbleweed user. I assumed the tumbleweed package would be up to date, but it is is apparently v0.5 (https://software.opensuse.org/package/suse-prime) which seems very, very old. I'll try latest release before making any more comments.

simopil commented 5 years ago

modeset works correctly for me when nvidia module is loaded after boot

sndirsch commented 5 years ago

modeset works correctly for me when nvidia module is loaded after boot Yeah. modeset should work fine, unless you specify 'nomodeset' in boot options, which indeed many use for disabling nouveau driver ...

sndirsch commented 5 years ago

EDIT. sorry,. new tumbleweed user. I assumed the tumbleweed package would be up to date, but it is is apparently v0.5 (https://software.opensuse.org/package/suse-prime) which seems very, very old. I'll try latest release before making any more comments. At the time I tried 0.6.x release it didn't work for me at all. Therefore i switched back to 0.5 - even for TW. You can find a suse-prime-beta package in X11:XOrg project though with 0.6.11 though. https://build.opensuse.org/package/show/X11:XOrg/suse-prime-beta

timrichardson commented 5 years ago

I had no idea that you could defer nvidia module load and still get KMS. Cool that it works (and yes, it works for me). I have mucked around with Optimus scripts, see https://github.com/timrichardson/Prime-Ubuntu-18.04 which I maintained during the debacle of Ubuntu's 18.04 prime-select changes, subsequently fixed. I think I could have simplified my solution if I had known this.

OpenSuse packaging must be quite different than what I am used to ... there is no install script in the git repo (I copied files here and there to "update").

sndirsch commented 5 years ago

I had no idea that you could defer nvidia module load and still get KMS. Cool that it works (and yes, it works for me). I have mucked around with Optimus scripts, see https://github.com/timrichardson/Prime-Ubuntu-18.04 which I maintained during the debacle of Ubuntu's 18.04 prime-select changes, subsequently fixed. I think I could have simplified my solution if I had known this.

OpenSuse packaging must be quite different than what I am used to ... there is no install script in the git repo (I copied files here and there to "update").

That's why we provide a package. And there's a README.md file, where things are documented, right. I.e. where files need to be copied to ...

a4z commented 5 years ago

I have the same message as the OP when I go from nvidia to intel, and I am not sure that the nvidia card is powered off correctly, my battery time is not that great, and power top shows me 100.0% PCI Device: NVIDIA Corporation GM108M [GeForce 940MX] even if I am on the intel card this is even the case after starting the system, so nvidia was never activated

timrichardson commented 5 years ago

I installed from a local git clone of this repo, latest release tag, and it worked. So I assume there is a fix in the latest version. I wanted to work out how to build a local package, but OpenSuse packaging is something I need to learn from scratch as it is a new distribution to me, and I haven't got around to it yet. So for me, 'installing' it meant manual copying of scripts, but it is clear where they go. Perhaps if you do this and provide feedback that it worked, it can help the package owners feel more confident about putting a more recent version in tumbleweed.

a4z commented 5 years ago

ok, I can switch back to intel from runlevel 3 (multiuser) and all nvidia moduls are unloaded but,

cat /proc/acpi/bbswitch 
0000:02:00.0 ON

I turn it off

sudo tee /proc/acpi/bbswitch > /dev/null <<EOF
OFF 
EOF

it is off for a while, but after a minute or so, it is ON again any hint why?

timrichardson commented 5 years ago

I don't know why, that is weird. You see that in runlevel 3? Then look through systemd perhaps. I do not see this behaviour on my laptop. See comment above about latest version :)

bubbleguuum commented 5 years ago

@a4z

Maybe start nvidia-smi to check if any process is using it.

sndirsch commented 4 years ago

I don't see such an issue with SUSEPrime 0.7. Let's assume the issue is fixed now. Otherwise please feel free to open a new issue.