Multiple Graphic Cards - how to make dom0 use internal one?

1,121 views
Skip to first unread message

Frank Schäckermann

unread,
Jul 24, 2014, 4:03:15 AM7/24/14
to qubes...@googlegroups.com
Hi there!

I have a Lenovo W530 with a descrete graphics card NVIDIA K1000M and an internal Intel graphics card.

If I configure the BIOS to "NVIDIA Optimus" setting, both cards are enabled and visible in lspci output.

In this case, dom0 uses the discrete NVIDIA graphics card by default. Is there any way to make it use the internal one?

It does use the internal one automagically, if I re-configure the BIOS to "Internal Graphics" and thus hide the NVIDIA card from it.

Regards, Frank


Anonymous

unread,
Feb 12, 2015, 10:13:51 AM2/12/15
to qubes...@googlegroups.com, by24r...@snkmail.com
I presume you are trying to pass-through the PCI device to another VM, in which case I'm not sure if this would work for you but I would take a look at https://wiki.archlinux.org/index.php/NVIDIA_Optimus#Using_nouveau (look at the nouveau and Bumblebee sections).

David Hobach

unread,
Feb 12, 2015, 12:29:28 PM2/12/15
to Anonymous, qubes...@googlegroups.com, by24r...@snkmail.com

On 12.02.2015 16:13, Anonymous wrote:
> On Thursday, July 24, 2014 at 6:03:15 PM UTC+10, Frank Schäckermann wrote:
>> Hi there!
>>
>> I have a Lenovo W530 with a descrete graphics card NVIDIA K1000M and an internal Intel graphics card.
>>
>> If I configure the BIOS to "NVIDIA Optimus" setting, both cards are enabled and visible in lspci output.
>>
>> In this case, dom0 uses the discrete NVIDIA graphics card by default. Is there any way to make it use the internal one?
>>
>> It does use the internal one automagically, if I re-configure the BIOS to "Internal Graphics" and thus hide the NVIDIA card from it.

You can disable the GPU driver in /etc/default/grub in dom0.
For nvidia add
GRUB_CMDLINE_LINUX="[whatever you had before] nouveau.modeset=0
rd.driver.blacklist=nouveau"
(To also disable plymouth you may use "plymouth.enable=0".)
Afterwards you'll have to run the update grub binary.

Vít Šesták

unread,
May 2, 2015, 4:10:43 AM5/2/15
to qubes...@googlegroups.com, by24r...@snkmail.com, ad...@privacy.cat, tri...@nurfuerspam.de
I've added this in the grub config (now cat /proc/cmdline in Dom0 shows it). While the nouveau kernel module is no longer present after this change, the laptop with Qubes still consumes about as twice much power as with Ubuntu, which is currently my largest issue with Qubes. The powertop shows the power consumption goes mostly to "display backlight", which is likely caused by the GPU.

I've a laptop with Intel+Nvidia. More details about my laptop (exported from Dell website, updated by me (comments included), but updates are not related to the GPU): http://pastebin.com/Zsb7Fw6A

My another attempts to solve it or get more info:
1. Install Bumblebee or bbswitch or something similar to Dom0. I haven't found any of them in the repo (not sure why), so I gave it up. I might try to add a suitable repo (if such repo exists), but I'd like not to do that in Dom0 if possible.
2. Disable the PCI using something like echo -n "auto" > /devices/pci0000:00/0000:00:02.0/power/control'. (Copied from http://superuser.com/questions/321657/how-can-i-tell-windows-or-linux-to-put-a-specific-pcie-device-into-sleep-off .) This is not applicable for me, since there is already the value auto.
3. Get more info using lspci -vv. The output suggests it is in state D0 and not in D3, which is likely the cause of high power consumption.
4. Attach it to another VM. The reattachment seemingly succeeded. (Precondition: nouveau is disabled. With enabled nouveau, it generates a kernel panic for obvious reason.) However, the consumption did not drop. Moreover, while I was able to see the card in the "nvidiavm", I was unable to modprobe it. This is output from Debian Jessie, but the same issue was on Fedora VM:
$ lspci
00:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 525M] (rev a1)
$ sudo modprobe nouveau
modprobe: ERROR: could not insert 'nouveau': No such device

Attaching to some other VM is rather nice-to-have for me, since I could have some "hdmivm", but it is not the main issue now.

Not applicable for me:
1. Something like echo -n "0000:00:02.0" > /sys/bus/pci/drivers/i915/unbind - such command is connected to a driver which uses the card. But there is no driver using the card.
2. Detach the GPU physically from motherboard. The GPU is soldered, so it is very nontrivial. And I am afraid that this would likely make my laptop out-of-warranty even at Dell, which is otherwise tolerant to many other HW upgrades. (I've about two years of warranty remaining.)

What should I do now:
a. Is there some another trick to disable the Nvidia GPU?
b. Should I try to install Bumblebee to Dom0?

Regards,
Vit Sestak 'v6ak'

Vít Šesták

unread,
May 2, 2015, 10:08:34 AM5/2/15
to qubes...@googlegroups.com, tri...@nurfuerspam.de, by24r...@snkmail.com, ad...@privacy.cat
I've tried the Bumblebee installation. It is rather hard. I've done the following:

1. Downloaded http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora21/noarch/bumblebee-release-1.2-1.noarch.rpm
2. extracted two files from it:
* /etc/yum.repos.d/bumblebee.repo
* /etc/pki/rpm-gpg/RPM-GPG-KEY-bumblebeepublic
3. Verified the files that the key is well known and the *.repo requires GPG key check.
4. Copied the files to their location in Dom0 manually.
5. sudo qubes-dom0-update bumblebee - did not install it
6. sudo qubes-dom0-update, which tried to install it, but it compained about missing key with the exactly same key id as /etc/pki/rpm-gpg/RPM-GPG-KEY-bumblebeepublic
7. Tried rpm --import etc/pki/rpm-gpg/RPM-GPG-KEY-bumblebeepublic on the verified key and hoped it will fix the issue.
8. Tried sudo qubes-dom0-update bumblebee and sudo qubes-dom0-update again, with no luck. It again complains about a missing key that exists.

Well, it might just improperly complain about someone trying to forge the key using a key id collision, but I don't think this is the case...

How can I import the GPG key?

Regards,
Vit Sestak 'v6ak'

Vít Šesták

unread,
May 4, 2015, 4:53:56 AM5/4/15
to qubes...@googlegroups.com, by24r...@snkmail.com, tri...@nurfuerspam.de, ad...@privacy.cat

This seems to be some Qubes bug. When I transfer the package from sys-firewall to dom and run rpm -K bumblebee-3.2.1-7.fc21.x86_64.rpm, it tells me that the GPG signature is OK.

When I run the rpm -K bumblebee-3.2.1-7.fc21.x86_64.rpm in the sys-firewall, it used not to recognize the signature. After I imported the public key to sys-firewall, it can verify the RPM package, but sudo qubes-dom0-update bumblebee and sudo qubes-dom0-update still complains about not having the signature. Maybe qubes-dom0-update uses some different keystore?

Regards,
Vit Sestak 'v6ak'

Vít Šesták

unread,
May 4, 2015, 5:34:06 AM5/4/15
to qubes...@googlegroups.com, ad...@privacy.cat, tri...@nurfuerspam.de, by24r...@snkmail.com
Finally got Bumblebee installed! I'll restart the Qubes in order to see if there is a progress.

Problem #1: /var/lib/qubes/updates/errors not automatically deleted, so qubes-dom0-updates gave it up if there was a problem in the past: https://github.com/abeluck/qubes-core/commit/a680976f1e48664c543272c2f4ce6ef08b024c50#diff-c2fc1ccc6b7d0d54b8baa948e60180d3R90

Problem #2: Too strict regexp for parsing the output of rpm -K caused GPG key rejection. On the bumlbebee package, rpm -K 1. returns the checks in different order and 2. returns "gpg" instead of "pgp". Problematic code: https://github.com/abeluck/qubes-core/commit/2950ee717005eb148461c83a92eb088c9a542f92#diff-9edf4e30fdc866530e395a45a829c27bR37

I'll report these two issues on Github.

Regards,
Vit Sestak 'v6ak'

Vít Šesták

unread,
May 4, 2015, 6:27:03 AM5/4/15
to qubes...@googlegroups.com, by24r...@snkmail.com, ad...@privacy.cat, tri...@nurfuerspam.de
Reported the two issues under https://github.com/QubesOS/qubes-issues/issues/988 and https://github.com/QubesOS/qubes-issues/issues/987 .

I've tried both bbswitch and bumblebee. I was able to install both, but I was not able to cut the power consumption down. But I have not tried to find the issue, I can try it later… At least, I have some little progress :)

Regards,
Vít Šesták 'v6ak'

Vít Šesták

unread,
May 5, 2015, 3:08:06 AM5/5/15
to qubes...@googlegroups.com, tri...@nurfuerspam.de, ad...@privacy.cat, by24r...@snkmail.com
Now, it seems to be rather solved. At least the Nvidia power consumption seems to be gone. The power consumption now seems to be on par with my non-virtualized Ubuntu 12.04.* with Bumblebee and proprietary Nvidia drivers. This suggests proprietary drivers are not needed (I don't have them in Ubuntu) for low power consumption. Just having a working Bumblebee is likely enough. (BTW, using Nvidia GPU in Qubes does not seem to make any sense if Intel GPU is present, expect for HDMI.)

I've done multiple attempts, they include:
* Adding the Bumblebee repo to dom0 (the most tricky part for multiple reasons)
* Installing Bumblebee (in dom0)
* Installing bbswitch (in dom0)
* Installing TLP (in dom0)
* Now, I don't have blacklisted nouveau through grub. (It might have collided with Bumblebee. The Bumblebee does its own blacklisting, though. But it seems to be reasonable to remove all your attempts to blacklist the Nvidia kernel modules, since it is handled by Bumblebee.)
* sudo systemctl enable tlp && sudo systemctl enable tlp-sleep.service && sudo systemctl enable bumblebee # Maybe all of there are unnecessary, but I am not sure about default settings
* reboot :)

I hope I've written everything important there for solving the Nvidia power consumption. Some of the steps might be unneeded. I hope the most important part is installing Bumblebee (and adding Bumblebee repository). Installing bbswitch might be also needed, but Bumblebee has multiple backends, so I am not 100% sure. Installing TLP has might have no impact on Nvidia power consumption, but it might improve other HW power consumption (powertop is now more happy), so it is advisable.

When I reinstall Qubes, I hope I can reproduce these steps.

Now, Qubes seems to be usable for me. I've to solve some other issues (backup size, USB isolation, hard SSD+HDD mixing, minor sound issues), but none of them seems to be a blocker.

If you are unsure about some of these steps, you can ask. I hope I can provide some help.

Regards,
Vit Sestak 'v6ak'

David Hobach

unread,
May 5, 2015, 11:27:52 AM5/5/15
to Vít Šesták, qubes...@googlegroups.com
Thanks for sharing your acquired knowledge; I guess it will help some users!

Personally I didn't care about power consumption too much; that's why I
didn't have the same problem. I had an nvidia GPU though which I had to
blacklist (without bumblebee).

Might be worth having a wiki article on the topic.

Vít Šesták

unread,
May 5, 2015, 11:45:50 AM5/5/15
to qubes...@googlegroups.com, groups-no-private-mail--con...@v6ak.com, tri...@hackingthe.net
Yes, a wiki topic might be useful, but I will likely not write it until https://github.com/QubesOS/qubes-issues/issues/988 is fixed, because it makes explaining the process to all too complicated and fixing it should be relatively easy.

Regards,
Vít Šesták 'v6ak'

zack...@gmail.com

unread,
Aug 17, 2016, 3:16:05 PM8/17/16
to qubes-users, groups-no-private-mail--con...@v6ak.com, tri...@hackingthe.net
I've been trying to install bumblebee but I have been unable to get it to install properly. I have added the proper repos to dom0 by copying the rpms over to it and installing them. But then I get a "Failed to synchronize cache for repo 'bumblebee', disabling" error when attempting to update dom0 or install bumblebee. How did you get it to work? Thanks
Reply all
Reply to author
Forward
0 new messages