Vgaswitcheroo on Debian-based distributions

As some of you have been able to read in the forum, I had proposed to install my hybrid graphics (ATI / Intel) in some of the many distributions that exist, since those of you who know this evil, you will know that the system leaves both graphics on even if it only uses one of the two, thus reducing battery life significantly, and giving your PC a new super power, that of frying eggs on top of it.

Much to my regret, I had to give up that end, since, in none of the distributions I tested (Debian, OpenSuse, Xubuntu y Linux Mint) I got some good results. This led to another statement of the problem:

How to get one of the two graphs, in my case the ATI, remains off?

The solution, as you will see below, is implemented in the core of our favorite distribution and is called vgaswitcheroo. And below you have the process, in which we assume that the package firmware-linux-nonfree is installed, for your use and enjoyment:

First we must find out if our core you have the option to use vgaswitcheroo:

$ grep -i switcheroo / boot / config- *

What will return a line in our terminal like this:

CONFIG_VGA_SWITCHEROO = y

If the output is different, you have to recompile the core to add the option to vgaswitcheroo. Second, we see if the file «/ sys / kernel / debug / vgaswitcheroo / switch » exists. At this point a distinction must be made:

In distributions based on Ubuntu this file is accessible or should be accessible by default. While in distributions like Debian, Folder debugging you don't have another call vgaswitcheroo and it will take a couple more steps.

To always have the folder accessible and to be able to access the file Switch, we must mount the debug folder as follows (always from superuser):

  1. # mountpoint -q / sys / kernel / debug
  2. # mount -t debugfs none / sys / kernel / debug
  3. # echo "none / sys / kernel / debug debugfs defaults 0 0" >> / etc / fstab

Step 3 we can do it manually. It's about adding the line none / sys / kernel / debug debugfs defaults 0 0 to file / etc / fstab so that the vgaswitcheroo folder is always accessible even after a reboot.

Once this is done we can check our file Switch inside the folder vgaswitcheroo, through:

# cat / sys / kernel / debug / vgaswitcheroo / switch

and this returns an output like the one in the image:

vgaswitcheroo
Your output can be differences (All are in Pwr mode, for example). In this file we have several things to comment. The term DIS corresponds to the dedicated graphic (in my case, the ATI). The term IGD corresponds to the integrated graphics on the CPU (the Intel). The cross, +, check the print shop It is using at the time. And finally, the end Pwr o off, refer to graphics status.

With this, we can deactivate or activate the graph that we want through some commands:

  • Turn off the dedicated graph:
# echo OFF> / sys / kernel / debug / vgaswitcheroo / switch
  • Turn on the dedicated graph:
# echo ON> / sys / kernel / debug / vgaswitcheroo / switch
  • Switch between integrated and dedicated:
# echo DIGD> / sys / kernel / debug / vgaswitcheroo / switch # echo DDIS> / sys / kernel / debug / vgaswitcheroo / switch

Finally, to grant permits to our usual user and thus be able to execute scripts at the beginning, for example, we will have to execute:

# chmod -R 705 / sys / kernel / debug # chown -R user: user / sys / kernel / debug / vgaswitcheroo
Modifying the permissions of any folder on the system can carry some risk. I recommend doing it at your own risk. In the case of this guide, the process is done on Debian Testing, so some steps may be different here than in other distributions.

I hope it helps you to squeeze a little better the performance of your laptops or at least reduce the heat they give off.

A greeting!

Sources: Debian Mailing List | LinuxQuestion


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

23 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Ivan Barra said

    Excellent data, at least for the Nvidia (my case), there is the Bumblebee project, which works great in OpenSUSE 12.3, Fedora 1x and other RPM-based distros, in Ubuntu it works great, but in others based on .deb, sometimes it hangs and you have to enter to restart.

    Greetings and thanks for sharing.

    1.    Carlos Saldaña said

      sorry, do you know if it works for debian 7 64bits ??

      1.    Ivan Barra said

        Yes, if it works, I have tried it with debian and it works fine.

        http://wiki.debian.org/Bumblebee

        Although I recommend using the proprietary drivers yes or yes. The opensource give bugs.

        Greetings.

        1.    Carlos Saldaña said

          thanks for the tip

  2.   oxygenating said

    I love you tesla, in ubuntu I managed to use vgaswitcheroo but in debian it tells me that I don't have it installed, I'll try it this afternoon

    1.    Tesla said

      Hope you have luck.

      I think that as of kernel 3.2 it is already activated. But anyway if you don't have it activated you can always compile the kernel and activate it.

      1.    oxygenating said

        I am already in debian and testing the tutorial there are contradictions, in the first step it gives me the output that I have vgaswicheroo activated, but when I go to use it it launches the message

        bash: / sys / kernel / debug / vgaswitcheroo / switch: The file or directory does not exist

        I have done the step to solve this in both ways manually and with the command (I was going to do it manually but when I saw the file I already had it with the line, but in that file I only had the line)

        And after doing the step it throws me the same error

        1.    Tesla said

          I autoresponder, it does not allow to edit the post, since it gives a fatal error and other things that I do not understand. Maybe some admin can give us a hand.

          Regarding STEP 3: EDIT THE FILE MANUALLY AND NOT AS IT SAYS WITH THE echo !!!!

          Sorry for any inconvenience that may have caused you. Anyway, it is always recommended when important files are modified to make a copy just in case!

          1.    oxygenating said

            With the command the line is created. The problem was mine, since I went directly to the construction site and forgot to install the firmware-linux-nonfree and in addition to that in the 3rd part you have to add a line in the rc.local file

            # chown your_user: your_user / sys / kernel / debug / vgaswitcheroo / switch

            I have installed the proprietary amd drivers and it works like a charm better than in windows that the flash was constantly blocking me

            Thank you very much

          2.    Tesla said

            I'm glad that everything is perfect for you! 🙂

            As for the rc.local file, I have not put it since I am not sure of the risk that this entails. And furthermore, I trust that each person will act according to their criteria and preferences. Some may prefer rc.local and others assign the permissions on each session. That is to the taste of each person!

            Greetings and enjoy your pc!

  3.   Rots87 said

    0.0 interesting article although it does not work for me I will take it into account when I buy an ATI (the nvidia cost me an arm and a leg)

    1.    Yukiteru said

      An NVIDIA on Linux is a million times preferable to an ATI, and there are cheaper ones. A GT 210, it is not very expensive to say, and it is good to play and see things with good quality and resolution.

  4.   Carlos Saldaña said

    I have an xps 15 i7 with a nvidia of 2gb of video, we opt for getforce GT 640m and in the part that says it has the super power to fry eggs, exactly the same thing happens to me, I have debian 7 64-bit .. I'm going to try with this tuto, how's it going

    1.    Tesla said

      For Nvidia there is, as Iván Barra has said, Bumblebee. Those who use Nvidia should before trying this try to make Bumblebee work, I have friends who have succeeded.

      This post is as a last resort if all else fails. Still, you are free to choose your anti-egg fryer method! 😉

  5.   eliotime3000 said

    Good post. Hope when I install Debian 7 on a PC with NVIDIA video, it doesn't turn into an egg fryer.

  6.   Jacob said

    Well, I did the above and I delete the data from the "fstab" now I have to mount the / home and swap partitions manually. Well that helped me learn something new like "mkswap" and "swapon". Now to restore the aforementioned file.

    1.    Tesla said

      I don't understand why your fstab data was deleted. Anyway, I think I'm going to edit step 3 and do it manually, since it gives me that the fault could be there!

      1.    Jacob said

        Neither did I and I spend the same thing as oxygenating. I think my mistake was to follow the steps to the letter and forget the basic renaming "file.old" but it helped me because now I know that the previous commands exist !!!

      2.    adrian15 said

        It is clear :).

        The> must be a >>.

        1.    Tesla said

          Thanks for the clarification.

          However I cannot edit the post due to a bug in the blog. Maybe it will be fixed in the next few days or maybe not, if it is fixed I will change it.

          Greetings and thank you!

  7.   dakar said

    I keep getting "/ sys / kernel / debug / vgaswitcheroo / switch: The file or directory does not exist"
    I read the comments and tried to do what they point out, but no, it's still the same ...
    I've looked everywhere, but I can't find solution D:

    1.    Tesla said

      Do you have the firmware-linux-nonfree package installed? What does the command return: grep -i switcheroo / boot / config- * ??

      1.    Rigel Ricardo Valladares Mendez said

        hello good morning, afternoon or night the same thing happens to me like dakar and when I execute the command I get this I hope you still answer these questions
        root @ Rigel-PC: ~ # grep -i switcheroo / boot / config- *
        /boot/config-3.16.0-4-amd64:CONFIG_VGA_SWITCHEROO=y
        /boot/config-3.16.0-5-amd64:CONFIG_VGA_SWITCHEROO=y