[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#858013: marked as done (live-config: URLs with http scheme don't work any longer for boot parameters debconf-preseed and hooks)



Your message dated Fri, 23 Jun 2017 12:36:11 +0000
with message-id <E1dONop-000El3-Tg@fasolo.debian.org>
and subject line Bug#858013: fixed in live-config 5.20170623
has caused the Debian Bug report #858013,
regarding live-config: URLs with http scheme don't work any longer for boot parameters debconf-preseed and hooks
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
858013: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=858013
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
Source: live-config
Source-Version: 5.20170623

We believe that the bug you reported is fixed in the latest version of
live-config, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 858013@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Raphaël Hertzog <hertzog@debian.org> (supplier of updated live-config package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Fri, 23 Jun 2017 14:15:17 +0200
Source: live-config
Binary: live-config live-config-doc live-config-systemd live-config-sysvinit
Architecture: source
Version: 5.20170623
Distribution: unstable
Urgency: medium
Maintainer: Live Systems Maintainers <debian-live@lists.debian.org>
Changed-By: Raphaël Hertzog <hertzog@debian.org>
Description:
 live-config - Live System Configuration Components
 live-config-doc - Live System Configuration Components (documentation)
 live-config-systemd - Live System Configuration Components (systemd backend)
 live-config-sysvinit - Live System Configuration Components (sysvinit backend)
Closes: 827665 855085 858013
Changes:
 live-config (5.20170623) unstable; urgency=medium
 .
   * Drop "Before=udev.service" in live-config-systemd.service as it
     breaks the boot process when you have multiple partitions mounted
     as part of local-fs.target. Closes: #827665, #855085
   * Move Setup_network definition to a shared file and include it
     where it is needed. Closes: #858013
Checksums-Sha1:
 53bb6164047034e2f382a2fe29dd50c53d2ad052 1674 live-config_5.20170623.dsc
 aa71b9627b4380a95031ca33194f6f36f65bca1d 75220 live-config_5.20170623.tar.xz
 75275884affc4a5071db55d66250eadea3978a9c 5357 live-config_5.20170623_source.buildinfo
Checksums-Sha256:
 04b4647115547a8e31115f3b10e346881f6c0cd4019a38bac16468f5f58cecbb 1674 live-config_5.20170623.dsc
 ea45c026f17fb582a82ce8143d4f76ace442f23efa8b129dc8818d8263b3414d 75220 live-config_5.20170623.tar.xz
 99dfd33d13b22f89635b1dd945e29ed3afbae8e14b036271eb0afa535807cf23 5357 live-config_5.20170623_source.buildinfo
Files:
 a9043710a347d826d70bc380c8421dbe 1674 misc optional live-config_5.20170623.dsc
 4b6bdc904534bbc76c1eaef44cd73845 75220 misc optional live-config_5.20170623.tar.xz
 6ac37b3f8d91db50a146dcf6c7086249 5357 misc optional live-config_5.20170623_source.buildinfo

-----BEGIN PGP SIGNATURE-----
Comment: Signed by Raphael Hertzog

iQEzBAEBCgAdFiEE1823g1EQnhJ1LsbSA4gdq+vCmrkFAllNBsAACgkQA4gdq+vC
mrnyKQf/bik+Q08I5FVVk2FiDF9BnSwI1ej++FW5Q8veTkKfuLZwLfGR01O5UB9c
YzX+Fi7W9Vx46+mkQTdTJSV3QWjDiMwjD0C9sq4FfNx0nZBU8L+MqQtjYawG+Irs
P0VwFaYlxMPGw+6zMcwSF8mXEGYHBvUvvBjBPXjkgqElCm8Yk8rl5yOwyeSYG6la
8kCgWwkz/dODYnrrieuQqQugP68iFf5iC+npOR/CWWXO2xfa1QmAwpLedmqurznT
QyDWWaI7acpStJ+QHAlVcMmebLDlC91kHjGFCuDyTlLG8+EROdx3Z7fWSYFIawLS
wplTNA3eosRDJThpT6DNMDkmSnPhqw==
=aZqg
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: