From 196499bef27e2a6e7b4f321ed9886f550550044c Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Tue, 21 May 2024 18:56:49 +0200 Subject: [PATCH] - PLD merge: container related fixes --- lib/functions | 3 +++ lib/functions.network | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/functions b/lib/functions index 012f59c..6821022 100644 --- a/lib/functions +++ b/lib/functions @@ -1028,6 +1028,9 @@ confirm() { # module is needed (ie. is requested, is available and isn't loaded already) is_module() { + # fail if /sbin/lsmod does not exists (ex. in containers) + [ -x /sbin/lsmod ] || return 1 + # module name without .o at end if ! lsmod | grep -q "$1"; then if ls -1R /lib/modules/$(uname -r)/ 2> /dev/null | grep -q "^${1}.\(\|k\)o\(\|.gz\)"; then diff --git a/lib/functions.network b/lib/functions.network index b4ea5d0..ad930e3 100644 --- a/lib/functions.network +++ b/lib/functions.network @@ -345,7 +345,8 @@ setup_routes() # Add ONLY IPv4 address (IPv6 address is added automaticly) set_up_loopback() { - if is_yes "$IPV4_NETWORKING"; then + # test if addr is assigned already as lxd(lxc?) initializes loopback upfront + if is_yes "$IPV4_NETWORKING" && ! ip addr show lo | grep -q "127\.0\.0\.1"; then ip addr add 127.0.0.1/8 dev lo fi ip link set dev lo up -- 2.46.0