A way to check power consumption - if you don’t have an external power meter - is installing powertop
and running it in a console as root.
If your laptop is running on battery it shows the power the laptop is taking up at the moment.
I run the switchoffNvidia.sh right after logging into Plasma.
It’s necessary to power on the Nvidia card during booting up for the correct initialization of the hardware.
The Nvidia kernel modules are loaded thereby, but not needed when you run in ‘prime-select intel’ mode.
The switchoffNvidia.sh script first unloads these Nvidia modules and then the powering off is possible.
If any Nvidia module is still loaded (check with lsmod | grep nvidia), powering off won’t work.
cat /proc/acpi/bbswitch
is showing the actual state of power (ON/OFF) of your graphics card.
Nvidia already has the repo up and running for Leap 42.2, so I thought it was time to take a look at the beta and also try the suse-prime functionality. But that’ s not working at the moment. If someone wants a log or anything else I’m happy to provide it.
The first post is pointing to Index of /opensuse/leap/42.1, so I would expect to take the new drivers for 42.2 from there.
I will see if another route will make it work.Thx.
I have my old Asus clamshell on 13.1, it won’t accept anything newer, but I’m pleased with having it as my summer textprocessor. But if I’m not totally wrong your problem might be that you have, by installing nvidia-drivers, blacklisted the nouveau driver. And, I’m not sure here, but I think that the kernel relies on the noveau driver on boot, and this is what blacklisting blocks, to make this magic powering off the nvidia card. So uninstall everything nvidia and make sure you don’t have any entry in /etc/modprobe.d blacklistning nouveau and when you’re sure of that also make sure you run the command mkinitrd, this last one is often overseen.
Probably your Nvidia card is the graphics card in present use when you executed your nvidoff script.
If a hardware component is in use, you cannot unload the kernel modules (nvidia_drm nvidia_modeset nvidia_uvm nvidia) that are needed to make the component work.
And you cannot switch off a component with kernel modules loaded.
Try to unload manually as root in the console and wait for the systems answer:
If something like ‘modprobe: FATAL: Module nvidia is in use.’ is the answer, you are using the nvidia card.
Then:
Execute as root in the console
prime-select intel
log out of KDE, log in and then execute your script nvidoff as root, or
one line of the script after the other in the console to check, if everything is working right.
super! everything is working just fine… now how do I automate this? because my batterylife just went up for a good +2hours Happy camper here… now only to figure out why my brightness slider isnt working… full brightness all the time isn’t doing any good to my battery as well…
Big thanks for the howto.
Did as instructed. Not clear where to put script files, but saved them to /usr/sbin. (/usr/sbin/switchoffnVidia.sh, /usr/sbin/selectnVidia.sh, this becaus that no one except root should be able to edit)
To automatically save power this below can be done.
Added one line to /etc/sudoers to allow anyone (in user group) to switch off card to save power.
%users ALL = (root) NOPASSWD:/usr/sbin/switchoffnVidia.sh
New script, ~/bin/checknVidia, that check if card is in use, if not remove modules and turn of in /proc/acpi/bbswitch
if ! -f /dev/shm/clearnVidia ] # If file doesn't exists, continue.
then
touch /dev/shm/clearnVidia # put a file in RAM to quit script faster if run again, checking above.
sleep 20 # Sleep for 20 sec. Read somewhere that card needed to get started before turned of
if $(glxinfo | grep Open | grep NVIDIA | wc -l) -lt '1' ]] # If no NVIDIA is used in glx, continue
then
sudo /usr/sbin/switchoffnVidia.sh # Execute script to save power
fi
fi
Also added one line to ~/.profile, with a & at the end to run in background
Sorry, I’m confused here. What doesn’t work in KDE with prime?
Yes, when executing ‘selectnvidia’ or ‘prime-select intel’ some KDE/Plasma parts crash, i.e. log out. I usually run it in konsole logged in as root, and intended to log out to use new prime state. Then I can run, as root, either ‘shutdown -r now’ or more safe, in multi user system ‘loginctl terminate-user quinness’ or whatever the user’s id is.
When logged in again, KDE/Plasma is running with/without nVidia as selected. Now KDE/Plasma work as supposed. I.e. 1700 fps with nVidia, instead of 240 fps running glxsphers on Intel.
Is it that some KDE/Plasma parts crash right after prime-select that’s the problem?
I can basically confirm that on a test install of mine: as long as I avoid SDDM everything else in Plasma5 seems to work properly, even with OpenGL 3.1 compositing.
That is, for instance, by enabling Auto Login and then using another VTx to issue shutdown or reboot as needed.
Logging out the current user apparently works but a new login greeter never appears again.
I’m not a regular user of SUSE-Prime, so cannot debug it myself, sorry.
That is on a fresh 42.2 KDE install from DVD, plus the regular x11-video-nvidiaG04-367.57-18.2.x86_64.rpm and dependencies from Index of /opensuse/leap/42.2 and suse-prime from Knurpht repo.
The same seems true with Gnome and GDM, as long as I bypass the login screen, i.e. by enabling autologin and just shutting down when I am finished.
If I logout something just hangs apparently prior to showing the login greeter again, while the system is still up and running allowing operation on the VTx consoles.
No luck with LightDM, XFCE, IceWM when the Nvidia chip is selected. Everything works with Intel with every desktop I tried so far.
Well its still a no go indeed for KDE and plasma. On Gnome however I have no issues at all on a multi user system. Switching from one user to the other, enableing Intel/Nvidia, all works flawlessly
Greetings,
Might be hardware dependant also, but I tried KDE Neon and could install NVidia-prime. Had the same kms-greeter crash as on openSUSE, but only the first session. After a reboot, I had no problems whatsoever.
Also, I installed openSUSE Leap Gnome. As said, I have no problems is Gnome. When I tried to install KDE alongside Gnome, things went well as long as I only installed the plasma5-session. Installing the backports and a zipper dup brought back the issue in KDE.
I stopped looking at KDE. Although my kids love it, Gnome is more my cup of tea. And Leap is running great with suse-prime here!