Disable the NVIDIA discrete graphic card in a NVIDIA Optimus laptop

I got a new laptop for work. I’m using Linux and not playing games on the pengiun OS so the NVIDIA card is just wasting the battery and making the machine uncomfortably hot. NVIDIA provides official support in MS Windows for turning off the card but not Linux OS. This post shows how to turn off the NVIDIA card in Linux using a kernel module developed by some super power programmer out there.

1. Download the latest module source code from “https://github.com/Bumblebee-Project/bbswitch/downloads“.
2. Unpack the archive file.

# gunzip -c bbswitch-x.y.z.tar.gz | tar xf -

3. Make sure you have the DKMS package install.

# aptitude install dkms

4. Change into the source directory.

# cd bbswitch-x.y.z

5. Compile and install the module

# make -f Makefile.dkms

6. TO uninstall the module

# make -f Makefile.dkms uninstall

7. Activate the module

# modprobe bbswitch

To get the status of the NVIDIA graphic card.

# cat /proc/acpi/bbswitch
0000:01:00.0 ON
or
0000:01:00.0 OFF

To turn the card off and on

# tee /proc/acpi/bbswitch <<OFF
# tee /proc/acpi/bbswitch <<ON
# tee /proc/acpi/bbswitch <<<OFF
# tee /proc/acpi/bbswitch <<<ON

If the card stays “ON” after issuing the “OFF” command, probably the driver has not been unloaded.

# dmesg |tail -1
bbswitch: device 0000:01:00.0 is in use by driver 'nouveau', refusing OFF

To unload the driver

# modprobe -r nouveau

To auto-disable the card on boot

# echo "blacklist nouveau" >> /etc/modprobe.d/blacklist
# echo “blacklist nouveau” >> /etc/modprobe.d/blacklist.conf (some Ubuntu users commented below, saying this works for them)
# echo "bbswitch load_state=0" >> /etc/modules
# update-initramfs -u

See the project website for more info regarding the module: https://github.com/Bumblebee-Project/bbswitch

Updated [2014-01-21]:
I notice some people were having problem with unloading the driver (FATAL: Module nouveau is in use).  Fear not, just proceed with the next step, “auto-disable card on boot” and reboot your machine.

36 responses to “Disable the NVIDIA discrete graphic card in a NVIDIA Optimus laptop

  1. Neil May 13, 2012 at 11:21 am

    Thanks so much for posting this… I’ve been searching for ages on how to turn off the NVIDIA card in linux!

  2. Stephan June 20, 2012 at 6:21 pm

    I’ve a Acer Travelmate 8472TG wit NVIDIA Hybrid ( GEFORCE GT 330M). Does this procedure also work with it? (Linux MINT)

    • wenlong June 21, 2012 at 8:14 am

      Hi Stephan,
      No harm give it a try. You can uninstall the kernel module at a later time if you don’t like it.

  3. Manojkumar Muralidharan January 14, 2013 at 12:28 pm

    Helped me a lot ! Thank you

  4. Onyx Familia Et Deus January 31, 2013 at 9:27 am

    that should be tee /proc/acpi/bbswitch <<<OFF and tee /proc/acpi/bbswitch <<<ON

  5. Mohamed February 24, 2013 at 5:16 am

    This has helped me, except for the command: cat /proc/acpi/bbswitch, I had to run “modeprob bbswitch” before running it. Thank you!

  6. Sagar Belure March 1, 2013 at 4:43 pm

    Thank you so much man.
    You saved me switching from Linux to Windows.🙂
    I did make a blog post detailing my story and giving your blog post link for resolution of same:
    http://blog.belure.com/2013/03/linux-mint-13-maya-disable-nvidia.html
    (Actually, I kept the title same too, hoping you wont mind).

    Also, thank you Mohamed too, I did not have file ‘/proc/acpi/bbswitch’ either, I too had to do ‘modprobe bbswitch’ to make it appear.

  7. Sagar Belure March 1, 2013 at 5:16 pm

    Thank you wenlong. Happy to know you liked it.🙂

  8. Vader March 9, 2013 at 10:57 pm

    Is this method still viable? My laptop is an Asus U36SD and I have Mint 14 mate on it now, but it gets so hot and battery is half of what Win7 can get. I have a GT520M that I want to annihilate in Linux, and just use the i5 2430M’s integrated gpu.

    • wenlong March 10, 2013 at 12:09 am

      Just give it a try 🙂

      • Vader March 10, 2013 at 12:44 am

        I would but I’m just afraid of rendering my Linux installation useless. I’ve tried numerous things with Nvidia drivers and stuff and I always end up getting stuck in a 640×480 resolution, and being unable to fix it. I’ve reinstalled Linux like 3 times😛 But yeah I’ll give it a try.

  9. Vader March 10, 2013 at 1:08 am

    When I try to do “modprobe -r nouveau” I get error: FATAL: Module nouveau in use, so I thought that I’d just add it to blacklist and reboot but when I try the # echo “blacklist nouveau” >> /etc/modprobe.d/blacklist
    or the
    # echo “bbswitch load_state=0” >> /etc/modules commands I get error: -bash: /etc/modprobe.d/blacklist: Permission denied. Even if I try to sudo echo blabla before, still comes back with Permission denied. And logged on the machine with the CTRL+ALT+F1 command, so I’m in tty1 when I’m trying to do this. Tried it normally and it failed as well.

    What can I do about this?🙂

    • Sagar Belure March 10, 2013 at 1:23 am

      @Vader
      Try this:
      $ sudo -s
      # echo “blacklist nouveau” >> /etc/modprobe.d/blacklist
      # echo “bbswitch load_state=0″ >> /etc/modules

    • Vader March 10, 2013 at 1:27 am

      Ok I fixed it by doing a “sudo -i” command before, and then issuing all the other commands. Rebooted and now # cat /proc/acpi/bbswitch returns OFF😀

      Powertop shows much less Watt drain now after this. Althought it might not be the same as in Windows, but it’s at least much better than before. Thanks for the guide!

  10. Pablo Adrian Fuentes Castillo May 7, 2013 at 5:37 am

    Hello. I tried to swhitch-off the nvidia card using the instructions posted. But the terminal gives me back “ERROR: Module nouveau is in use” each time i try to unload that module. My computer go as high as 80°-85°C, i have two fan coolers around… i can’t use the computer😦 I hate nvidia.
    I use fedora 18 & linux mint 14.
    Do you have an idea of the problem?
    Thanks

  11. wenlong May 7, 2013 at 9:04 am

    Hi Pablo,
    Did you try the “blacklist” methodd to disable the nouveau module upon system startup? That will prevent the module from being used.
    Thanks.

  12. Pablo Adrian Fuentes Castillo May 8, 2013 at 8:20 am

    Yep! it works. Thanks!, by the way, yesterday i manage the fstab because i want to mount on boot two ext4 partitions…When i restart everything seem ok. But then the computer start to heat up again. I write in terminal the cat /proc/acpi/bbswitch and the answer was no bbswitch module found. Im going to reinstall the bbswitch and check if the blacklist is ok.
    I write back soon

    • Pablo Adrian Fuentes Castillo May 8, 2013 at 8:26 am

      Bad news…i reinstalled the bbswitch, and then tried modprobe bbswitch, the answer:
      FATAL: Error inserting bbswitch (/lib/modules/3.5.0-17-generic/kernel/drivers/acpi/bbswitch.ko): No such device
      If i edit the fstab and coment (#) the two lines i wrote for the new partitions everything goes ok… some one have and idea of the problem?

  13. Aayllon January 30, 2014 at 5:14 am

    Hello.

    In fedora 20 update-initramfs is not available, instead I used dracut –force, but after reboot, if I ran powertop, nvidia card are still running, also nouveau module are loaded. Any idea?

    I tried to disable nvidia card several times, but seems that nothing works with my computer.

  14. webluke February 16, 2014 at 3:58 pm

    Thanks for the write up, this has been something that bugged me about using Linux on my Lenovo laptop. LinuxMint has Bumblebee in its repository and that made installing much easier.

  15. luca February 26, 2014 at 3:20 am

    Hi there, I followed exactly suggested steps, including “fear not…”
    At first reboot Nvidia was still ON, Then everything went into pieces all of a sudden: system freezed and rebooted. At startup now it locks indefinitely at the greetings screen.
    My system is (was…) Xubuntu 13.10. Asus 1215N, Nvidia ION.
    Would be so kind to explain me how to recover it from a rescue command line removing bbswitch ? At the moment I just would like mysystem back as before

  16. luca February 26, 2014 at 3:58 am

    Ok, I managed editing backlist & modules deleting previously inserted lines and now I am on again (hopefully). Anyway it is clear it did not work for me.
    BTW Nvidia can be set off using echo “OFF > /sys/kernel/debug/vgaswitcheroo/switch”. That works for me but I cannot manage to automatically switch it off at startup. Also it needs to be manually set ON again before logging out or session will lock up, which is quite annoying.

  17. Helarisi Wijekoon March 8, 2014 at 8:17 am

    Thanks for this informative post!! After doing some more research I got it done!!

  18. Clint April 8, 2014 at 6:56 am

    Hallo, got ubuntu 13.10 and used this solution, after first restart everything goes fine and the nvidia card is off, but at second restart everything is like before, nvidia is ON. It seems like the configurations are not saved or anything, can you please help me with this issue? Thank you in advance.

    • wenlong April 8, 2014 at 3:12 pm

      Hi Clint,
      Can you check whether all changes made are still there? For example, the changes to the content of /etc/modprobe.d/blacklist and /etc/modules are still there.

      • Clint April 9, 2014 at 12:19 am

        I have checked them, and everything looks fine, there are saved changes 3 times, I have deleted them and let just one of them, I dont know where should be the problem. Thank you for your reply🙂

      • Clint April 9, 2014 at 12:25 am

        After update initramfs i have this warning

        root@ubuntu:~# update-initramfs -u
        update-initramfs: Generating /boot/initrd.img-3.11.0-19-generic
        Warning: No support for locale: en_GB.utf8

      • Clint April 9, 2014 at 2:45 am

        I have added this line like in your tutorial
        echo “blacklist nouveau” >> /etc/modprobe.d/blacklist

        but i added it to blacklist.conf too

        echo “blacklist nouveau” >> /etc/modprobe.d/blacklist.conf

        and now it works, Thank you for your pade and tut🙂

      • wenlong April 9, 2014 at 8:03 am

        I’m glad you manage to get it working🙂

  19. rohit g April 18, 2014 at 11:40 pm

    thanks a lot! it works..but if i ever want to use the card again, turning it on using # tee command is sufficient?? or do i have to remove nouveau from blacklist and load the driver??

    • wenlong April 21, 2014 at 3:52 pm

      Hi Rohit,

      I think you can just load the driver directly from the command line without the need to edit the blacklist file. Just give it a try.

  20. Jeremy Wong March 27, 2015 at 12:03 am

    YOU SIR ARE A LIFE SAVER!!! It worked perfectly on the latest Kali Linux.

  21. Shankar Regmi August 28, 2015 at 10:05 am

    I need to do every steps after reboot. no settings saved😦 DEll INSPIRON n5110 / nvidia Graphics GT525M

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: