Showing posts with label startup. Show all posts
Showing posts with label startup. Show all posts

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. 

Saturday, 8 February 2014

Tips for Linux+windows8 dual boot users

So you are using your favourite linux distro in dual boot with windows 8 and you put your stuff in an NTFS partition and access it from both the OS? Here are some things to consider in order to stay out of troubles.
Problems you may face are :
1. Windows frequently keeps asking me to reapair NTFS partition. Once i repair it, the problem occurs again after a few days.
2. While using linux OS i can't see some files and folders on my NTFS partition which actually exist on the NTFS partition. They can be accessed while using windows but linux fails to show them in the partition.

Info :
This basically happens because of Windows 8 "fast startup" feature. You can google it for more information. Linux cannot handle this perfectly which results in all the problems. Also for unknown reasons the NTFS drive gets split in peculiar way as shown in figure.
windows8dualbootntfs

This is a snapshop of linux /media directory. Here 01CD1F0FE77B9960 is the name given to a NTFS partition which has 4 variants here : 01CD1F0FE77B9960, 01CD1F0FE77B9960_, 01CD1F0FE77B9960__, 01CD1F0FE77B9960___. This is the cause for second problem. Because you may be looking for your file in "01CD1F0FE77B9960" but it may be residing in "01CD1F0FE77B9960_". I guess the reason is that when linux writes to a NTFS partition it creates a different variant for it by putting an underscore to its name.
Solutions :
For Problem 2 : It is clear that your files and folders are not lost, they are at a different location .
Therefore just look for your desired file or folder in all the variants as described in "Explaination" section.
You may want to merge the variants of the partition.
For example you have four variants in the /media directory :
01CD1F0FE77B9960, 01CD1F0FE77B9960_, 01CD1F0FE77B9960__, 01CD1F0FE77B9960___
1. Backup the contents of 01CD1F0FE77B9960_, 01CD1F0FE77B9960__ and 01CD1F0FE77B9960___ into 01CD1F0FE77B9960.
2. Move 01CD1F0FE77B9960_, 01CD1F0FE77B9960__ and 01CD1F0FE77B9960___ to trash.
Thats it! At present NTFS splitting problem does not seem to be preventable, you can just cure it time to time.
Tried On : linux kali 1.0.4 + windows 8 dual boot
May work for : any linux distro + windows 8(or newer) dual boot

Featured Post

PHP EmailMessage class for extracting attachments

Hi, recently I had to create a php program which fetches emails with attachments (including inline). I searched a lot and succeeded with h...