Improve detection of nvidia driver on Ubuntu #129

Merged
merged 2 commits into from Sep 9, 2016

Conversation

Projects
None yet
2 participants
Collaborator

zyga commented Sep 9, 2016

This branch improves the detection of the nvidia driver on Ubuntu systems. Snap confine now reads /sys/module/nvidia/version and uses it to determine the appropriate version of the kernel driver.

This avoids the ambiguity where multiple directories may be present at a given time.

Fixes: https://bugs.launchpad.net/snap-confine/+bug/1615248
Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

zyga added some commits Sep 9, 2016

Detect loaded nvidia driver
This patch changes how nvidia driver detection works on Ubuntu and
derived distributions. Instead of looking at /usr/lib/nvidia-* and
hoping there is only one matching directory we now look at
/sys/module/nvidia/version. If that file is present it contains the
MAJOR.MINOR version string from which we can derive the appropriate
driver directory.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Disable nvidia regression test
The test requires access to /sys/module/nvidia/version that I have no
reliable way of faking at this time. I've dropped the test for now.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Contributor

mvo5 commented Sep 9, 2016

Looks fine!

+{
+ FILE *file __attribute__ ((cleanup(sc_cleanup_file))) = NULL;
+ debug("opening file describing nvidia driver version");
+ file = fopen(SC_NVIDIA_DRIVER_VERSION_FILE, "rt");
@mvo5

mvo5 Sep 9, 2016

Contributor

Maybe make this look at an environment variable so that you can mock it in the tests?

@zyga

zyga Sep 9, 2016

Collaborator

Yeah, this begs for some more testability. I'm working on improvements but I'd like to land it so that we can release it quickly as well.

@zyga zyga merged commit ae66cb9 into master Sep 9, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@zyga zyga deleted the nvidia-probing branch Sep 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment