]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-checkconfig: Only check probed modules if /proc/modules exists 4091/head
authorJami Kettunen <jami.kettunen@protonmail.com>
Tue, 8 Mar 2022 10:20:33 +0000 (12:20 +0200)
committerJami Kettunen <jami.kettunen@protonmail.com>
Tue, 8 Mar 2022 10:37:08 +0000 (12:37 +0200)
Kernels can be built with CONFIG_MODULES=n which results in
is_probed() telling the module isn't probed and lsmod spamming the
following to stderr each time it's called:

  libkmod: kmod_module_new_from_loaded: could not open /proc/modules: No such file or directory
  Error: could not get list of modules: No such file or directory

Fix this by "stubbing" is_probed() when /proc/modules doesn't exist
as it's always called after a is_enabled() anyway.

Signed-off-by: Jami Kettunen <jami.kettunen@protonmail.com>
src/lxc/cmd/lxc-checkconfig.in

index 13eb777302e30fefd7ea89a3ac3eff04743dc4b5..8dc620076fcfa1b08d50b77374f59d78b3c1662f 100755 (executable)
@@ -58,6 +58,9 @@ has_cgroup_ns() {
 }
 
 is_probed() {
+    if [ ! -f /proc/modules ]; then
+        return
+    fi
     lsmod | grep $1 > /dev/null
     if [ $? -eq 0 ]; then
         echo -n ", loaded"