#1567 PR merged: Fix copying kernel modules when module aliases are present

Labels: enhancement, bug, fixed / solved / done

OliverO2 opened issue at 2017-11-07 18:15:

ReaR fails to find kernel modules, where aliases are present. For example, the nVidia video driver modules on Ubuntu 16.04 LTS use aliases like this: nvidia_uvm -> nvidia_384_uvm, making rear -v mkrescue produce error messages like this:

Copying only currently loaded kernel modules (MODULES contains 'loaded_modules')
ERROR: nvidia_uvm loaded but no module file?
Aborting due to an error[...]

This PR fixes the module lookup code. It uses modprobe to check for aliased modules. If the modprobe version installed does not support alias resolution via -R, the new code will silently fall back to the old behavior (i.e. no alias resolution).

jsmeix commented at 2017-11-08 11:02:

many thanks for your contribution - and
even more thanks for your perfect explanation
what the issue is about and how you fixed it
so that it is a pleasure for me to "just merge" it.

And on top of that now I even got an example
why I had implemented tests like

            # Can it really happen that a module exists (which is tested above) but 'modinfo -F filename' cannot show its filename?
            # To be on the safe side there is a test even for for such a possibly weird error here:
            module_files="$( modinfo_filename $module || Error "$module exists but no module file?" )"

which nicely proves that tests even for possibly weird errors
(that the developer could not imagine to actually happen)
are "the right way" to implement things.

jsmeix commented at 2017-11-08 11:35:

I explained now how it can happen that 'modinfo -F filename'
cannot show a module filename (when the modprobe command
does not support resolving module aliases via '-R').

OliverO2 commented at 2017-11-08 12:04:

@jsmeix Thank you for your kind words and the quick merge!

[Export of Github issue for rear/rear.]