You are not logged in.

#1 2021-05-30 00:37:47

TheDcoder
Member
Registered: 2020-06-06
Posts: 121
Website

modprobe fails to remove nvidia modules after system/kernel upgrade

Hi,

I have a strange issue where modprobe fails to remove nvidia's modules, but only after doing a full system upgrade (which also updates the kernel)... it works like a charm otherwise.

This is the command which I am using:

modprobe -r -v nvidia_drm nvidia_modeset nvidia_uvm nvidia

It simply fails (exit code 1) with no output :-/

I experimented with rmmod and it worked correctly in the same situation (except for returning an error for a module which was not loaded), so what's wrong with modprobe?

P.S I made sure that nothing is actively using those modules, including closing any running X servers before removing them.

Offline

#2 2021-05-30 01:09:12

loqs
Member
Registered: 2014-03-06
Posts: 18,917

Re: modprobe fails to remove nvidia modules after system/kernel upgrade

It calls kmod_module_new_from_lookup to resolve the module's name and that fails attempting to access the modules.dep and modules.symbols for the running kernel which have now been removed.

Offline

#3 2021-05-30 01:18:39

TheDcoder
Member
Registered: 2020-06-06
Posts: 121
Website

Re: modprobe fails to remove nvidia modules after system/kernel upgrade

That's very interesting, but why is the kernel depending on external files for lookup? (I assume `kmod_module_new_from_lookup` is a kernel function)

Also, how is rmmod able to do the job without those files? Why isn't modprobe using the more robust method?

Offline

#4 2021-05-30 01:29:26

loqs
Member
Registered: 2014-03-06
Posts: 18,917

Re: modprobe fails to remove nvidia modules after system/kernel upgrade

kmod_module_new_from_lookup is a function in kmod see https://git.kernel.org/pub/scm/utils/ke … h=v29#n509
The code is shared among other utilities such as modinfo which works on kernels that are not loaded.

rmmod does no resolution on the supplied name so does not need to perform any lookups related to the name.

Offline

#5 2021-05-30 01:35:47

TheDcoder
Member
Registered: 2020-06-06
Posts: 121
Website

Re: modprobe fails to remove nvidia modules after system/kernel upgrade

Thanks for the information.

loqs wrote:

rmmod does no resolution on the supplied name so does not need to perform any lookups related to the name.

I see, but the supplied name does not change in both cases... maybe modprobe should fallback to unresolved names in case the lookup fails smile

Offline

#6 2021-05-30 01:45:29

loqs
Member
Registered: 2014-03-06
Posts: 18,917

Re: modprobe fails to remove nvidia modules after system/kernel upgrade

TheDcoder wrote:

Thanks for the information.

loqs wrote:

rmmod does no resolution on the supplied name so does not need to perform any lookups related to the name.

I see, but the supplied name does not change in both cases... maybe modprobe should fallback to unresolved names in case the lookup fails smile

The name sent to the kernel is the actual module name while modprobe can accept aliases e.t.c..
You could send upstream a patch.  I would expect it would be rejected as you are ignoring the following

man 8 modprobe wrote:

modprobe expects an up-to-date modules.dep.bin file as generated by the corresponding depmod utility shipped along with modprobe (see  depmod(8)). This file lists what other modules each module needs (if any), and modprobe uses this to add or move these dependencies automatically.

Also as you yourself pointed out,  rmmod meets your requirements and adding special case code increases the maintenance burden as there are more cases to test.

Offline

#7 2021-05-30 01:48:41

TheDcoder
Member
Registered: 2020-06-06
Posts: 121
Website

Re: modprobe fails to remove nvidia modules after system/kernel upgrade

I finally know what depmod does!

Oh well, you are right, I should switch to rmmod... the only minor problem I have with it is the inability to handle multiple modules at once (and possibly ignore unloaded modules).

Offline

Board footer

Powered by FluxBB