Patchwork init-live: default to initrd shell if image isn't found

login
register
mail settings
Submitter Alexandru DAMIAN
Date Dec. 17, 2012, 11:29 a.m.
Message ID <1355743753-12947-1-git-send-email-alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/41193/
State New
Headers show

Comments

Alexandru DAMIAN - Dec. 17, 2012, 11:29 a.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

If the init live fails to find and mount a root-fs image,
we should dump to a shell so that the developer can figure
what's wrong.

Prior art in Ubuntu. Also, leaving a system stale isn't good form.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 meta/recipes-core/initrdscripts/files/init-live.sh |    6 ++++++
 1 file changed, 6 insertions(+)
Ross Burton - Dec. 17, 2012, 12:04 p.m.
On 17 December 2012 11:29, Alex DAMIAN <alexandru.damian@intel.com> wrote:
> +  # don't wait for more than 3 seconds

3 is very short for slower hardware, please make the timeout a bit longer.

Ross
Otavio Salvador - Dec. 17, 2012, 12:09 p.m.
On Mon, Dec 17, 2012 at 9:29 AM, Alex DAMIAN <alexandru.damian@intel.com> wrote:
> From: Alexandru DAMIAN <alexandru.damian@intel.com>
>
> If the init live fails to find and mount a root-fs image,
> we should dump to a shell so that the developer can figure
> what's wrong.
>
> Prior art in Ubuntu. Also, leaving a system stale isn't good form.
>
> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>

I don't like to get a shell at users as he might be an end user and
don't know what to do so I'd prefer to have a proper error message and
support the shell as fallback depending on a boot param or so (so it
can be used during development).

Another issue is the amount of time waiting ... I have hardware that
takes up to 8s to be ready so 3s is too short and the amount of time.
The time to wait should be configurable by bootparam too (and
documented in commitlog).

Regards,

--
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
Ross Burton - Dec. 17, 2012, 12:14 p.m.
On 17 December 2012 12:09, Otavio Salvador <otavio@ossystems.com.br> wrote:
> I don't like to get a shell at users as he might be an end user and
> don't know what to do so I'd prefer to have a proper error message and
> support the shell as fallback depending on a boot param or so (so it
> can be used during development).
>
> Another issue is the amount of time waiting ... I have hardware that
> takes up to 8s to be ready so 3s is too short and the amount of time.
> The time to wait should be configurable by bootparam too (and
> documented in commitlog).

At the end of the day this is a developer's rescue mode, so activating
this based on the debug-tweaks distro feature makes sense.

Ross

Patch

diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index c591f0d..2d6d6f6 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -75,6 +75,7 @@  early_setup
 read_args
 
 echo "Waiting for removable media..."
+C=0
 while true
 do
   for i in `ls /media 2>/dev/null`; do
@@ -90,6 +91,11 @@  do
   if [ "$found" = "yes" ]; then
       break;
   fi
+  # don't wait for more than 3 seconds
+  C=$(( C + 1 ))
+  if [ $C -gt 3 ]; then
+      fatal "Cannot find root image on media"
+  fi
   sleep 1
 done