From b7affe5264c5405137389e1cd6fbda5cc4208c05 Mon Sep 17 00:00:00 2001 From: Jami Kettunen Date: Tue, 8 Mar 2022 12:20:33 +0200 Subject: [PATCH] lxc-checkconfig: Only check probed modules if /proc/modules exists 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 --- src/lxc/cmd/lxc-checkconfig.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lxc/cmd/lxc-checkconfig.in b/src/lxc/cmd/lxc-checkconfig.in index 13eb77730..8dc620076 100755 --- a/src/lxc/cmd/lxc-checkconfig.in +++ b/src/lxc/cmd/lxc-checkconfig.in @@ -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"