Skip to contentSkip to conversation

fix error handling in initramfs-framework

PATCH In review Patrick Ohly 2 participants 5 messages Sep 18, 2015

lore
Share & tools
lore
#0 lore raw

cover fix error handling in initramfs-framework

While debugging the root=UUID failure when using IDE disks I noticed that the error messages from initramfs-module did not really explain the problem, and that my "drop to shell" patch was faulty. Here are the improvement respectively fix.

The following changes since commit 72682d72b52355c3fed947167ca3c6064340ead1:

  autotools.bbclass: mkdir ${B} -> mkdir -p ${B} (2015-09-16 22:17:19 +0100)

are available in the git repository at:

git://github.com/pohly/openembedded-core initramfs-rootfs-failure
https://github.com/pohly/openembedded-core/tree/initramfs-rootfs-failure

Patrick Ohly (2):
initramfs-framework: fix "support dropping into shell on failure"
initramfs-framework: better error reporting for invalid root boot
parameter

 meta/recipes-core/initrdscripts/initramfs-framework/finish | 2 +-
 meta/recipes-core/initrdscripts/initramfs-framework/init   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/2 initramfs-framework: fix "support dropping into shell on failure"

Due to a missing $ before the variable name, all fatal errors ended up invoking a shell, instead of only doing that when init_fatal_sh is set as boot parameter.

---
 meta/recipes-core/initrdscripts/initramfs-framework/init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/initrdscripts/initramfs-framework/init +1 -1
index 9291ad5..204f237 100755
@@ -58,7 +58,7 @@ fatal() {
     echo $1 >/dev/console
     echo >/dev/console
 
-    if [ -n "bootparam_init_fatal_sh" ]; then
+    if [ -n "$bootparam_init_fatal_sh" ]; then
         sh
     else
 	while [ "true" ]; do
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/2 initramfs-framework: better error reporting for invalid root boot parameter

When the "boot" parameter refers to a non-existent device, the only visible output at normal log levels was a rather confusing:
ERROR: There's no '/dev' on rootfs.

That's because the actual error, not being able to find the root device, was only a debug message, which gets ignored in the default mode.

Promoting the "root '$bootparam_root' doesn't exist." message from "debug" to "msg" gives sufficient context to understand the error. A more intrusive change would be to change also the control flow.

---
 meta/recipes-core/initrdscripts/initramfs-framework/finish | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/initrdscripts/initramfs-framework/finish +1 -1
index e712ff0..d09bbb8 100755
@@ -37,7 +37,7 @@ finish_run() {
 				fi
 				mount $flags $bootparam_root $ROOTFS_DIR
 			else
-				debug "root '$bootparam_root' doesn't exist."
+				msg "root '$bootparam_root' doesn't exist."
 			fi
 		fi
 
Signature · 1 line
2.1.4
Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] initramfs-framework: better error reporting for invalid root boot parameter

Quoted 8 lines · Patrick Ohly

When the "boot" parameter refers to a non-existent device, the only visible output at normal log levels was a rather confusing:
ERROR: There's no '/dev' on rootfs.

That's because the actual error, not being able to find the root device, was only a debug message, which gets ignored in the default mode.

Quoted 5 lines

Promoting the "root '$bootparam_root' doesn't exist." message from "debug" to "msg" gives sufficient context to understand the error. A more intrusive change would be to change also the control flow.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
Acked-by on v1 1/2
#4 lore raw

Re: [PATCH 1/2] initramfs-framework: fix "support dropping into shell on failure"

In reply to Patrick Ohly
Quoted 5 lines · Patrick Ohly

Due to a missing $ before the variable name, all fatal errors ended up invoking a shell, instead of only doing that when init_fatal_sh is set as boot parameter.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750