From: Jami Kettunen Date: Tue, 8 Mar 2022 10:20:33 +0000 (+0200) Subject: lxc-checkconfig: Only check probed modules if /proc/modules exists X-Git-Tag: lxc-5.0.0~28^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7affe5264c5405137389e1cd6fbda5cc4208c05;p=thirdparty%2Flxc.git 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 --- 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"