Disabling an nvidia graphics card with bbswitch on Fedora


bbswitch is a kernel module which automatically detects the required ACPI calls for two kinds of Optimus laptops. It has been verified to work with “real” Optimus and “legacy” Optimus laptops.

kernel-headers and kernel-devel are needed to install bbswitch with dkms. Now, installing with dkms ensures that bbswitch is going to survive future kernel upgrades.

sudo yum install kernel-headers kernel-devel dkms

Download the latest stable version of bbswitch, extract, and install with dkms.

wget https://github.com/downloads/Bumblebee-Project/bbswitch/bbswitch-0.5.tar.gz
tar -xf bbswitch-0.5.tar.gz
cd bbswitch-0.5
sudo make -f Makefile.dkms

The nouveau driver needs to be unloaded before bbswitch can be loaded. If nouveau driver is being used somewhere, then the way around is to blacklist nouveau, and rebuild initramfs.

A simple lsmod can reveal if nouveau driver is being used:

lsmod | grep nouveau

You can also try unloading nouveau:

sudo modprobe -r nouveau

If the above fails, we are heading over to blacklisting nouveau and rebuilding initramfs.

su -c "echo 'blacklist nouveau' >> /etc/modprobe.d/disable-nouveau.conf"
sudo mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
sudo dracut --omit-drivers nouveau /boot/initramfs-$(uname -r).img $(uname -r)

If all goes well, reboot.

Nouveau driver can now be easily removed and bbswitch can be loaded once the system has restarted.

sudo modprobe -r nouveau
sudo modprobe bbswitch

Once, bbswitch is loaded, disabling and enabling the graphics card is just a walk in the park:

sudo tee /proc/acpi/bbswitch <<< OFF    # disable
sudo tee /proc/acpi/bbswitch <<< ON     # enable

Verifying the status of the card is as easy as:

cat /proc/acpi/bbswitch

Disable your discrete nvidia card in Linux Fedora


For almost 11 months, i.e., from June’12, since i switched over to Linux Fedora from Windows, I have been having a lot of issues with my discrete nvidia graphics card. By issues, I mean huge amount of power consumption followed by heating.

After googling, I found that the default nouveau driver, which comes with my Linux distro, ain’t any good for the nvidia optimus technology, which results in an unnecessary drain of battery power. The battery lasted only for about an hour or so, and i had to use a cooling pad to keep my laptop cool.

I looked up the nvidia website, and downloaded the linux nvidia driver, but unfortunately, the driver didnt work, and I was welcomed with a system crash. (Now I fully support Linus Torvalds’s comment on nvidia)
However, I survived the crash because I previously had a backup of the nouveau driver and recovered my Fedora system.

When I diagnosed the power consumption using powertop, found that, the drain was almost 42W. At this juncture, it was getting really frustrating, and I blamed myself for buying a laptop with an nvidia card.

Yesterday, while i was again searching for some tool to fix this nvidia issue, I came across a really impressive project, https://github.com/Bumblebee-Project/bbswitch which saved my laptop from getting thrown away 🙂

Disabling the discrete nvidia graphics card

1. Get the source

Download the latest bbswitch source code from https://github.com/Bumblebee-Project/bbswitch/downloads

2. Unpack the archive

gzip -c bbswitch-x.y.z.tar.gz | tar xf -

3. Install dkms if you dont already have it

sudo yum install dkms

4. Change to the source directory

cd bbswitch-x.y.z

5. Compile and install bbswitch

make -f Makefile.dkms

6. Unload the nouveau driver

modprobe -r nouveau

7. Load bbswitch

modprobe bbswitch

8. Switch off the card

tee /proc/acpi/bbswitch <<< OFF

Now you are done switching off the graphics card, but still its good to double check for confirmation:

Get the status of the card

cat /proc/acpi/bbswitch

The output should be like this :

0000:01:00.0 OFF

Automate the process on startup

You might want to automate this process on startup or else you will have to do this manually every time you boot into Linux
What i did was, i made use of the rc.local file in /etc/rc.d
This is what my rc.local file looks like:

#Turn off the nvidia graphics card
modprobe -r nouveau
modprobe bbswitch
tee /proc/acpi/bbswitch <<< OFF

Note: To turn on the device :

tee /proc/acpi/bbswitch <<< ON

Note: To uninstall the bbswitch module :

make -f Makefile.dkms uninstall

Now, after switching off the graphics card, powertop shows me a discharge rate of about 10 – 15 W, and my battery lasts for almost 3:30 hours.

Hope this helps all those people stuck with the nvidia graphics card. 🙂