Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 553372 - sys-apps/kexec-tools-2.0.9-r1: Check for /nokexec or runlevel before LOAD_DURING_SHUTDOWN
Summary: sys-apps/kexec-tools-2.0.9-r1: Check for /nokexec or runlevel before LOAD_DUR...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Low minor (vote)
Assignee: Justin Lecher (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-27 00:02 UTC by aayla.secura.1138
Modified: 2015-06-29 07:49 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Suggested patch for /etc/init.d/kexec (kexec.patch,1.00 KB, patch)
2015-06-27 00:02 UTC, aayla.secura.1138
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description aayla.secura.1138 2015-06-27 00:02:46 UTC
Created attachment 405822 [details, diff]
Suggested patch for /etc/init.d/kexec

In the stop() function of /etc/init.d/kexec the check for LOAD_DURING SHUTDOWN is performed before checking RC_REBOOT and /nokexec - hence if the image has already been loaded (LOAD_DURING_SHUTDOWN == "no") then manually stopping kexec does not unload the image. Was this the intention, it shouldn't be.

And another minor issue: DONT_MOUNT_BOOT is not checked against actual value, merely if it is set or no. I'm uploading a suggested patch:

--- a/etc/init.d/kexec	2015-05-31 01:52:47.000000000 +1000
+++ a/etc/init.d/kexec	2015-06-27 09:44:49.606644040 +1000
@@ -45,21 +45,21 @@
 			return 0
 		fi
 	done
 
 	return 1
 }
 
 mount_boot(){
 	local ret
 
-	[ -n "${DONT_MOUNT_BOOT}" ] && return 1
+	[ "${DONT_MOUNT_BOOT:-no}" = "no" ] || return 1
 	grep -q " ${BOOTPART:-/boot} " /proc/mounts && return 1
 
 	BOOTPART="${BOOTPART:-/boot}"
 	ebegin "Mounting ${BOOTPART}"
 	mount "${BOOTPART}"; ret=$?
 	eend ${ret}
 	return ${ret}
 }
 
 load_image() {
@@ -137,29 +137,29 @@
 		fi
 		return ${ret}
 	else
 		ebegin "Configuring kexec"
 		load_image
 		eend $?
 	fi
 }
 
 stop() {
-	[ "${LOAD_DURING_SHUTDOWN:-yes}" != "yes" ] && return 0
-
 	if ! yesno $RC_REBOOT; then
 		einfo "Not rebooting, so disabling"
 		kexec -u
 		return 0
 	fi
 
 	if [ -f /nokexec ]; then
 		einfo "Not using kexec during reboot"
 		rm -f /nokexec
 		kexec -u
 		return 0
 	fi
 
+	[ "${LOAD_DURING_SHUTDOWN:-yes}" != "yes" ] && return 0
+
 	ebegin "Configuring kexec"
 	load_image
 	eend $?
 }
Comment 1 Justin Lecher (RETIRED) gentoo-dev 2015-06-29 07:49:40 UTC
+*kexec-tools-2.0.9-r2 (29 Jun 2015)
+
+  29 Jun 2015; Justin Lecher <jlec@gentoo.org> +files/kexec.init-2.0.4-r3,
+  +kexec-tools-2.0.9-r2.ebuild:
+  Correctly handle loaded image during reboot with LOAD_DURING_SHUTDOWN, bug
+  #553372; thanks AaylaSecura for the patch
+