Package: live-config
Version: 5.20170112
Severity: normal

Dear Maintainer,

using the next official Debian Live iso images I would like to have 
functionality for boot parameters live-config.debconf-preseed and 
live-config.hooks revived (fetching files by using wget fetchable URLs with 
http scheme, see 
https://manpages.debian.org/testing/live-config-doc/live-config.7.en.html for 
reference).

This does not work any longer (see /proc/cmdline and /var/log/live/config.log 
excerpt of an testing/stretch based live-build environment below):
user@debian:~$ cat /proc/cmdline
BOOT_IMAGE=/live/vmlinuz boot=live components 
live-config.debconf-preseed=http://10.19.27.243:8080/hook1.sh 
live-config.hooks=http://10.19.27.243:8080/hook2.sh initrd=/live/initrd.img
user@debian:~$ grep -e debconf -e hooks /var/log/live/config.log
live-config: debconf/lib/live/config/0010-debconf: 78: 
/lib/live/config/0010-debconf: Setup_network: not found
 keyboard-configuration anacron util-linux login openssh-server 
hooks/lib/live/config/9990-hooks: 71: /lib/live/config/9990-hooks: 
Setup_network: not found

The easiest (and my preferred) way to solve this issue is to move the start of 
the whole live-config phase to a point where systemd has reached network.target 
(solution proposal 1, see git-diff below). As this proposal potentially may 
cause systemd-related problems during the boot phase a probably more reasonable 
approach for you might be to stay on systemd local-fs.target, to adapt 
definition of function Setup_network in /bin/live-config and to add it to 
/lib/live/config/0010-debconf and /lib/live/config/9990-hooks (solution 
proposal 2, see git-diff below). Please consider benevolent either taking over 
one of both proposals or provide a better solution during next cycle of 
live-config source code changes.

-- solution proposal 1:
diff --git a/backend/systemd/live-config.systemd 
b/backend/systemd/live-config.systemd
index ed7069b..d81dade 100644
--- a/backend/systemd/live-config.systemd
+++ b/backend/systemd/live-config.systemd
@@ -9,8 +9,8 @@
 [Unit]
 Description=live-config contains the components that configure a live system 
during the boot process (late userspace).
 Documentation=man:live-config
-Before=basic.target udev.service
-After=local-fs.target
+Before=basic.target
+After=network.target
 DefaultDependencies=no
 ConditionPathExists=/bin/live-config
 ConditionKernelCommandLine=boot=live
diff --git a/components/0010-debconf b/components/0010-debconf
index b579941..a6a6d4a 100755
--- a/components/0010-debconf
+++ b/components/0010-debconf
@@ -75,9 +75,7 @@ Config ()
                        cp $(echo ${_PRESEED} | sed 's|file://||') "${_TMPFILE}"
                else
                        # remote file
-                       Setup_network
-
-                       wget --quiet "${_PRESEED}" -O "${_TMPFILE}"
+                       wget "${_PRESEED}" -O "${_TMPFILE}"
                fi
 
                debconf-set-selections < "${_TMPFILE}"
diff --git a/components/9990-hooks b/components/9990-hooks
index 26d071d..072ffb2 100755
--- a/components/9990-hooks
+++ b/components/9990-hooks
@@ -68,9 +68,7 @@ Config ()
                        cp $(echo ${_HOOK} | sed 's|file://||') "${_TMPFILE}"
                else
                        # remote file
-                       Setup_network
-
-                       wget --quiet "${_HOOK}" -O "${_TMPFILE}"
+                       wget "${_HOOK}" -O "${_TMPFILE}"
                fi
 
                chmod 0755 "${_TMPFILE}"

-- solution proposal 2:
diff --git a/components/0010-debconf b/components/0010-debconf
index b579941..c962556 100755
--- a/components/0010-debconf
+++ b/components/0010-debconf
@@ -10,6 +10,78 @@
 
 #set -e
 
+Setup_network ()
+{
+       if [ -z "${_NETWORK}" ] && ( [ -e /etc/init.d/live-config ] || [ -e 
/lib/systemd/system/live-config.service ] )
+       then
+               /etc/init.d/mountkernfs.sh start > /dev/null 2>&1
+               /etc/init.d/mountdevsubfs.sh start > /dev/null 2>&1
+               /etc/init.d/networking start > /dev/null 2>&1
+
+               # Now force adapter up if specified with either BOOTIF= or 
ethdevice= on cmdline
+               for _PARAMETER in ${LIVE_CONFIG_CMDLINE}
+               do
+                       case "${_PARAMETER}" in
+                               BOOTIF=*)
+                                       BOOTIF="${_PARAMETER#*BOOTIF=}"
+                                       ;;
+                               ethdevice=*)
+                                       ETHDEVICE="${_PARAMETER#*ethdevice=}"
+                                       ;;
+                       esac
+               done
+               if [ -n "${BOOTIF}" ]
+               then
+                       # pxelinux sets BOOTIF to a value based on the mac 
address of the
+                       # network card used to PXE boot, so use this value for 
DEVICE rather
+                       # than a hard-coded device name from initramfs.conf. 
this facilitates
+                       # network booting when machines may have multiple 
network cards.
+                       # pxelinux sets BOOTIF to 01-$mac_address
+
+                       # strip off the leading "01-", which isn't part of the 
mac
+                       # address
+                       temp_mac=${BOOTIF#*-}
+
+                       # convert to typical mac address format by replacing 
"-" with ":"
+                       bootif_mac=""
+                       IFS='-'
+                       for x in $temp_mac
+                       do
+                               if [ -z "$bootif_mac" ]
+                               then
+                                       bootif_mac="$x"
+                               else
+                                       bootif_mac="$bootif_mac:$x"
+                               fi
+                       done
+                       unset IFS
+
+                       # look for devices with matching mac address, and set 
DEVICE to
+                       # appropriate value if match is found.
+
+                       for device in /sys/class/net/*
+                       do
+                               if [ -f "$device/address" ]
+                               then
+                                       current_mac=$(cat "$device/address")
+
+                                       if [ "$bootif_mac" = "$current_mac" ]
+                                       then
+                                               ifup --force "${device##*/}"
+                                               break
+                                       fi
+                               fi
+                       done
+               elif [ -n "${ETHDEVICE}" ]
+               then
+                       ifup --force "${ETHDEVICE}"
+               fi
+
+               _NETWORK="true"
+               export _NETWORK
+       fi
+}
+
 Cmdline ()
 {
        # Reading kernel command line
@@ -77,7 +149,7 @@ Config ()
                        # remote file
                        Setup_network
 
-                       wget --quiet "${_PRESEED}" -O "${_TMPFILE}"
+                       wget "${_PRESEED}" -O "${_TMPFILE}"
                fi
 
                debconf-set-selections < "${_TMPFILE}"
diff --git a/components/9990-hooks b/components/9990-hooks
index 26d071d..c1bbc62 100755
--- a/components/9990-hooks
+++ b/components/9990-hooks
@@ -10,6 +10,78 @@
 
 #set -e
 
+Setup_network ()
+{
+       if [ -z "${_NETWORK}" ] && ( [ -e /etc/init.d/live-config ] || [ -e 
/lib/systemd/system/live-config.service ] )
+       then
+               /etc/init.d/mountkernfs.sh start > /dev/null 2>&1
+               /etc/init.d/mountdevsubfs.sh start > /dev/null 2>&1
+               /etc/init.d/networking start > /dev/null 2>&1
+
+               # Now force adapter up if specified with either BOOTIF= or 
ethdevice= on cmdline
+               for _PARAMETER in ${LIVE_CONFIG_CMDLINE}
+               do
+                       case "${_PARAMETER}" in
+                               BOOTIF=*)
+                                       BOOTIF="${_PARAMETER#*BOOTIF=}"
+                                       ;;
+                               ethdevice=*)
+                                       ETHDEVICE="${_PARAMETER#*ethdevice=}"
+                                       ;;
+                       esac
+               done
+               if [ -n "${BOOTIF}" ]
+               then
+                       # pxelinux sets BOOTIF to a value based on the mac 
address of the
+                       # network card used to PXE boot, so use this value for 
DEVICE rather
+                       # than a hard-coded device name from initramfs.conf. 
this facilitates
+                       # network booting when machines may have multiple 
network cards.
+                       # pxelinux sets BOOTIF to 01-$mac_address
+
+                       # strip off the leading "01-", which isn't part of the 
mac
+                       # address
+                       temp_mac=${BOOTIF#*-}
+
+                       # convert to typical mac address format by replacing 
"-" with ":"
+                       bootif_mac=""
+                       IFS='-'
+                       for x in $temp_mac
+                       do
+                               if [ -z "$bootif_mac" ]
+                               then
+                                       bootif_mac="$x"
+                               else
+                                       bootif_mac="$bootif_mac:$x"
+                               fi
+                       done
+                       unset IFS
+
+                       # look for devices with matching mac address, and set 
DEVICE to
+                       # appropriate value if match is found.
+
+                       for device in /sys/class/net/*
+                       do
+                               if [ -f "$device/address" ]
+                               then
+                                       current_mac=$(cat "$device/address")
+
+                                       if [ "$bootif_mac" = "$current_mac" ]
+                                       then
+                                               ifup --force "${device##*/}"
+                                               break
+                                       fi
+                               fi
+                       done
+               elif [ -n "${ETHDEVICE}" ]
+               then
+                       ifup --force "${ETHDEVICE}"
+               fi
+
+               _NETWORK="true"
+               export _NETWORK
+       fi
+}
+
 Cmdline ()
 {
        # Reading kernel command line
@@ -70,7 +142,7 @@ Config ()
                        # remote file
                        Setup_network
 
-                       wget --quiet "${_HOOK}" -O "${_TMPFILE}"
+                       wget "${_HOOK}" -O "${_TMPFILE}"
                fi
 
                chmod 0755 "${_TMPFILE}"


-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 4.9.0-2-686-pae (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages live-config depends on:
ii  live-config-systemd [live-config-backend]  5.20170112

Versions of packages live-config recommends:
ii  iproute2                4.9.0-1
ii  keyboard-configuration  1.160
ii  live-config-doc         5.20170112
ii  live-tools              1:20151214+nmu1
ii  locales                 2.24-9
ii  sudo                    1.8.19p1-1
ii  user-setup              1.67

Versions of packages live-config suggests:
ii  pciutils  1:3.5.2-1
ii  wget      1.18-4.1

-- no debconf information

Reply via email to