[SRU][canonical-kernel-snaps][PATCH 0/1] nvidia_hooks: replace uname -r calls

Aaron Jauregui aaron.jauregui at canonical.com
Thu Jun 5 02:55:41 UTC 2025


BugLink: https://bugs.launchpad.net/bugs/2111937

[Impact]
It was previously assumed that the currently running kernel corresponds to
the parent kernel snap of the component being installed/refreshed. This
does not necessarily hold true. Modules were found to be installed in the
previous kernel snap's path in some cases, particularly after a refresh.
This causes the modules to not be found by depmod and thus the drivers
to not being installed.

[Fix]
Replace uname -r to grab the parent kernel snap's kernel version string
with getting it from the snap's filesystem with basename "$SNAP"/modules/*

[Test case]
Built and booted pc-kernel with updated scripts, and tested the resolved
path for nvidia-550-erd-ko and nouveau components on install and
refresh.

[Where things could go wrong]
The method for grabbing the kernel version string relies on having the
kernel snap contain /modules/<kernel_version>. Removing this would break
component install hooks. Having multiple entries in this directory would
break the script as well. These scenarios are unlikely due to the
pc-kernel only ever corresponding to a single kernel version.

Aaron Jauregui (1):
  nvidia_hooks: replace uname -r calls

 hooks/module/install.module            | 7 +++++--
 hooks/module/post-refresh.module       | 7 +++++--
 hooks/module/remove.module             | 6 ++++--
 hooks/nvidia-ko/install.nvidia-ko      | 9 ++++++---
 hooks/nvidia-ko/post-refresh.nvidia-ko | 9 ++++++---
 hooks/nvidia-ko/remove.nvidia-ko       | 5 ++++-
 6 files changed, 30 insertions(+), 13 deletions(-)

-- 
2.43.0




More information about the kernel-team mailing list