Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 412039 - sys-apps/kexec-tools-2.0.3-r1 doesn't work if not using initrd and /boot is not a separate filesystem
Summary: sys-apps/kexec-tools-2.0.3-r1 doesn't work if not using initrd and /boot is n...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Justin Lecher (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-14 23:47 UTC by Christer Ekholm
Modified: 2013-03-27 11:51 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christer Ekholm 2012-04-14 23:47:40 UTC
/etc/init.d/kexec tries to mount /boot if there is no initrd, and if
/boot is not on a separate filesystem that obviously fails.


$ df /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       905M  693M  166M  81% /

Example using kexec -d stop

++ local img=/boot/vmlinuz-3.3.2 initrd= mounted=false initrdopt=
++ [[ -z /boot/vmlinuz-3.3.2 ]]
++ [[ -z '' ]]
++ grep -q ' /boot ' /proc/mounts
++ ebegin 'Mounting /boot'
 * Mounting /boot ...
++ mount /boot
mount: can't find /boot in /etc/fstab or /etc/mtab
++ eend 1



I can make it work on my machine by just removing the test for initrd
in load_image() like this:

--- /usr/portage/sys-apps/kexec-tools/files/kexec.init-2.0.3	2012-03-18 08:46:02.000000000 +0100
+++ /etc/init.d/kexec	2012-04-15 01:30:08.000000000 +0200
@@ -50,7 +50,7 @@
 	BOOTPART="${BOOTPART:-/boot}"
 	local img="$(image_path)" initrd="$(initrd_path)" mounted=false initrdopt=
 
-	if [[ -z "${img}" ]] || [[ -z "${initrd}" ]]; then
+	if [[ -z "${img}" ]]; then
 		# If we cannot find our image, try mounting ${BOOTPART}
 		if ! grep -q " ${BOOTPART} " /proc/mounts; then
 			ebegin "Mounting ${BOOTPART}"


Reproducible: Always
Comment 1 Justin Lecher (RETIRED) gentoo-dev 2012-04-23 20:14:01 UTC
thanks for the report, I did put it on the list.
Comment 2 Andrew Savchenko gentoo-dev 2012-07-25 12:56:54 UTC
Can this trivial patch be put in portage?
kexec failures are really annoying.
Comment 3 Christer Ekholm 2012-07-25 17:13:29 UTC
(In reply to comment #2)
> Can this trivial patch be put in portage?
> kexec failures are really annoying.

No, thats would be bad for anyone having a separate /boot, but not
currently mounted. The real fix have to be smarter.
Comment 4 Andrew Savchenko gentoo-dev 2012-07-25 17:34:08 UTC
(In reply to comment #3)
> No, thats would be bad for anyone having a separate /boot, but not
> currently mounted. The real fix have to be smarter.

Sorry, I don't understand how. If someone have a separate /boot, then
both kernel image and initrd should be there. This patch omits only
initrd check and keeps kernel image check.

For Gentoo it is very natural not to use initrd at all, because most
user kernels are custom build kernels, and obviously you do not need
initrd if you build your own hardware specific kernel except for several
really rare cases.
Comment 5 Christer Ekholm 2012-07-25 17:46:08 UTC
(In reply to comment #4)
> Sorry, I don't understand how. If someone have a separate /boot, then
> both kernel image and initrd should be there. This patch omits only
> initrd check and keeps kernel image check.

I think you are right.  Then the real test should be with and instead
of or.

 if [[ -z "${img}" ]] && [[ -z "${initrd}" ]]

> 
> For Gentoo it is very natural not to use initrd at all, because most
> user kernels are custom build kernels, and obviously you do not need
> initrd if you build your own hardware specific kernel except for several
> really rare cases.

Agree I have never needed a initrd.
Comment 6 Andrew Savchenko gentoo-dev 2012-07-25 17:52:00 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Sorry, I don't understand how. If someone have a separate /boot, then
> > both kernel image and initrd should be there. This patch omits only
> > initrd check and keeps kernel image check.
> 
> I think you are right.  Then the real test should be with and instead
> of or.
> 
>  if [[ -z "${img}" ]] && [[ -z "${initrd}" ]]

Hmm, formally it will work fine in my case, so I don't mind. But I can't
imagine a case where kernel image is not available, but initrd is.
Comment 7 Christer Ekholm 2012-07-25 18:05:34 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #4)
> > > Sorry, I don't understand how. If someone have a separate /boot, then
> > > both kernel image and initrd should be there. This patch omits only
> > > initrd check and keeps kernel image check.
> > 
> > I think you are right.  Then the real test should be with and instead
> > of or.
> > 
> >  if [[ -z "${img}" ]] && [[ -z "${initrd}" ]]
> 
> Hmm, formally it will work fine in my case, so I don't mind. But I can't
> imagine a case where kernel image is not available, but initrd is.

Hmm, I changed my mind again.  :) That test would be bad for someone
having a separate /boot but no initrd in it. Back to just testing for
${img} again. That is the best solution.
Comment 8 Justin Lecher (RETIRED) gentoo-dev 2013-03-27 11:51:08 UTC
+*kexec-tools-2.0.4 (27 Mar 2013)
+
+  27 Mar 2013; Justin Lecher <jlec@gentoo.org> files/kexec.init-2.0.3,
+  +files/kexec.conf-2.0.4, +files/kexec.init-2.0.4, +kexec-tools-2.0.4.ebuild,
+  +files/kexec-tools-2.0.4-disable-kexec-test.patch, metadata.xml:
+  Version BUmp; drop bashism from initscript, #447548; enhanced detection of
+  kernel and initrd image, #412039
+