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

Bug#795833: marked as done (initramfs-tools: add mountroot failure support to allow meaningful messages and recovery attempts)



Your message dated Mon, 04 Feb 2019 00:00:40 +0100
with message-id <96f44f725add240bf6d701904bf26749a3afa522.camel@decadent.org.uk>
and subject line Re: initramfs-tools: add mountroot failure support to allow meaningful messages and recovery attempts
has caused the Debian Bug report #795833,
regarding initramfs-tools: add mountroot failure support to allow meaningful messages and recovery attempts
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.)


-- 
795833: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=795833
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: initramfs-tools
Version: 0.120
Severity: normal

Allow hooks to supply specific root mount failure handlers.  These can
both report more specific failure reasons, and in some cases may even be
able to attempt recovery.  This is useful for more complex scenarios
such as LVM and mdadm setups.

We use this in Ubuntu to allow augmented lvm2 and mdadm hooks to recover
failed raids and the like.

NOTE: that the splash handling here may well be Ubuntu specific.

-apw
>From 2f96b329734edeb03d769da83cce1dc06e6c81bb Mon Sep 17 00:00:00 2001
From: Andy Whitcroft <apw@canonical.com>
Date: Mon, 25 Jun 2012 12:13:07 +0100
Subject: [PATCH] Add mountroot failure support, to allow meaningful messages
 when no root device can be found.

Signed-off-by: Andy Whitcroft <apw@ubuntu.com>
---
 docs/example_script | 13 +++++++++++++
 initramfs-tools.8   | 14 ++++++++++++++
 scripts/functions   | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+)

diff --git a/docs/example_script b/docs/example_script
index 5e9153b..93d1135 100644
--- a/docs/example_script
+++ b/docs/example_script
@@ -26,10 +26,23 @@ prereqs)
 	prereqs
 	exit 0
 	;;
+mountfail) # Called if the script has previously registered a mountroot
+           # failure.
+	# Check status, and display any relevant information about the
+	# failure if there is a problem, then exit with a status of 1.
+	;;
 esac
 
 # Do the work here.
 
+# If this script is to be placed in either init-premount, or local-top,
+# register a mountroot failure hook, so that further information can be given
+# to the user, in the event that the root device cannot be found.
+
+. /scripts/functions
+
+add_mountroot_fail_hook
+
 echo "Got here!"
 
 exit 0
diff --git a/initramfs-tools.8 b/initramfs-tools.8
index ea8c098..4f873b1 100644
--- a/initramfs-tools.8
+++ b/initramfs-tools.8
@@ -387,6 +387,20 @@ user to investigate the situation.
 .PP
 .B Example:
 panic "Frobnication failed"
+.fi
+.RE
+.RE
+
+.TP
+\fB\fI
+add_mountroot_fail_hook
+Registers the script as able to provide possible further information, in the
+event that the root device cannot be found. See the example script in the
+initramfs-tools examples directory for more information.
+.RS
+.PP
+.B Example:
+add_mountroot_fail_hook
 .RE
 
 .SS Subdirectories
diff --git a/scripts/functions b/scripts/functions
index 073fcb3..74083ed 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -31,6 +31,42 @@ log_end_msg()
 	_log_msg "done.\n"
 }
 
+# Add failure hook
+add_mountroot_fail_hook()
+{
+	mkdir -p /tmp/mountroot-fail-hooks.d
+	ln -s "$0" /tmp/mountroot-fail-hooks.d/"$1"
+}
+
+# Run failure hooks.
+# When a failure hook exits "1", it has not done anything to correct the
+# system.  Exiting "0" means that something has been attempted to resolve
+# the lack of a root filesystem.
+# Hooks are run in lexigraphical order, and are responsible for removing
+# themselves if they should not re-run in a later cycle.  When one exits
+# "0", the stack is stopped, so the caller can return to the main rootfs
+# wait loop.
+try_failure_hooks()
+{
+	local hook
+
+	# Disable usplash so text from hooks can be seen
+	if [ -x /sbin/usplash_write ]; then
+		/sbin/usplash_write "QUIT"
+	fi
+	chvt 1
+	if [ -x /bin/plymouth ] && plymouth --ping; then
+		/bin/plymouth hide-splash > /dev/null 2>&1
+	fi
+
+	for hook in /tmp/mountroot-fail-hooks.d/*; do
+		if [ -x ${hook} ] && ${hook} mountfail; then
+			return 0
+		fi
+	done
+	return 1
+}
+
 panic()
 {
 	if command -v chvt >/dev/null 2>&1; then
-- 
2.5.0


--- End Message ---
--- Begin Message ---
Closing this as I never received an explanation for this.

Ben.

On Mon, 25 Jan 2016 15:36:44 +0000 Ben Hutchings <ben@decadent.org.uk> wrote:
> On Wed, 2015-12-09 at 16:05 +0000, Ben Hutchings wrote:
> > On Mon, 17 Aug 2015 10:52:14 +0100 Andy Whitcroft <apw@ubuntu.com> wrote:
> > > Package: initramfs-tools
> > > Version: 0.120
> > > Severity: normal
> > >  
> > > Allow hooks to supply specific root mount failure handlers.  These can
> > > both report more specific failure reasons, and in some cases may even be
> > > able to attempt recovery.  This is useful for more complex scenarios
> > > such as LVM and mdadm setups.
> > >  
> > > We use this in Ubuntu to allow augmented lvm2 and mdadm hooks to recover
> > > failed raids and the like.
> > >  
> > > NOTE: that the splash handling here may well be Ubuntu specific.
> > 
> > Thanks for your patch.
> > 
> > Can you explain why this was implemented by extending existing scripts
> > rather than by adding a new phase (possibly with stamp files to control
> > what they do)?
> [...]
> 
> I do need some justification of this change.
> 
> Also, could we have a meeting (IRC or irl) at some point about the
> remaining differences between the Debian/upstream and Ubuntu packages,
> and how to resolve them?
> 
> Ben.

-- 
Ben Hutchings
Horngren's Observation:
              Among economists, the real world is often a special case.


Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---

Reply to: