]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
Container related fixes
authormis <mis@pld-linux.org>
Sat, 11 Sep 2021 11:56:05 +0000 (13:56 +0200)
committerJan Rękorajski <baggins@pld-linux.org>
Sat, 11 Sep 2021 11:56:05 +0000 (13:56 +0200)
- check lsmod existence before use
- check if loopback has assigned address already (lxd initializes loopback upfront)

lib/functions
lib/functions.network

index 3b97077b83460518fc0494032e3c89f94aac719a..d1b6c1eb7c994b98a527aa597d30075c12446d7e 100644 (file)
@@ -1093,6 +1093,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
index 867c2d6e2d803a69f89d9aecda2a9240b5ff3080..3cd4878680d07cfb00ad7fcc1e6e44bbd9a328c6 100644 (file)
@@ -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
This page took 0.431508 seconds and 4 git commands to generate.