From 0106c6a542aba30443bfc88aede78244dd60fd63 Mon Sep 17 00:00:00 2001 From: Sergey Popovich Date: Mon, 6 Aug 2018 08:38:29 +0300 Subject: [PATCH 1/4] onl-boot-config: Support empty NETAUTO Since empty NETAUTO= in /mnt/onl/boot/boot-config is valud according to rules in initramfs /boot/ifup, follow this behavior in onl-boot-config to get rid of incorrect message: root@localhost:/# onl-boot-config --show NETDEV=ma1 BOOTMODE=INSTALLED SWI=images::latest NETAUTO= The NETAUTO value '' is invalid. The boot configuration has not been changed. Signed-off-by: Sergey Popovich --- .../all/vendor-config-onl/src/python/onl/bootconfig/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py b/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py index f64677ea..1e2ba00c 100755 --- a/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py @@ -191,7 +191,7 @@ class OnlBootConfigNet(OnlBootConfig): if not self.is_ip_address(netdns): raise ValueError("NETDNS=%s is not a valid ip-address" % (netdns)) - elif self.keys['NETAUTO'] not in ['dhcp', 'up']: + elif self.keys['NETAUTO'] not in ['dhcp', 'up', '']: raise ValueError("The NETAUTO value '%s' is invalid." % self.keys['NETAUTO']) elif self.keys['NETAUTO'] == 'up' and self.NET_REQUIRED: raise ValueError("NETAUTO is 'up' but non-local networking is required.") From cdad6627452ecf5559149b6768e0691778c2b308 Mon Sep 17 00:00:00 2001 From: Sergey Popovich Date: Mon, 6 Aug 2018 08:55:13 +0300 Subject: [PATCH 2/4] initrds: ifup: Do not apply any config if NETAUTO=none There are three types of value accepted by NETAUTO: 1) "dhcp" for automatic network settings via DHCP 2) "up" to bring link up, wait for IPv6 tentative and link up operstate 3) anything else: apply static configuration, wait for IPv6 tentative and link up operstate Note that empty ("") value is subset of 3) and we only skip link up operstate monitoring for it since commit 3e89468cd07f ("Don't require link-up on ma1 if NETAUTO is not specified."). Add fourth case with NETAUTO=none to skip all but NETHW (hardware address) from boot-config file and support different management adapter config methods (e.g. Debian network config system). This also fixes incorrect "return" statement usage outside of function introduced with commit 3e89468cd07f ("Don't require link-up on ma1 if NETAUTO is not specified.") and adds newline before wait_link_up() to make code more readable. Signed-off-by: Sergey Popovich --- packages/base/all/initrds/loader-initrd-files/src/bin/ifup | 7 ++++++- .../src/python/onl/bootconfig/__init__.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/ifup b/packages/base/all/initrds/loader-initrd-files/src/bin/ifup index 453a55c9..434b32f5 100644 --- a/packages/base/all/initrds/loader-initrd-files/src/bin/ifup +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/ifup @@ -81,6 +81,9 @@ case "${NETAUTO}" in up) ifconfig "${NETDEV}" up ;; + none) + exit 0 + ;; *) if [ "${NETIP}" ] && [ "${NETMASK}" ] && [ "${NETIP#*/}" = "${NETIP}" ]; then NETIP=${NETIP}/$(ipcalc -p -s ${NETIP} ${NETMASK} | sed -n 's/PREFIX=//p') @@ -118,6 +121,7 @@ for i in $(seq 30); do fi sleep 1 done + wait_link_up() { local intf=$1 @@ -144,4 +148,5 @@ wait_link_up() if [ -n "${NETAUTO}" ]; then wait_link_up $NETDEV 100 fi -return 0 + +exit 0 diff --git a/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py b/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py index 1e2ba00c..e85c9ca0 100755 --- a/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py @@ -191,7 +191,7 @@ class OnlBootConfigNet(OnlBootConfig): if not self.is_ip_address(netdns): raise ValueError("NETDNS=%s is not a valid ip-address" % (netdns)) - elif self.keys['NETAUTO'] not in ['dhcp', 'up', '']: + elif self.keys['NETAUTO'] not in ['dhcp', 'up', 'none', '']: raise ValueError("The NETAUTO value '%s' is invalid." % self.keys['NETAUTO']) elif self.keys['NETAUTO'] == 'up' and self.NET_REQUIRED: raise ValueError("NETAUTO is 'up' but non-local networking is required.") From e2c1fcc3356fb2733179350e83356ed2b2bfa828 Mon Sep 17 00:00:00 2001 From: Sergey Popovich Date: Mon, 6 Aug 2018 09:26:25 +0300 Subject: [PATCH 3/4] initrds: ifup: Move NETRETRIES handling to "dhcp" code path This variable is only required and used for dynamic network configs: validating and configuring it for rest of the paths isn't necessary. While there split warning message to two lines to make code and runtime output more readable. Signed-off-by: Sergey Popovich --- .../initrds/loader-initrd-files/src/bin/ifup | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/ifup b/packages/base/all/initrds/loader-initrd-files/src/bin/ifup index 434b32f5..103318a5 100644 --- a/packages/base/all/initrds/loader-initrd-files/src/bin/ifup +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/ifup @@ -44,18 +44,21 @@ if [ "${NETHW}" ]; then ip link set dev ${NETDEV} addr ${NETHW} fi -# Default DHCP timeout is 10 requests in 10 seconds. -NETRETRIES_DEFAULT=10 -NETRETRIES=${NETRETRIES:-$NETRETRIES_DEFAULT} -if [ "$NETRETRIES" = "infinite" ]; then - NETRETRIES= -elif [ $(echo "$NETRETRIES" | tr -d '[:digit:]') ] || [ "$NETRETRIES" -lt 0 ]; then - echo "Warning: the NETRETRIES setting is currently '$NETRETRIES'. This is invalid and the default value of $NETRETRIES_DEFAULT will be used instead." - NETRETRIES=$NETRETRIES_DEFAULT -fi case "${NETAUTO}" in dhcp|auto) + # Default DHCP timeout is 10 requests in 10 seconds. + NETRETRIES_DEFAULT=10 + NETRETRIES=${NETRETRIES:-$NETRETRIES_DEFAULT} + if [ "$NETRETRIES" = "infinite" ]; then + NETRETRIES= + elif [ $(echo "$NETRETRIES" | tr -d '[:digit:]') ] || [ "$NETRETRIES" -lt 0 ]; then + echo "Warning: the NETRETRIES setting is currently '$NETRETRIES'." + echo "This is invalid and the default value of $NETRETRIES_DEFAULT will be used instead." + NETRETRIES=$NETRETRIES_DEFAULT + fi + echo 1 >/proc/sys/net/ipv6/conf/${NETDEV}/autoconf + if [ -n "${NETRETRIES}" ]; then if ! udhcpc --retries $NETRETRIES --now -i ${NETDEV}; then echo "**********************************************************************" From 82ce4115711c99bc606cd3f94e367b74c1560d6e Mon Sep 17 00:00:00 2001 From: Sergey Popovich Date: Mon, 6 Aug 2018 14:15:45 +0300 Subject: [PATCH 4/4] all-base-packages: Add debconf and dialog First installed as dependency for multiple packages and second is used by debconf, but not installed as it's dependency. This enables package configuration during install or dpkg-reconfigure(7) from debconf. This removes following messages on console during package install: debconf: unable to initialize frontend: Dialog debconf: (No usable dialog-like program is installed, so the dialog \ based frontend cannot be used. at \ /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 11.) debconf: falling back to frontend: Readline Signed-off-by: Sergey Popovich --- builds/any/rootfs/jessie/common/all-base-packages.yml | 2 ++ builds/any/rootfs/stretch/common/all-base-packages.yml | 2 ++ builds/any/rootfs/wheezy/common/all-base-packages.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/builds/any/rootfs/jessie/common/all-base-packages.yml b/builds/any/rootfs/jessie/common/all-base-packages.yml index df5454a8..1307db83 100644 --- a/builds/any/rootfs/jessie/common/all-base-packages.yml +++ b/builds/any/rootfs/jessie/common/all-base-packages.yml @@ -8,6 +8,8 @@ - python - apt - apt-utils +- debconf +- dialog - procps - net-tools - iputils-ping diff --git a/builds/any/rootfs/stretch/common/all-base-packages.yml b/builds/any/rootfs/stretch/common/all-base-packages.yml index 10b69061..746f5dbf 100644 --- a/builds/any/rootfs/stretch/common/all-base-packages.yml +++ b/builds/any/rootfs/stretch/common/all-base-packages.yml @@ -8,6 +8,8 @@ - python - apt - apt-utils +- debconf +- dialog - procps - net-tools - iputils-ping diff --git a/builds/any/rootfs/wheezy/common/all-base-packages.yml b/builds/any/rootfs/wheezy/common/all-base-packages.yml index eec465a1..2cf4931e 100644 --- a/builds/any/rootfs/wheezy/common/all-base-packages.yml +++ b/builds/any/rootfs/wheezy/common/all-base-packages.yml @@ -7,6 +7,8 @@ - python - apt - apt-utils +- debconf +- dialog - procps - net-tools - iputils-ping