Sunday, 16 March 2014

Bumblebee : The best way to disable discrete Nvidia graphic card on every startup Linux

GUI interface for Bumblebee
Screenshot of Bumblebee-ui
This is also the first and best step in order to increase battery life of your Laptop (only for laptops with Nvidia Graphic card and Ubuntu 12.04 or later, you may try for other linux distros ). This post will teach you how to disable discrete graphics at every startup automatically (without any crashes and freezes). But first i have some facts about this phenomenon here, if you're not interested in facts just move to the "Solution" section at the bottom of post.

Problem :
When we use any Linux distribution, we observe that the battery gets consumed very fast. But is this the case with Linux only ? NO, WINDOWS ALSO BEHAVES THE SAME UNLESS the dedicated graphics driver is installed. You can verify it by installing the intel integrated graphics driver only and not installing dedicated graphics driver. Your fan will run fast and battery backup will be very low.
It all happens because we do not install the dedicated graphics driver and both graphic cards (intedgrated and dedicated) remain turned on , thus consuming more battery (as if you're playing a high end game). Solution will be to turn off the discrete graphics card at every startup of linux. For windows users its simple (just install the Nvidia graphics driver from the official website). But on Linux its complicated.

Stats :
I noted down some readings showing battery percentage left vs. battery backup time in various situations.
On Fresh install of Ubuntu 12.04
Percentage Time Left (min.) Percentage/Time Left(min.)
       75.4 40.8 1.84
       74.5 44.3 1.68
       72 42.5 1.69
(Lesser the value of  Percentage/Time Left(min.) the better for us )
Somehow i turned the dicrete graphics card off with the following command as explained at http://planetoss.com/articles/how-to-disable-the-discrete-amd-graphics-card-in-linux/
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
(But don't edit rc.local to do this at every startup, your machine will start crashing and freezing at startup)
and the results are as follows :

Percentage Time Left (min.) Percentage/Time Left(min.)
     66 39 1.69
     65 66 0.98
     64 67 0.95

These results are what we need but this is not safe way to get it done, it causes freezes and crashes.
So , we have to move on to nvidia optimus technology (but only for windows). This technology is included in the drivers intself, and that is why you don't face the problem while using windows with these drivers.
Results after installing nvidia optimus on windows :

Percentage  Time Left (min.) Percentage/Time Left(min.)
       80 74 1.08
       79 116 0.68
       78 104 0.75
       77 72 1.06
Here are some solutions on other websites which failed for me

  1. http://planetoss.com/articles/how-to-disable-the-discrete-amd-graphics-card-in-linux/
  2. http://ubuntuguide.net/ubuntu-12-04-turn-off-discrete-graphic-card-on-boot 
  3. http://askubuntu.com/questions/166682/how-do-i-turn-off-the-discrete-card-on-boot-when-theres-no-option-in-the-bios
  4. http://rudrageek.com/hybrid-graphics-card-system-in-ubunru-fedora-intelati-vgaswitcheroo/
  5. https://github.com/peberlein/acpi_call failed because There was no code for my laptop model,
    Also i advice that never edit your /etc/rc.local file , It definitely causes crashes one day or another.

Now the question is how to achieve the above Nvidia-optimus technology on linux ?
The solution is Bumblebee.
What is the correct way to install Bumblebee ?
It is given below :

Solution
This solution is for Ubuntu 12.04 onwards. However Ubuntu 13.10 officially supports Bumblebee.

Installation

Basic Setup

You need to open your terminal and enter the commands below.
If on 12.04.3, replace linux-headers-generic with linux-headers-generic-lts-raring.

  1. sudo add-apt-repository ppa:bumblebee/stable
  2. Enable the Universe and Multiverse repositories (for bumblebee and nvidia packages respectively).
  3. sudo apt-get update
  4. Install Bumblebee using the default proprietary nvidia driver for 12.04 - 13.04 :
    sudo apt-get install bumblebee bumblebee-nvidia virtualgl linux-headers-generic
    • And for 13.10 :
    sudo apt-get install bumblebee bumblebee-nvidia primus linux-headers-generic
    Note : Keep an eye on the output of the above command. If at the end of output you are asked to run command with "--fix-missing?" , then do it.In my case i had to rerun the above command as :
    sudo apt-get install bumblebee bumblebee-nvidia virtualgl linux-headers-generic --fix-missing
   5. Reboot.

This will by default run all applications with integrated graphic card, thus saving your battery by keeping discrete graphics card turned off.You can Select any app(game) to run on discrete graphic card easily.You can read and learn more about the usage of Bumblebee at Ubuntu Wiki.

However you might want a GUI interface for BumbleBee rather than entering commands again and again. So , here it is :
  1. Go to https://github.com/Bumblebee-Project/bumblebee-ui.
  2. Click "Download zip" at the right end of page.
  3. Extract the zip file in home directory.
  4. In the extracted folder, find the "INSTALL" file and run it with :
    sudo ./INSTALL
  5. Its done , now you can run it by opening the dash and searching for "bumblebee applications settings" and "Bumblebee-indicator".
  6. You may want to add Bumblebee-indicator to startup :
    Open the dash.
    Type "startup applications" and press enter.
    Press "Add".
    Enter any name you would like.
    In Command , click browse and select the file "/usr/share/bumblebee-ui/Bumblebee-Indicator.py".
    click add and its done.
Note : To uninstall Bumblebee-UI , run the UNINSTALL file located in the extracted zip file setup (in the app direcotry i.e. /bumblebee-ui-master/app/UNINSTALL) Just run it as :
sudo ./UNINSTALL

Update :  Ubuntu 14.04 users can install Bumblebee with help of this post.
Tried On : Ubuntu 12.04 LTS , Dell N51110 , NVIDIA GT 525M
May Also work with : Ubuntu 12.04 and later versions, any laptop with NVIDIA graphics card. 

No comments:

Post a Comment